{"record":{"id":"799dccee483d5fd3","repo":"googleapis/mcp-toolbox","slug":"invalid-params-799dcc","errorCode":"INVALID_PARAMS","errorMessage":"invalid tool name: tool with name %q does not exist","messagePattern":"invalid tool name: tool with name %q does not exist","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/server/mcp/v20250326/method.go","lineNumber":171,"sourceCode":"\t\terr = fmt.Errorf(\"invalid mcp tools call request: %w\", err)\n\t\treturn jsonrpc.NewError(id, jsonrpc.INVALID_REQUEST, err.Error(), nil), err\n\t}\n\n\ttoolName := req.Params.Name\n\ttoolArgument := req.Params.Arguments\n\tlogger.DebugContext(ctx, fmt.Sprintf(\"tool name: %s\", toolName))\n\n\t// Update span name and set gen_ai attributes\n\tspan := trace.SpanFromContext(ctx)\n\tspan.SetName(fmt.Sprintf(\"%s %s\", TOOLS_CALL, toolName))\n\tspan.SetAttributes(\n\t\tattribute.String(\"gen_ai.tool.name\", toolName),\n\t\tattribute.String(\"gen_ai.operation.name\", \"execute_tool\"),\n\t)\n\n\t// Verify tool belongs to the current group before resolving globally.\n\tif !g.ContainsTool(toolName) {\n\t\terr = fmt.Errorf(\"invalid tool name: tool with name %q does not exist\", toolName)\n\t\treturn jsonrpc.NewError(id, jsonrpc.INVALID_PARAMS, err.Error(), nil), err\n\t}\n\n\ttool, ok := primitiveMgr.GetTool(toolName)\n\tif !ok {\n\t\terr = fmt.Errorf(\"invalid tool name: tool with name %q does not exist\", toolName)\n\t\treturn jsonrpc.NewError(id, jsonrpc.INVALID_PARAMS, err.Error(), nil), err\n\t}\n\n\tif tool.HasSecureParams() {\n\t\terr = fmt.Errorf(\"invalid tool name: tool with name %q does not exist\", toolName)\n\t\treturn jsonrpc.NewError(id, jsonrpc.INVALID_PARAMS, err.Error(), nil), err\n\t}\n\n\tsrcName := tool.GetSourceName()\n\tvar src sources.Source\n\tif srcName != \"\" {\n\t\tsrc, ok = primitiveMgr.GetSource(srcName)","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/server/mcp/v20250326/method.go#L153-L189","documentation":"toolsCallHandler first verifies that the requested tool belongs to the currently served group via g.ContainsTool(toolName). This INVALID_PARAMS error tells the client the tool name it invoked is not exposed in this server/group — the client-side equivalent of a 404 for tools.","triggerScenarios":"A tools/call request whose params.name is not in group g's tool set (or isn't registered at all in the PrimitiveManager), while handling tools/call.","commonSituations":"Client caches a tools/list from a different server/config; tool renamed or removed after a config change; client hardcodes tool names; URL path/group mismatch serving a subset of tools.","solutions":["Call tools/list on this server and use an exact tool name from the response","Update hardcoded tool names to match the server's current config (renames happen between versions)","Verify the client connects to the intended server/endpoint serving that tool","Handle the INVALID_PARAMS response in the client by refreshing its tool cache"],"exampleFix":"// before\nclient.CallTool(\"postgres-execute-sql\", args) // renamed tool\n// after: refresh from tools/list\nname := \"execute-sql\" // exact name returned by tools/list\nclient.CallTool(name, args)","handlingStrategy":"validation","validationCode":"const tools = await client.listTools()\nif (!tools.some(t => t.name === toolName)) {\n  throw new Error(`tool \"${toolName}\" not exposed by this server`)\n}","typeGuard":"function isKnownTool(tools: Tool[], name: string): boolean {\n  return tools.some(t => t.name === name)\n}","tryCatchPattern":"try {\n  return await client.callTool({ name: toolName, arguments: args })\n} catch (e) {\n  if (e.code === -32602) { // INVALID_PARAMS: unknown tool\n    await refreshToolCache()\n    throw new Error(`tool \"${toolName}\" unavailable; refreshed tool list`)\n  }\n  throw e\n}","preventionTips":["Always discover tool names via tools/list instead of hardcoding them","Refresh the tool cache on INVALID_PARAMS and after server config changes","Verify you are connected to the server/endpoint that serves the tool"],"tags":["go","mcp","tools-call","invalid-params","client"],"backgroundTag":"tool-not-found","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}