Annotation Interface McpElicitation
Annotation for methods that handle elicitation requests from MCP servers. This
annotation is applicable only for MCP clients.
Methods annotated with this annotation can be used to process elicitation requests from MCP servers.
For synchronous handlers, the method must return ElicitResult. For asynchronous
handlers, the method must return Mono<ElicitResult>.
Example usage:
@McpElicitation(clients = "my-client-id")
public ElicitResult handleElicitationRequest(ElicitRequest request) {
return ElicitResult.builder()
.message("Generated response")
.requestedSchema(
Map.of("type", "object", "properties", Map.of("message", Map.of("type", "string"))))
.build();
}
@McpElicitation(clients = "my-client-id")
public Mono<ElicitResult> handleAsyncElicitationRequest(ElicitRequest request) {
return Mono.just(ElicitResult.builder()
.message("Generated response")
.requestedSchema(
Map.of("type", "object", "properties", Map.of("message", Map.of("type", "string"))))
.build());
}
- Author:
- Christian Tzolov
- See Also:
-
McpSchema.ElicitRequestMcpSchema.ElicitResult
-
Required Element Summary
Required Elements
-
Element Details
-
clients
String[] clientsUsed as connection or client identifier to select the MCP clients, the elicitation method is associated with.
-