Repository navigation
feat(mcp): log the JSON-RPC method and tool name of each MCP call - #592
Merged
Merged
Conversation
MCP request logs carried the session or user but no params, so telling which tools an agent session called meant matching side effects (broadcasts, signals, SQL) to request ids by the second. The method and tool name hold no secrets; the arguments, which can, are still never logged. A name that does not look like one is dropped, since it lands unescaped in a key=value line. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Artem Petrov <[email protected]>
artempartos
added a commit
to Hitin/flow
that referenced
this pull request
Oct 28, 2026
* origin/develop: docs(workflows): describe workflows as sessions made of steps (AixleHQ#595) feat(workflows): open archived workflows read-only in the builder (AixleHQ#594) feat(task-comments): let authors delete their own recent comments (AixleHQ#593) feat(mcp): log the JSON-RPC method and tool name of each MCP call (AixleHQ#592) fix(board): show a run waiting for a session slot as Queued on its card (AixleHQ#591) feat(brand): use the new Aixle Flow lockup and route fonts through tokens (AixleHQ#590) feat(overview): show tokens used and session time instead of token cost (AixleHQ#589) fix(agents): pre-acknowledge Claude Code's cost-threshold notice (AixleHQ#587) test(playwright): QA helpers batch 2 (appRequest, readInertiaPage, shot, probeRoutes, signOut) (AixleHQ#586) test(playwright): plain-JS QA helpers for browser_run_code on staging (AixleHQ#584) feat(runners): add the runners table and the Runner model (AixleHQ#583) refactor(feature-flags): plain cached reads, no usage tooling (AixleHQ#579) # Conflicts: # CHANGELOG.md
artempartos
added a commit
to Hitin/flow
that referenced
this pull request
Oct 28, 2026
* origin/develop: docs(workflows): describe workflows as sessions made of steps (AixleHQ#595) feat(workflows): open archived workflows read-only in the builder (AixleHQ#594) feat(task-comments): let authors delete their own recent comments (AixleHQ#593) feat(mcp): log the JSON-RPC method and tool name of each MCP call (AixleHQ#592) fix(board): show a run waiting for a session slot as Queued on its card (AixleHQ#591) feat(brand): use the new Aixle Flow lockup and route fonts through tokens (AixleHQ#590) feat(overview): show tokens used and session time instead of token cost (AixleHQ#589) fix(agents): pre-acknowledge Claude Code's cost-threshold notice (AixleHQ#587) test(playwright): QA helpers batch 2 (appRequest, readInertiaPage, shot, probeRoutes, signOut) (AixleHQ#586) test(playwright): plain-JS QA helpers for browser_run_code on staging (AixleHQ#584) feat(runners): add the runners table and the Runner model (AixleHQ#583) refactor(feature-flags): plain cached reads, no usage tooling (AixleHQ#579) # Conflicts: # CHANGELOG.md
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.
Why
When an agent session ends mid-step, the first question is which Flow tools it called and when. The MCP request log line has carried the session (or the personal token's user) since #554, but not what the request was: params are dropped for
/mcpand/action_mcpbecause tool arguments can hold secrets. Working out that a given request wasfinish_sessionmeant matching broadcasts, signals and SQL to request ids by the second, and calls landing in the same second could not be told apart.The JSON-RPC method and the tool name hold no secrets. This logs those two and nothing else.
What
MCPController#append_info_to_payloadaddsrpc(the JSON-RPCmethod) and, fortools/call,tool(params.name). The line reads… session=123 rpc=tools/call tool=finish_session.[\w./-]{1,128}) is dropped: it comes from the client and lands unescaped in a key=value line, soname: "x session=1"could otherwise forge a field.Why this cannot break tool calls
request.filtered_parameters). This reads the memoized result after the transport has answered, so the body stream the MCP transport reads is untouched.append_info_to_payloadruns in anensureafter the tool has executed, so a raise there would turn an executed call into a 500 and the agent would retry its side effects. The extraction rescues and logs nothing instead. A body that is not JSON exercises that path, and the test checks it is answered with the same-32700as before this change.tools/callthrough the endpoint and asserts both its result and the log fields.Tests
test/integration/request_log_principal_test.rb: covers a real tool call (answered and logged),tools/list(method only), an unknown tool (the name the client asked for is logged), a forged name (dropped) and a body that is not JSON.test/config/lograge_options_test.rb:rpc/toolreach the line for MCP paths only, and are absent when there are none.🤖 Generated with Claude Code