{"record":{"id":"71dc0b5766443e09","repo":"different-ai/openwork","slug":"mcp-tool-reported-error","errorCode":"MCP_TOOL_REPORTED_ERROR","errorMessage":"The MCP provider completed the request but reported that the tool operation failed.","messagePattern":"The MCP provider completed the request but reported that the tool operation failed\\.","errorType":"exception","errorClass":"EnterpriseMcpToolResultError","httpStatus":null,"severity":"error","filePath":"packages/enterprise-mcp-client/src/enterprise-mcp-client.ts","lineNumber":663,"sourceCode":"          }, session.requestOptions)\n          return result\n        },\n      })\n    },\n\n    async callTool(input: EnterpriseMcpCallToolInput) {\n      const toolName = configurationValue(() => toolNameSchema.parse(input.toolName))\n      configurationValue(() => assertEnterpriseMcpToolArguments(input.arguments))\n      return runConnectedOperation({\n        connection: input.connection,\n        redirectUri: input.redirectUri,\n        operationPhase: \"tool-execution\",\n        operation: async (session) => {\n          const result = await session.client.callTool({\n            name: toolName,\n            arguments: input.arguments,\n          }, session.requestOptions)\n          if (\"isError\" in result && result.isError) throw new EnterpriseMcpToolResultError(result)\n          return result\n        },\n      })\n    },\n\n    async listResources(input: EnterpriseMcpListResourcesInput) {\n      return runConnectedOperation({\n        connection: input.connection,\n        redirectUri: input.redirectUri,\n        operationPhase: \"resource-discovery\",\n        operation: (session) => collectEnterpriseMcpResources({\n          requestOptions: session.requestOptions,\n          listPage: (cursor, options) => session.client.listResources(\n            cursor ? { cursor } : undefined,\n            options,\n          ),\n        }),\n      })","sourceCodeStart":645,"sourceCodeEnd":681,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/packages/enterprise-mcp-client/src/enterprise-mcp-client.ts#L645-L681","documentation":"callTool() completed the MCP request round-trip: the server returned a CallToolResult, but that result has isError: true, meaning the TOOL ITSELF reported an execution error. The client converts it into EnterpriseMcpToolResultError (surfaced under code MCP_TOOL_REPORTED_ERROR). This is not a transport or protocol failure — the provider executed the tool and the tool said it failed (invalid args, permission denied, upstream error, etc.).","triggerScenarios":"client.callTool({ name, arguments }) returns { isError: true, content: [...] } — e.g. tool-level validation failure, missing permissions on the remote system, rate limits, or the tool's own runtime exception.","commonSituations":"Wrong tool arguments (schema drift after a server update); the connected account lacks scopes/permissions for the tool's backend; the tool's downstream API is down; calling a deprecated/renamed tool.","solutions":["Read the error's result content (message/text blocks) — it contains the tool's own error description.","Validate toolName and arguments against client.listTools() output (inputSchema) before calling.","Re-authenticate or request additional scopes if the error indicates a permission problem.","Retry later if the tool reports a transient upstream failure; otherwise fix the arguments or the integration on the provider side."],"exampleFix":"// before\nconst result = await client.callTool({ toolName: \"search\", arguments: { q: term } })\n// after\nconst tools = await client.listTools()\nconst schema = tools.find((t) => t.name === \"search\")?.inputSchema\n// validate args against schema, then:\nconst result = await client.callTool({ toolName: \"search\", arguments: { query: term } })","handlingStrategy":"validation","validationCode":"const tools = await client.listTools();\nconst tool = tools.find((t) => t.name === toolName);\nif (!tool) throw new Error(`Unknown tool ${toolName}`);\n// validate arguments against tool.inputSchema (e.g. with your JSON-schema validator) before callTool","typeGuard":"function isToolErrorResult(result: unknown): result is { isError: true; content: unknown[] } {\n  return typeof result === \"object\" && result !== null && \"isError\" in result && (result as { isError: unknown }).isError === true;\n}","tryCatchPattern":"try {\n  await client.callTool({ toolName, arguments });\n} catch (e) {\n  if (e.code === \"MCP_TOOL_REPORTED_ERROR\") {\n    // read e.result.content for the tool's own error message; fix args or permissions\n  }\n  throw e;\n}","preventionTips":["Discover tools with listTools() and validate arguments against each tool's inputSchema.","Refresh the tool list after server upgrades — schemas and names drift.","Check required OAuth scopes/permissions for each tool before calling it.","Distinguish MCP_TOOL_REPORTED_ERROR (tool failed) from transport errors (request never completed)."],"tags":["mcp","tool-execution","remote-error"],"backgroundTag":"mcp-tool-reported-error","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}