Repository navigation
Keep the code and message of MCP JSON-RPC errors - #164
Open
Mr-Noor-aldeen wants to merge 18 commits into
Open
Mr-Noor-aldeen wants to merge 18 commits into
Mr-Noor-aldeen wants to merge 18 commits into
Conversation
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.
Fixes #161.
_decoderaised a fixed "Invalid or refused MCP response." for every JSON-RPC error, so the server's code and message never reached the caller.A well-formed JSON-RPC error now raises a
ProoflineErrorwith the type unchanged (urn:proofline:sdk:mcp), the title set toJSON-RPC error <code>, and the server message as the detail, with the API token redacted through the sameredactedhelper problem documents use. Anything malformed still raises the fixed refusal: the error must be an object with an integer code (a boolean is rejected) and a string message, and the response cannot carry botherrorandresult. Tool calls still never retry.BearerAuthgains a read-onlytokenproperty so the MCP layer can redact the credential from error text.Tests:
test_mcp_jsonrpc_error_keeps_code_and_redacted_messageandtest_mcp_jsonrpc_error_malformed_still_refused(both run sync and async) fail on main and pass with the change. Full suite (238 tests), ruff, mypy, the generate check and the contract check all pass. README updated.