Original issue tinyhumansai#2604 by @YOMXXX on 2026-05-25T06:00:10Z
Summary
Extract the MCP write-dispatch and audit helper flow from the oversized src/openhuman/mcp_server/tools.rs module into a focused sibling module, likely src/openhuman/mcp_server/write_dispatch.rs.
Problem
src/openhuman/mcp_server/tools.rs is currently around 2,750 lines and now owns both broad MCP tool registry behavior and the write-dispatch/audit pipeline. That makes future audit-policy changes, write-tool routing fixes, and review of write-specific behavior harder than necessary.
The immediate review context is tinyhumansai#2566: the audit feature is already large enough, so moving this code in the same PR would be a heavy refactor orthogonal to the audit-log behavior.
Solution (optional)
Move write-specific helpers such as dispatch_write_tool, audit_write, audit_write_rejection, audit_write_rejection_without_config, summarize_write_args, and related small support functions into mcp_server/write_dispatch.rs. Keep public behavior unchanged and leave tools.rs as the registry/orchestration entrypoint that delegates to the write-dispatch module.
Scope should stay mechanical where possible:
Acceptance criteria
Related
Summary
Extract the MCP write-dispatch and audit helper flow from the oversized
src/openhuman/mcp_server/tools.rsmodule into a focused sibling module, likelysrc/openhuman/mcp_server/write_dispatch.rs.Problem
src/openhuman/mcp_server/tools.rsis currently around 2,750 lines and now owns both broad MCP tool registry behavior and the write-dispatch/audit pipeline. That makes future audit-policy changes, write-tool routing fixes, and review of write-specific behavior harder than necessary.The immediate review context is tinyhumansai#2566: the audit feature is already large enough, so moving this code in the same PR would be a heavy refactor orthogonal to the audit-log behavior.
Solution (optional)
Move write-specific helpers such as
dispatch_write_tool,audit_write,audit_write_rejection,audit_write_rejection_without_config,summarize_write_args, and related small support functions intomcp_server/write_dispatch.rs. Keep public behavior unchanged and leavetools.rsas the registry/orchestration entrypoint that delegates to the write-dispatch module.Scope should stay mechanical where possible:
Acceptance criteria
tools.rs..github/workflows/coverage.yml).Related