Skip to content

refactor: Return large tool payloads once, as the JSON mirror - #1875

Open
daveomri wants to merge 8 commits into
masterfrom
refactor/large-payload-json-mirror
Open

daveomri wants to merge 8 commits into
masterfrom
refactor/large-payload-json-mirror

Conversation

@daveomri

Copy link
Copy Markdown
Collaborator

Why

Part of #744: the large-payload tools. Adding the JSON mirror next to their existing text would double the response, e.g., 43.8 → 88.3 KB for a build log and 26.5 → 53.1 KB for fetch-actor-details. So the payload now goes out once, as the mirror.

What changed

  • fetch-apify-docs, get-actor-run-log, get-actor-build-log: content[0] is JSON.stringify(structuredContent) and nothing else. Before, it was the raw page or log.
  • fetch-actor-details: the JSON mirror, plus only the text that structuredContent doesn't carry: the output-schema note, the server-interface header, the links nudge and the runnable guidance. The card, README and input schema are no longer repeated as prose. The server-interface text no longer repeats the operations JSON. The links nudge is sent only when the card, the only source of Console links, is returned.
  • fetch-actor-details-widget: no mirror. Its structuredContent (28–51 KB) is for the UI, and the model keeps the 196-byte pointer.
  • Fix: with output.pricing: false, the card reported a paid Actor as FREE. actorInfo.pricing is now left out instead.
  • Dead code: removed typeObjectToString and the README heading, which had no caller left.

The text content of these 4 tools changes, and actorInfo.pricing can now be absent, so internal's contract tests may need updating.

Notes for reviewers (human-written)

Proof it works

Through mcpc on real data, master vs this branch:

Tool (example) master branch content[0] = structuredContent
fetch-actor-details (apify/website-content-crawler) 26.5 KB 26.7 KB ✅
fetch-apify-docs (storage/dataset) 19.3 KB 19.9 KB ✅
get-actor-build-log, lines: 0 43.8 KB 44.5 KB ✅
fetch-actor-details, serverInterface: true operations twice once, in the mirror ✅
fetch-actor-details on a paid Actor, pricing: false model: FREE no pricing ✅

The fetch-actor-details integration cases now read their sections from the mirror instead of prose headings.

co-written with Claude Code.

@daveomri
daveomri requested a review from jirispilka November 12, 2026 14:44
@daveomri daveomri self-assigned this Nov 12, 2026
@daveomri daveomri linked an issue Nov 12, 2026 that may be closed by this pull request
4 tasks
@daveomri daveomri changed the title refactor: Return large tool payloads once, as the JSON mirror refactor: Mirror structuredContent as JSON text in storage and search tools Nov 13, 2026
@daveomri daveomri changed the title refactor: Mirror structuredContent as JSON text in storage and search tools refactor: Return large tool payloads once, as the JSON mirror Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: Mirror structuredContent as JSON text in every tool result

1 participant