Skip to content

Handling Tool Execution errors in MCP with Agents SDK #2165

@KaranJayakumar

Description

@KaranJayakumar

Please read this first

  • Have you read the docs?Agents SDK docs -> Yes
  • Have you searched for related issues? Others may have had similar requests -> Yes

Question

I have been trying to set up an MCP Server with Agents SDK. I've built the MCP server. When there are tool execution errors, the result object looks like :
{
"content": [
{
"type": "text",
"text": f"{str(e)}",
},
],
"isError": True,
}
. This seems to adhere to the MCP specification, however when attempting to detect when an error has occured while streaming events, I cannot find any references to the isError field. I am assuming that I would get some sort of indication that an error has occurred as a part of the ToolCallOutputItem but there doesn't seem to be any. Apologies if this is a silly question or if i'm on an older version. Would appreciate any assistance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions