{"record":{"id":"968bef552833c7e2","repo":"t8y2/dbx","slug":"dbx-mcp-did-not-expose-required-tools-missing-j","errorCode":null,"errorMessage":"DBX MCP did not expose required tools: ${missing.join(\", \")}","messagePattern":"DBX MCP did not expose required tools: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"crates/dbx-core/assets/pi-mcp-bridge.mjs","lineNumber":170,"sourceCode":"          onAbort();\n        } else {\n          signal.addEventListener(\"abort\", onAbort, { once: true });\n        }\n      }\n    });\n\n  await request(\"initialize\", {\n    protocolVersion: \"2025-03-26\",\n    capabilities: {},\n    clientInfo: { name: \"dbx-pi-bridge\", version: \"1\" },\n  });\n  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      },","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/crates/dbx-core/assets/pi-mcp-bridge.mjs#L152-L188","documentation":"After initializing the child MCP server, the bridge calls tools/list and filters by the enabled set; if any required enabled tool name is absent from the server's advertised tools, it throws listing the missing names. This enforces the host's tool contract at startup.","triggerScenarios":"ENABLED_TOOLS_ENV names a tool the MCP server does not implement; server version removed/renamed a tool; tools/list response malformed (tools not an array of objects with name); wrong server binary launched.","commonSituations":"Version skew between host expectations and the MCP server; typos in the enabled-tools env list; server exposes tools conditionally (feature flags, auth scope).","solutions":["Align DBX_PI_MCP_ENABLED_TOOLS with names actually returned by tools/list (inspect the server or its docs)","Upgrade/downgrade the MCP server so it exposes the required tools, or fix typos in tool names","Log toolList?.tools before filtering to see what the server actually exposes"],"exampleFix":"// before\nexport DBX_PI_MCP_ENABLED_TOOLS='[\"dbx_search\",\"dbx_read_v2\"]' // v2 not exposed\n// after\nexport DBX_PI_MCP_ENABLED_TOOLS='[\"dbx_search\",\"dbx_read\"]'","handlingStrategy":"validation","validationCode":"const listed = (await request('tools/list'))?.tools ?? [];\nconst names = new Set(listed.map((t) => t.name));\nconst missing = [...enabledTools].filter((n) => !names.has(n));\nif (missing.length) console.error('server lacks tools:', missing);","typeGuard":"function exposesAllTools(listResult, enabled) {\n  const names = new Set((listResult?.tools ?? []).map((t) => t?.name));\n  return [...enabled].every((n) => names.has(n));\n}","tryCatchPattern":"try {\n  registerDbxMcpBridge(pi);\n} catch (e) {\n  if (e.message.startsWith('DBX MCP did not expose required tools')) {\n    console.error('Tool contract mismatch — check server version vs enabled tools:', e.message);\n  }\n  throw e;\n}","preventionTips":["Keep enabled-tools list in sync with the server's actual tool names","Pin matching versions of host and MCP server","Log tools/list output during setup","Check tool names for typos"],"tags":["mcp","version-mismatch","tool-discovery"],"backgroundTag":"mcp-tool-not-found","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}