Repository navigation
Conversation
…ssage is read-only An aborted `fetch` throws a `DOMException`, whose `message` has only a getter, so adding the hint threw a `TypeError` that replaced the tool's error. The hint is now set as an own property, and values that can't take one (strings, plain objects, frozen errors) are rethrown as a new error with the hint.
Contributor
size-limit report 📦Compared: 9e0980e (PR test merge using develop at 2007cec) Against: 2007cec (develop) · base run #68738 ✅ Baseline matches: this diff contains only this PR's changes.
|
Contributor
Optional E2E testsSome optional checks were not successful. They do not block the merge. 1 not successful, 2 successful. See the run.
|
…the thrown error The hint now goes into the error result the MCP SDK builds from a thrown error, by wrapping its `tools/call` request handler, so the error itself is never modified. This also hints when the SDK rejects a tool's output against its `outputSchema`.
logaretm
marked this pull request as ready for review
December 3, 2026 15:36
javascript-sdk-gitflow
Bot
requested review from
RulaKhaled,
andreiborza and
isaacs
December 3, 2026 15:36
logaretm
force-pushed
the
awad/js-4221-addfeedbacktool-turns-an-aborted-fetch-into-cannot-set-property
branch
2 times, most recently
from
December 3, 2026 16:17
e68c711 to
11dcb1e
Compare
Returned error results now get the hint in the same place as thrown errors and rejected output, after the SDK's own changes to the result. Before, the hint was added first, so MCP SDK v2 skipped the text it writes for non-object structuredContent and the error details never reached the client. The tool callback now only records what happened.
logaretm
force-pushed
the
awad/js-4221-addfeedbacktool-turns-an-aborted-fetch-into-cannot-set-property
branch
from
December 3, 2026 16:39
11dcb1e to
a8e8d9b
Compare
3 tasks
timfish
approved these changes
Dec 3, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR changes how
addFeedbackTooladds its hint to failed calls. Previously we caught failed handlers and re-wrote their message to include the hint and then re-thrown it.This caused issues like #27128 where some error types' messages cannot be safely overwritten. The issue suggested a skip which defeats the purpose of what we are doing imo.
One thing we were doing is we also annotated structured error responses, so we could re-use that to do the same for thrown handlers. Meaning we don't have to override any messages, and we don't need to clean our hints from the captured errors sent to Sentry.
Returned error results now get the hint in the same place, after the SDK builds the result. Adding it first made SDK v2 skip the text it writes for non-object
structuredContent.closes #27128