Skip to content

fix(mcp): treat CallToolResult isError as tool failure - #16988

Closed
MaheshBhushan wants to merge 2 commits into
anomalyco:devfrom
MaheshBhushan:fix/16969-mcp-iserror-maps-to-tool-error
Closed

MaheshBhushan wants to merge 2 commits into
anomalyco:devfrom
MaheshBhushan:fix/16969-mcp-iserror-maps-to-tool-error

Conversation

@MaheshBhushan

Copy link
Copy Markdown

Issue for this PR

Closes #16969

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

When an MCP tool returns CallToolResult with isError: true, this PR throws an error from the MCP tool execution path instead of returning it as a successful tool result.

Before this change:

  • MCP isError=true responses were returned through normal result flow.
  • Session processor handled them as tool-result and set state.status = "completed".

After this change:

  • MCP isError=true responses are converted to thrown errors with extracted text.
  • Session processor follows the tool-error path.
  • Tool part status maps to error as expected.

How did you verify your code works?

  • Confirmed MCP dynamic tool execute path now checks result.isError.
  • Added conversion of MCP content payload to a readable error message.
  • Verified successful MCP calls still return normal results unchanged.

Screenshots / recordings

Not included (logic change only).

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown
Contributor

Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] MCP tool calls with isError=true incorrectly show status="completed"

1 participant