public static class McpServerFeatures.SyncPromptSpecification
extends java.lang.Object
Example prompt specification:
new McpServerFeatures.SyncPromptSpecification(
new Prompt("analyze", "Code analysis template"),
(exchange, request) -> {
String code = request.getArguments().get("code");
return new GetPromptResult(
"Analyze this code:\n\n" + code + "\n\nProvide feedback on:");
})
| 构造器和说明 |
|---|
SyncPromptSpecification(McpSchema.Prompt prompt,
java.util.function.BiFunction<McpSyncServerExchange,McpSchema.GetPromptRequest,McpSchema.GetPromptResult> promptHandler) |
| 限定符和类型 | 方法和说明 |
|---|---|
McpSchema.Prompt |
prompt() |
java.util.function.BiFunction<McpSyncServerExchange,McpSchema.GetPromptRequest,McpSchema.GetPromptResult> |
promptHandler() |
public SyncPromptSpecification(McpSchema.Prompt prompt, java.util.function.BiFunction<McpSyncServerExchange,McpSchema.GetPromptRequest,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
McpSyncServerExchange 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<McpSyncServerExchange,McpSchema.GetPromptRequest,McpSchema.GetPromptResult> promptHandler()