Skip to content

fix: preserve upstream MCP tool errors - #1213

Merged
helpcodeai merged 3 commits into
HelpCode-ai:mainfrom
tridev-tej:tejesh/anythingmcp-1203-tool-errors
Oct 25, 2026
Merged

helpcodeai merged 3 commits into
HelpCode-ai:mainfrom
tridev-tej:tejesh/anythingmcp-1203-tool-errors

Conversation

@tridev-tej

@tridev-tej tridev-tej commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

MCP tool failures were logged and cached as successes.

Changes

  • Return sanitized text with isError.
  • Record ERROR audits/metrics; skip response caching and learning.
  • Keep the original executor shape.

Type

  • Bug fix

Testing

  • Regression tests: cloud and self-hosted.

Checklist

  • Local verification

Related Issues

Fixes #1203

@github-actions

Copy link
Copy Markdown

👋 Welcome, @tridev-tej, and thanks for opening your first PR on AnythingMCP!

A few quick pointers:

  • Make sure CI is green before requesting review (Backend, Frontend, Playwright, CodeQL, Trivy).
  • If this is a new adapter, the parametrised catalog.spec.ts test will validate it automatically.
  • Sign off your commits if you can — it's not blocking, just nice to have.

Someone from the core team will look at this within ~48h. If you don't hear back, please ping us in Discussions / Q&A.

⭐ While you wait — if you find AnythingMCP useful, a star helps others discover it.

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@helpcodeai helpcodeai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @tridev-tej, and welcome! The behaviour is right and the tests cover what #1203 asks for.

The problem is the size. Most of the diff splits executeTool into a dozen helpers, and that's the path every tool call in AnythingMCP goes through, so I can't review a refactor of it alongside a bug fix. Could you cut it down to the fix only? Keep executeTool as it is, and right after executeWithEngine, if the connector is MCP and the body is an MCP result with isError: true, log it as ERROR, skip the cache and the KG ingest, and return the error. That plus your tests should be a few dozen lines. If you think the refactor is worth it on its own, open an issue first and we can talk about it there.

One more detail: return a text version of the upstream content (like the success path does) instead of passing the upstream result object through, so _meta, structuredContent or other content types from a remote server don't reach the client unfiltered.

And before we can merge anything, please sign the CLA: post a comment with exactly "I have read the CLA Document and I hereby sign the CLA" and nothing else.

@helpcodeai

Copy link
Copy Markdown
Contributor

Thanks @tridev-tej, this is exactly the size I was hoping for, and returning only the text parts is the right call. I've started CI on the fork.

Small optional thing: if a server sends an error with no text content at all, safeText ends up empty and the client gets an empty error. Something like "The upstream MCP tool reported an error without details." as a fallback would read better.

The only thing blocking the merge is the CLA. Post a new comment with just this line and nothing else, and I'll merge once CI is green:

I have read the CLA Document and I hereby sign the CLA

@tridev-tej

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Oct 24, 2026
@tridev-tej

Copy link
Copy Markdown
Contributor Author

hi @helpcodeai, CLA signed and CI is green. Could you merge this?

@tridev-tej
tridev-tej requested a review from helpcodeai October 24, 2026 21:07

@helpcodeai helpcodeai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @tridev-tej, CLA signed and CI green. Merging.

@helpcodeai
helpcodeai merged commit de8ff9c into HelpCode-ai:main Oct 25, 2026
14 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP bridge loses upstream isError, logs failures as SUCCESS and caches them

2 participants