# Suggestions

Suggestions are relatively simple. They simply add suggestions to the arguments of a command.

```java
            preCtx.addOptions("speed", new IntegerArgument.Options(1, 10));
            preCtx.addSuggestions("speed", sender -> {
                return IntStream.range(1, 11)
                        .mapToObj(value -> {
                            return new Suggestion(String.valueOf(value), MiniMessage.miniMessage().deserialize("A fly speed of <speed>",
                                    TagResolver.resolver("speed", Tag.selfClosingInserting(Component.text(value)))));
                        }).collect(Collectors.toSet());
            });
        });
```

The suggestion constructor has two overloads: (`String`) and (`String`,`Componen`t) (with component being an Adventure component).

\
Async suggestions are also here.

```java
            preCtx.addAsyncSuggestions(NAME_KEY, sender -> {
                if (!(sender instanceof final Player player)) {
                    return CompletableFuture.completedFuture(Collections.emptySet());
                }
                return userService.getUser(player.getUniqueId()).thenApply(user -> user
                        .getHomes()
                        .stream()
                        .map(Home::getName)
                        .map(Suggestion::new)
                        .collect(Collectors.toSet()));
            });
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://slimecraft.gitbook.io/slimecraft-docs/deep-dive/context/pre-context/suggestions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
