{"record":{"id":"7ab8e16d98872d34","repo":"t8y2/dbx","slug":"dbx-mcp-tool-failed-tool-name","errorCode":null,"errorMessage":"DBX MCP tool failed: ${tool.name}","messagePattern":"DBX MCP tool failed: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"crates/dbx-core/assets/pi-mcp-bridge.mjs","lineNumber":182,"sourceCode":"  send({ jsonrpc: \"2.0\", method: \"notifications/initialized\", params: {} });\n\n  const toolList = await request(\"tools/list\");\n  const tools = (toolList?.tools ?? []).filter((tool) => enabledTools.has(tool.name));\n  const missing = [...enabledTools].filter((name) => !tools.some((tool) => tool.name === name));\n  if (missing.length > 0) {\n    throw new Error(`DBX MCP did not expose required tools: ${missing.join(\", \")}`);\n  }\n\n  for (const tool of tools) {\n    pi.registerTool({\n      name: tool.name,\n      label: tool.title ?? tool.name,\n      description: tool.description ?? \"\",\n      parameters: tool.inputSchema ?? { type: \"object\", properties: {} },\n      async execute(_toolCallId, params, signal) {\n        const result = await request(\"tools/call\", { name: tool.name, arguments: params ?? {} }, signal);\n        if (result?.isError) {\n          throw new Error(textFromContent(result.content) || `DBX MCP tool failed: ${tool.name}`);\n        }\n        return {\n          content: piContent(result?.content),\n          details: result ?? null,\n        };\n      },\n    });\n  }\n\n  await writeFile(readyFile, \"ready\", \"utf8\");\n\n  pi.on(\"session_shutdown\", async () => {\n    if (closed) return;\n    closed = true;\n    lines.close();\n    child.stdin.end();\n    child.kill();\n  });","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/crates/dbx-core/assets/pi-mcp-bridge.mjs#L164-L200","documentation":"When a tools/call response has isError set, execute() throws the tool's own text content if present, otherwise a generic 'DBX MCP tool failed: <tool.name>'. This surfaces MCP-server-side tool failures as host tool errors.","triggerScenarios":"The child MCP server returns { isError: true } for a tool call — e.g. invalid arguments against inputSchema, server-side exception, resource not found — and the result has no text content.","commonSituations":"Caller passed params not matching the tool's inputSchema; the underlying operation the tool wraps failed (bad query, missing file, permissions); server bug returning isError with empty content.","solutions":["Read the returned error text (result.content) for the server's message and fix the arguments accordingly","Validate params against the tool's inputSchema (tool.parameters) before calling","Check the MCP server logs for the underlying exception; fix or upgrade the server if content is empty"],"exampleFix":"// before\nawait bridge.callTool(\"dbx_search\", { q: 42 }); // wrong param type\n// after\nawait bridge.callTool(\"dbx_search\", { query: \"foo\", limit: 10 }); // matches inputSchema","handlingStrategy":"try-catch","validationCode":"function validateParams(schema, params) {\n  for (const key of Object.keys(schema?.properties ?? {})) {\n    if (schema.required?.includes(key) && params?.[key] === undefined) {\n      throw new Error('missing required param: ' + key);\n    }\n  }\n}","typeGuard":"function isToolError(result) {\n  return result != null && typeof result === 'object' && result.isError === true;\n}","tryCatchPattern":"try {\n  const result = await request('tools/call', { name, arguments: params }, signal);\n  if (isToolError(result)) {\n    const detail = textFromContent(result.content);\n    console.error(`tool ${name} failed: ${detail || 'no detail'}`);\n  }\n} catch (e) {\n  console.error(`tool ${name} rpc error:`, e.message);\n}","preventionTips":["Validate params against the tool's inputSchema before calling","Read the error text in result.content for the server's message","Check MCP server logs for underlying failures","Keep the server updated to fix server-side bugs"],"tags":["mcp","rpc","tool-execution","remote-error"],"backgroundTag":"rpc-tool-call-failed","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}