{"record":{"id":"5c1db8313253995d","repo":"JuliusBrussee/caveman","slug":"unknown-tool-params-name","errorCode":null,"errorMessage":"unknown tool: ${params?.name}","messagePattern":"unknown tool: (.+?)","errorType":"validation","errorClass":null,"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/27d5a3981a347890211bb1bf2439e5c821a63bc9/agents/delegate/caveman-delegate-mcp.mjs#L122-L158","documentation":"The caveman-delegate MCP server (a stdio JSON-RPC handler) throws when a tools/call request names anything other than its single advertised tool. It is strict per the MCP contract: tools/list returns exactly one tool (TOOL), and calls with other names are protocol errors, not silent no-ops.","triggerScenarios":"A client sending tools/call with a misspelled or outdated tool name (for example after a rename), or a client that never called tools/list and guessed the name.","commonSituations":"Version skew between client hard-coded tool names and the server's current name; typos in hand-rolled MCP clients; copy-paste from a different MCP server's config.","solutions":["Call tools/list first and use the exact name it returns","Update your client to the current delegate tool name exposed by the server","If wrapping the server, assert the name string in one place rather than retyping it"],"exampleFix":"// before\n{ \"method\": \"tools/call\", \"params\": { \"name\": \"delegate\", \"arguments\": { ... } } }\n\n// after — use the exact name from tools/list\nconst [{ name }] = (await rpc(\"tools/list\")).tools;\nawait rpc(\"tools/call\", { name, arguments: { task } });","handlingStrategy":"validation","validationCode":"const tools = (await rpc(\"tools/list\")).tools;\nconst names = new Set(tools.map((t) => t.name));\nif (!names.has(requestedName)) {\n  throw new Error(`unknown tool ${requestedName}; available: ${[...names].join(\", \")}`);\n}","typeGuard":"function isKnownTool(name, advertised) {\n  return advertised.some((t) => t.name === name);\n}","tryCatchPattern":"try { await rpc(\"tools/call\", { name, arguments }); }\ncatch (e) {\n  if (/^unknown tool: /.test(String(e?.message))) { /* re-list tools, correct the name, retry once */ }\n  else throw e;\n}","preventionTips":["Always discover tool names via tools/list at runtime instead of hard-coding","Re-check names after upgrading the delegate server"],"tags":["mcp","json-rpc","validation"],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}