fix(adapters): use JSON serialization in MCP interceptor#112
Merged
saurabhjain1592 merged 4 commits intomainfrom Mar 7, 2026
Merged
fix(adapters): use JSON serialization in MCP interceptor#112saurabhjain1592 merged 4 commits intomainfrom
saurabhjain1592 merged 4 commits intomainfrom
Conversation
The mcp_tool_interceptor was using Python repr() for statement and
output message construction, producing non-standard formats like
connector({"key": "value"}) and {result: 'data'}. This could cause
false positives in SQLi detection and reduces policy scan quality.
Changed to json.dumps(default=str) for both:
- Input statement: connector_type(json_args) instead of repr
- Output message: JSON-serialized result instead of ad-hoc format
Added tests for statement and output message serialization format.
… serialization fix
The operation default was changed before any release shipped with "query", so it is not a user-visible change. The Added section already documents the default as "execute".
…default mcp_check_input() shipped in v3.7.0 with default "query". PR #106 changed it to "execute" after v3.8.0 was tagged. Users on v3.7.0/v3.8.0 saw "query" as the default, so this is a real behavioral change in v3.9.0.
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
Fixes two serialization issues in
AxonFlowLangGraphAdapter.mcp_tool_interceptor()introduced in #109:repr()(connector({'key': 'value'})), now usesjson.dumps(connector({"key": "value"})). The old format could trigger false positives in SQLi detection when args contain SQL-like content.{result: <repr>}, not valid JSON), now usesjson.dumpsof the raw result. Gives static policy checks (PII scanning, exfiltration detection) clean JSON to work with.Both changes use
default=strfallback for non-serializable types.Test plan
test_connector_type_derived_from_requestnow asserts JSON statement format,test_output_message_uses_json_serializationverifies JSON outputruff checkpasses