public static class McpServerFeatures.AsyncPromptSpecification
extends java.lang.Object
Example prompt specification:
new McpServerFeatures.AsyncPromptSpecification(
new Prompt("analyze", "Code analysis template"),
(exchange, request) -> {
String code = request.getArguments().get("code");
return Mono.just(new GetPromptResult(
"Analyze this code:\n\n" + code + "\n\nProvide feedback on:"));
})
| 构造器和说明 |
|---|
AsyncPromptSpecification(McpSchema.Prompt prompt,
java.util.function.BiFunction<McpAsyncServerExchange,McpSchema.GetPromptRequest,reactor.core.publisher.Mono<McpSchema.GetPromptResult>> promptHandler) |
| 限定符和类型 | 方法和说明 |
|---|---|
McpSchema.Prompt |
prompt() |
java.util.function.BiFunction<McpAsyncServerExchange,McpSchema.GetPromptRequest,reactor.core.publisher.Mono<McpSchema.GetPromptResult>> |
promptHandler() |
public AsyncPromptSpecification(McpSchema.Prompt prompt, java.util.function.BiFunction<McpAsyncServerExchange,McpSchema.GetPromptRequest,reactor.core.publisher.Mono<McpSchema.GetPromptResult>> promptHandler)
prompt - The prompt definition including name and descriptionpromptHandler - The function that processes prompt requests and returns
formatted templates. The function's first argument is an
McpAsyncServerExchange upon which the server can interact with the
connected client. The second arguments is a
McpSchema.GetPromptRequest.public McpSchema.Prompt prompt()
public java.util.function.BiFunction<McpAsyncServerExchange,McpSchema.GetPromptRequest,reactor.core.publisher.Mono<McpSchema.GetPromptResult>> promptHandler()