{"record":{"id":"5c1db8313253995d","repo":"JuliusBrussee/caveman","slug":"unknown-tool-params-name","errorCode":null,"errorMessage":"unknown tool: ${params?.name}","messagePattern":"unknown tool: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"agents/delegate/caveman-delegate-mcp.mjs","lineNumber":140,"sourceCode":"      cwd: { type: \"string\", description: \"Working directory (default: current)\" },\n    },\n    required: [\"task\"],\n  },\n};\n\nasync function handle(msg) {\n  const { id, method, params } = msg;\n  if (method === \"initialize\") {\n    return {\n      protocolVersion: params?.protocolVersion || PROTOCOL_FALLBACK,\n      capabilities: { tools: { listChanged: false } },\n      serverInfo: { name: \"caveman-delegate\", version: \"0.1.0\" },\n    };\n  }\n  if (method === \"tools/list\") return { tools: [TOOL] };\n  if (method === \"ping\") return {};\n  if (method === \"tools/call\") {\n    if (params?.name !== TOOL.name) throw new Error(`unknown tool: ${params?.name}`);\n    if (process.env.CAVEMAN_DELEGATE_CHILD === \"1\") throw new Error(\"cave_delegate_depth_exceeded\");\n    const task = params?.arguments?.task;\n    if (!task || typeof task !== \"string\") throw new Error(\"cave_delegate_missing_task\");\n    const r = await runWorker(task, params?.arguments?.cwd);\n    const lines = [r.out || \"(worker produced no output)\"];\n    if (r.usage) {\n      const u = r.usage;\n      let usageLine = `delegate usage (measured, provider-reported): input ${u.input + u.cacheRead + u.cacheWrite} (cacheRead ${u.cacheRead}, cacheWrite ${u.cacheWrite}), output ${u.output}`;\n      if (u.cost > 0) usageLine += `, cost $${u.cost.toFixed(4)}`;\n      lines.push(\"---\", usageLine);\n    }\n    if (r.code !== 0) {\n      lines.push(\"---\", `worker exit ${r.code}: ${r.err.slice(-500)}`);\n      return { content: [{ type: \"text\", text: lines.join(\"\\n\") }], isError: true };\n    }\n    return { content: [{ type: \"text\", text: lines.join(\"\\n\") }] };\n  }\n  if (method?.startsWith(\"notifications/\")) return undefined;","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/agents/delegate/caveman-delegate-mcp.mjs#L122-L158","documentation":"The caveman-delegate MCP server's handle() supports exactly one tool (TOOL, 'cave_delegate'); a tools/call request naming any other tool throws `unknown tool: ${params?.name}`. This is standard MCP server behavior: unknown tool invocations are rejected rather than silently ignored.","triggerScenarios":"An MCP client issues tools/call with params.name different from TOOL.name (typo, stale cached tool list from an older server version, or another server's tool invoked against this one).","commonSituations":"Client connected to the wrong MCP server, client-side tool cache not refreshed after tools/list changed, a hand-rolled JSON-RPC request with a misspelled tool name, or case-sensitivity mismatch in the tool name.","solutions":["Call the tool by its exact registered name (the name field of the single entry in tools/list)","Refresh the client's tool list via tools/list and retry","Point the client at the correct MCP server for the tool you intended","Fix typos/casing in the tool name in your client config or test harness"],"exampleFix":"// before\n{ method: 'tools/call', params: { name: 'delegate', arguments: { task } } }\n// after\n{ method: 'tools/call', params: { name: 'cave_delegate', arguments: { task } } }","handlingStrategy":"try-catch","validationCode":"const tools = await client.request({ method: 'tools/list' });\nconst names = tools.tools.map(t => t.name);\nif (!names.includes(toolName)) throw new Error(`tool ${toolName} not offered by this server; available: ${names}`);","typeGuard":null,"tryCatchPattern":"try { await callTool('cave_delegate', { task }); } catch (e) {\n  if (/^unknown tool:/.test(e.message)) {\n    await refreshToolList(); // stale cache — re-fetch tools/list and retry with exact name\n  } else throw e;\n}","preventionTips":["Copy the tool name verbatim from tools/list instead of retyping it","Refresh the client tool cache when connecting or after server updates","Verify which MCP server you are connected to before dispatching a call","Use constants for tool names in client code"],"tags":["mcp","tools","rpc"],"backgroundTag":"resource-not-found","analyzedSha":"3ee70a102609e550bd2e68004bf5990a9341c851","analyzedAt":"2026-09-20T15:53:39.229Z","contentChangedAt":"2026-09-20T15:53:39.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}