echoTool returns a ServerTool that echoes its "input" argument prefixed with "echo: ".
()
| 38 | // echoTool returns a ServerTool that echoes its "input" argument |
| 39 | // prefixed with "echo: ". |
| 40 | func echoTool() mcpserver.ServerTool { |
| 41 | return mcpserver.ServerTool{ |
| 42 | Tool: mcp.NewTool("echo", |
| 43 | mcp.WithDescription("Echoes the input"), |
| 44 | mcp.WithString("input", mcp.Description("The input"), mcp.Required()), |
| 45 | ), |
| 46 | Handler: func(_ context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) { |
| 47 | input, _ := req.GetArguments()["input"].(string) |
| 48 | return mcp.NewToolResultText("echo: " + input), nil |
| 49 | }, |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | // greetTool returns a ServerTool that greets by name. |
| 54 | func greetTool() mcpserver.ServerTool { |
no test coverage detected