different-ai/openwork · error · EnterpriseMcpToolResultError

MCP_TOOL_REPORTED_ERROR

MCP_TOOL_REPORTED_ERROR

Error message

The MCP provider completed the request but reported that the tool operation failed.

What it means

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.).

Source

Thrown at packages/enterprise-mcp-client/src/enterprise-mcp-client.ts:663

          }, session.requestOptions)
          return result
        },
      })
    },

    async callTool(input: EnterpriseMcpCallToolInput) {
      const toolName = configurationValue(() => toolNameSchema.parse(input.toolName))
      configurationValue(() => assertEnterpriseMcpToolArguments(input.arguments))
      return runConnectedOperation({
        connection: input.connection,
        redirectUri: input.redirectUri,
        operationPhase: "tool-execution",
        operation: async (session) => {
          const result = await session.client.callTool({
            name: toolName,
            arguments: input.arguments,
          }, session.requestOptions)
          if ("isError" in result && result.isError) throw new EnterpriseMcpToolResultError(result)
          return result
        },
      })
    },

    async listResources(input: EnterpriseMcpListResourcesInput) {
      return runConnectedOperation({
        connection: input.connection,
        redirectUri: input.redirectUri,
        operationPhase: "resource-discovery",
        operation: (session) => collectEnterpriseMcpResources({
          requestOptions: session.requestOptions,
          listPage: (cursor, options) => session.client.listResources(
            cursor ? { cursor } : undefined,
            options,
          ),
        }),
      })

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Read the error's result content (message/text blocks) — it contains the tool's own error description.
  2. Validate toolName and arguments against client.listTools() output (inputSchema) before calling.
  3. Re-authenticate or request additional scopes if the error indicates a permission problem.
  4. Retry later if the tool reports a transient upstream failure; otherwise fix the arguments or the integration on the provider side.

Example fix

// before
const result = await client.callTool({ toolName: "search", arguments: { q: term } })
// after
const tools = await client.listTools()
const schema = tools.find((t) => t.name === "search")?.inputSchema
// validate args against schema, then:
const result = await client.callTool({ toolName: "search", arguments: { query: term } })
Defensive patterns

Strategy: validation

Validate before calling

const tools = await client.listTools();
const tool = tools.find((t) => t.name === toolName);
if (!tool) throw new Error(`Unknown tool ${toolName}`);
// validate arguments against tool.inputSchema (e.g. with your JSON-schema validator) before callTool

Type guard

function isToolErrorResult(result: unknown): result is { isError: true; content: unknown[] } {
  return typeof result === "object" && result !== null && "isError" in result && (result as { isError: unknown }).isError === true;
}

Try / catch

try {
  await client.callTool({ toolName, arguments });
} catch (e) {
  if (e.code === "MCP_TOOL_REPORTED_ERROR") {
    // read e.result.content for the tool's own error message; fix args or permissions
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01). Data as JSON: /api/errors/71dc0b5766443e09. Report an issue: GitHub.