{"record":{"id":"bc98f33df66a38b8","repo":"musistudio/claude-code-router","slug":"tools-call-params-must-include-a-tool-name-bc98f3","errorCode":null,"errorMessage":"tools/call params must include a tool name.","messagePattern":"tools/call params must include a tool name\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/electron/src/main/browser-automation-mcp.ts","lineNumber":759,"sourceCode":"            }\n          });\n        case \"ping\":\n          return jsonRpcResult(id, {});\n        case \"tools/list\":\n          return jsonRpcResult(id, { tools: browserAutomationTools as unknown as JsonValue });\n        case \"tools/call\":\n          return jsonRpcResult(id, await this.callTool(request.params) as unknown as JsonValue);\n        default:\n          return jsonRpcError(id, -32601, `Unsupported MCP method: ${request.method}`);\n      }\n    } catch (error) {\n      return jsonRpcError(id, -32603, formatError(error));\n    }\n  }\n\n  private async callTool(params: unknown): Promise<ToolCallResult> {\n    if (!isRecord(params) || typeof params.name !== \"string\") {\n      throw new Error(\"tools/call params must include a tool name.\");\n    }\n    const args = isRecord(params.arguments) ? params.arguments : {};\n    try {\n      const result = await this.runTool(params.name, args);\n      return textResult(formatToolResult(params.name, result));\n    } catch (error) {\n      return {\n        ...textResult(formatError(error)),\n        isError: true\n      };\n    }\n  }\n\n  private async runTool(name: string, args: Record<string, unknown>): Promise<unknown> {\n    switch (name) {\n      case \"browser_session_open\":\n        return await this.openSession(args);\n      case \"browser_session_close\":","sourceCodeStart":741,"sourceCodeEnd":777,"githubUrl":"https://github.com/musistudio/claude-code-router/blob/99f24806c6a2c660b16e53e95211c517448a6c90/packages/electron/src/main/browser-automation-mcp.ts#L741-L777","documentation":"A JSON-RPC parameter-validation error from the browser automation MCP server's tools/call handler. The MCP spec requires params to be an object with a string 'name' field; this guard fires when params is not a record or name is missing/non-string before any tool dispatch happens.","triggerScenarios":"Sending a JSON-RPC tools/call request where params is null, an array, or an object lacking a string 'name' property — e.g. { method: 'tools/call', params: { arguments: {...} } }.","commonSituations":"An MCP client sends tool arguments at the top level instead of nested under name/arguments; a hand-rolled JSON-RPC client omits the name field; a serialization bug turns the params object into an array.","solutions":["Shape the request as { name: \"browser_open\", arguments: { ... } } inside params.","Use a compliant MCP client SDK rather than hand-building JSON-RPC payloads.","Log the outgoing params object to confirm name is a non-empty string."],"exampleFix":"// before\nawait mcp.request(\"tools/call\", { tool: \"browser_open\", args: {} });\n\n// after\nawait mcp.request(\"tools/call\", { name: \"browser_open\", arguments: {} });","handlingStrategy":"validation","validationCode":"if (!params || typeof params !== \"object\" || typeof params.name !== \"string\") throw new Error(\"Invalid tools/call params\");\nawait transport.send({ jsonrpc: \"2.0\", id, method: \"tools/call\", params: { name: params.name, arguments: params.arguments ?? {} } });","typeGuard":"function isToolsCallParams(p: unknown): p is { name: string; arguments?: Record<string, unknown> } { return typeof p === \"object\" && p !== null && typeof (p as any).name === \"string\"; }","tryCatchPattern":"try { await mcp.callTool(name, args); } catch (e) { if (e instanceof Error && e.message.includes(\"must include a tool name\")) { /* reshape params to { name, arguments } */ } throw e; }","preventionTips":["Use an MCP client SDK","Always nest arguments under 'arguments'","Unit-test request shaping against the JSON schema"],"tags":["mcp","json-rpc","validation","tools-call"],"backgroundTag":"json-rpc-invalid-params","analyzedSha":"99f24806c6a2c660b16e53e95211c517448a6c90","analyzedAt":"2026-08-27T04:11:01.184Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}