Package org.mcpjava.server.completion
Annotation Interface CompletePrompt
Marks a method as providing completion suggestions for a prompt argument.
The annotated method returns completion values for a specific prompt argument.
Parameters
Prompt completion methods may have parameters of the following types:
String- the method must have exactly oneStringparameter representing the partial value that needs to be completed. In most cases it must be annotated withCompleteArgwith thenameattribute set, unless the code was compiled with the-parametersoption. The name must match the name of one of the arguments of the related prompt.CompletionContext- to access values already chosen for other argumentsMcpRequest- to access information about the requestCancellation- to allow processing to be stopped if the client cancels the tool callProgress- to send progress reports back to the client- Implementations may define additional types that can be used as parameters
Return Type Handling
Return types can be:
String- single completion valueList<String>- multiple completion valuesCompletionResult- full completion response with metadata- Other types - Encoded according to framework-specific rules
Example:
@CompletePrompt("myPrompt")
public List<String> completeMyPromptArg(@CompleteArg(name = "value") String partialValue) {
return List.of("option1", "option2", "option3");
}
-
Required Element Summary
Required Elements