Interface Completions
- All Known Subinterfaces:
CompletionRegistry
- All Known Implementing Classes:
DefaultCompletionRegistry
public interface Completions
Façade interface for
completion/complete providers, keyed by the MCP reference they answer for:
a prompt name (ref/prompt) or a resource URI / resource-template URI (
ref/resource, matched verbatim against the URI the client sends — the same string returned by
resources/templates/list).
A ref with no registered handler yields an empty completion result rather than an error — the MCP spec does not require completions to be exhaustively declared.
-
Method Summary
Modifier and TypeMethodDescriptionregisterForPrompt(String promptName, CompletionFn fn) Registers a completion function for a prompt's arguments.registerForPromptAsync(String promptName, AsyncCompletionFn fn) Registers an asynchronous completion function for a prompt's arguments.registerForResource(String uriOrTemplate, CompletionFn fn) Registers a completion function for a resource or resource-template's variables.registerForResourceAsync(String uriOrTemplate, AsyncCompletionFn fn) Registers an asynchronous completion function for a resource or resource-template's variables.booleanunregisterForPrompt(String promptName) Removes the completion function registered for the specified prompt name.booleanunregisterForResource(String uriOrTemplate) Removes the completion function registered for the specified resource URI or template.
-
Method Details
-
registerForPrompt
Registers a completion function for a prompt's arguments.- Parameters:
promptName- the prompt name, as declared in itsPromptDescriptorfn- the completion function- Returns:
- this registry
-
registerForPromptAsync
Registers an asynchronous completion function for a prompt's arguments.- Parameters:
promptName- the prompt namefn- the asynchronous completion function- Returns:
- this registry
-
registerForResource
Registers a completion function for a resource or resource-template's variables.- Parameters:
uriOrTemplate- the resource URI, or the resource template'suriTemplatefn- the completion function- Returns:
- this registry
-
registerForResourceAsync
Registers an asynchronous completion function for a resource or resource-template's variables.- Parameters:
uriOrTemplate- the resource URI, or the resource template'suriTemplatefn- the asynchronous completion function- Returns:
- this registry
-
unregisterForPrompt
Removes the completion function registered for the specified prompt name.- Parameters:
promptName- the prompt name- Returns:
trueif a function was removed,falseotherwise
-
unregisterForResource
Removes the completion function registered for the specified resource URI or template.- Parameters:
uriOrTemplate- the resource URI or template- Returns:
trueif a function was removed,falseotherwise
-