fix: surface MCPProtocolError message via LocalizedError#1095
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
Summary
MCPProtocolErrorcarries amessage: Stringthat holds the underlying SQL or transport detail (e.g.,"Unknown column 'active' in 'field list'"), but the type didn't conform toLocalizedError.Error.localizedDescriptiontherefore fell back to the Swift default formatter, which produces uninformative text like:This is what the AI chat user sees when a tool call fails, so the assistant has nothing to explain back beyond a generic guess at "connection issues / permissions / column existence".
Fix
Conform
MCPProtocolErrortoLocalizedErrorand returnmessagefromerrorDescription. Single-line change.Effect
error.localizedDescriptionnow returns the protocol's own message string. The chat tool result already useslocalizedDescriptionwhen wrapping the failure, so failures like:now surface verbatim instead of being masked.
Test plan
update users set is_inactive = 1 where id = 1against a database whereis_inactivedoes not exist."Error: Unknown column 'is_inactive' in 'field list'"(or the equivalent error from the underlying driver), not"TablePro.MCPProtocolError error 1".