MCPcopy Index your code
hub / github.com/coder/coder / echoTool

Function echoTool

coderd/x/chatd/mcpclient/mcpclient_test.go:40–51  ·  view source on GitHub ↗

echoTool returns a ServerTool that echoes its "input" argument prefixed with "echo: ".

()

Source from the content-addressed store, hash-verified

38// echoTool returns a ServerTool that echoes its "input" argument
39// prefixed with "echo: ".
40func 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.
54func greetTool() mcpserver.ServerTool {

Calls 1

RequiredMethod · 0.80

Tested by

no test coverage detected