Skip to content

fix: surface MCPProtocolError message via LocalizedError#1095

Merged
datlechin merged 1 commit into
mainfrom
fix/mcp-protocol-error-localized-description
May 7, 2026
Merged

fix: surface MCPProtocolError message via LocalizedError#1095
datlechin merged 1 commit into
mainfrom
fix/mcp-protocol-error-localized-description

Conversation

@datlechin

Copy link
Copy Markdown
Member

Summary

MCPProtocolError carries a message: String that holds the underlying SQL or transport detail (e.g., "Unknown column 'active' in 'field list'"), but the type didn't conform to LocalizedError. Error.localizedDescription therefore fell back to the Swift default formatter, which produces uninformative text like:

TablePro.MCPProtocolError error 1

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 MCPProtocolError to LocalizedError and return message from errorDescription. Single-line change.

Effect

error.localizedDescription now returns the protocol's own message string. The chat tool result already uses localizedDescription when wrapping the failure, so failures like:

"Unknown column 'active' in 'field list'"
"Connection refused"
"User declined to run this query."

now surface verbatim instead of being masked.

Test plan

  • Build the project.
  • In AI Chat, ask the assistant to update users set is_inactive = 1 where id = 1 against a database where is_inactive does not exist.
  • Tool result content shows "Error: Unknown column 'is_inactive' in 'field list'" (or the equivalent error from the underlying driver), not "TablePro.MCPProtocolError error 1".

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@datlechin datlechin merged commit 26bd781 into main May 7, 2026
1 check passed
@datlechin datlechin deleted the fix/mcp-protocol-error-localized-description branch May 7, 2026 15:13
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.

1 participant