Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(server): stop shipping full MCP tool results in thread payloads #5482

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/5482/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

MCP tool calls were exempt from activity payload slimming: projectActivityPayload early-returns on itemType === "mcp_tool_call", so the full tool result rides along in every snapshot and live event. On MCP-heavy threads this dominates the wire — one imported thread ships 3.2 MB gzipped, with two-thirds of its post-slimming bytes being unslimmed MCP payloads (worst single call: a GitHub fetch_pr result at 1 MB).

The exemption existed because both clients render payload.data.item in the expanded work-log row. The fix keeps exactly the fields that row renders (tool, server, status, arguments, appContext, error, durationMs, plus toolName/input for the Claude-adapter shape) and summarizes the result to one 84-char line, same as regular tool output. Full payloads stay in SQLite, so an on-demand detail endpoint can be added later without data loss.

Measured against a real db seeded with six representative threads (2,991 MCP activities): 12.2 MB of MCP payload JSON drops to 546 KB (95.6% reduction). Both provider payload shapes (Codex data.item, Claude/OpenCode data.result) verified against real rows.

Note: this trades away in-app access to full historical MCP results (they were previously visible in the expanded row). Per the pagination investigation, that's an accepted temporary loss; the data remains in persistence.


Change made by Claude Fable 5 via Claude Code.


Note

Medium Risk Changes the shape and fidelity of MCP activity data on thread snapshots and live events (lossy summaries), but scope is limited to projection with strong test coverage and no persistence changes.

Overview MCP tool calls are no longer exempt from activity payload slimming in projectActivityPayload. Instead of passing mcp_tool_call through unchanged, the server now runs projectMcpToolCallData, which keeps only fields the expanded work-log row uses (tool, server, status, arguments, appContext, error, durationMs, plus Claude-style toolName/input) and replaces full tool results with a one-line summary via the same summarizeToolTextOutput helper used for other tools.

Codex-shaped payloads (data.item.result) and Claude/OpenCode-shaped payloads (data.result blocks) are both handled; internal metadata like _meta and large structuredContent are dropped. Changed file paths can still be collected into a files array. Full MCP results remain in persistence—only snapshot/live thread transports shrink.

Tests now assert large MCP fixtures compress dramatically and that web/mobile derived views stay aligned except for the intentional loss of full historical MCP result text in the expanded row.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 22f7a583f1ef616f0273ede3cf85f6335c472725. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Stop shipping full MCP tool results in thread payloads

  • Adds projectMcpToolCallData in ActivityPayloadProjection.ts to slim MCP tool-call payloads: only whitelisted fields (tool, server, arguments, etc.) are kept, and result content is replaced with a short text summary.
  • Handles both Codex-shaped (item array) and Claude-shaped (toolName/input/result) MCP data formats.
  • Changed files detected in results are surfaced as a files array on the slimmed payload.
  • Behavioral Change: activities with itemType === "mcp_tool_call" previously passed through unchanged; they now return a slimmed data object, which reduces payload size significantly (tests assert < 500 bytes).
Macroscope summarized 22f7a58.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: 0a82014e-4d90-403b-9e56-c837c023198f

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    3. Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 95ab949d52277c4eddb793c6d8af5e0b53c2703d. Configure [here](https://www.cursor.com/dashboard/bugbot).
    4. Approvability

      Verdict: Approved 22f7a58

      Performance optimization extending existing payload slimming to MCP tool calls. The change keeps UI-rendered fields while summarizing bulky result content, with full payloads preserved in persistence. Well-tested and self-contained.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).

Sign in to join this conversation.