Skip to content

[FEATURE] Preserve CallToolResult.isError flag in MCPToolResult to distinguish application errors from protocol errors #1670

@Sai-Raj-Reddy

Description

@Sai-Raj-Reddy

Problem Statement

The current MCP client's call_tool_sync() catches all exceptions and converts them to a generic MCPToolResult with status="error". This makes it hard to distinguish between protocol errors and application-level failures. The current implementation only provides a text message via str(exception).

https://github.com/strands-agents/sdk-python/blob/main/src/strands/tools/mcp/mcp_client.py#L602-L712

Proposed Solution

Add the isError field to MCPToolResult TypedDict and populate it from CallToolResult.isError in the _handle_tool_result() method. This enables differentiation between:

  • Application errors (tool executed but failed)
  • Protocol/client errors (exception during execution)

Use Case

This allows proper error handling, accurate metrics collection, and better observability in production systems.

Alternatives Solutions

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions