MCP: bounded reads with offset/limit pagination for read_meeting and read_dictation#1363
Open
r3dbars wants to merge 2 commits into
Open
MCP: bounded reads with offset/limit pagination for read_meeting and read_dictation#1363r3dbars wants to merge 2 commits into
r3dbars wants to merge 2 commits into
Conversation
…read_dictation The two read tools were token bombs: read_meeting returned an entire 90-minute transcript verbatim and read_dictation dumped the whole day file. Both now support optional offset/limit params and a ~30k-char size guard (maxUnpaginatedReadCharacters): anything paginated or over budget comes back as a JSON window with total_utterances/total_entries, offset, returned, truncated, next_offset, and a continuation hint. Frontmatter metadata is preserved on full-section meeting pages; utterance windows reuse the TranscriptedCaptureKit parser. Small unpaginated reads stay byte-identical raw markdown, and entry_id reads are unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GuGZaFRmNrqfGPpqf7WH4n
Three test fixtures built labeled tuples with inline Double math inside map closures; the Swift type checker times out on that expression shape (build-and-test failure on CI). Replace them with a shared loop-based makeSequentialUtterances helper in TestHelpers. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GuGZaFRmNrqfGPpqf7WH4n
Owner
Author
|
Merge-room hold: draft, stacked on #1362, and MCP package/stack proof is missing. Live state checked 2026-07-02: head |
11 tasks
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
read_meeting(defaultsection:"full") andread_dictation(noentry_id) dump entire files — a 90-minute meeting is a massive token bill for the connected agent, and there was no way to page through a transcript or fetch a bounded slice. These are exactly the tools an agent reaches for right after anylist_*call. From the agent-surface audit.Product Impact
agent artifactsagent workflowWhat changed
read_meeting: new optionaloffset(0-based utterance index) andlimitparams. Explicit paging — or a raw dump that would exceed a size guard — returns a structured page instead: frontmatter preserved, dialogue bounded to the window, plustotal_utterances,offset,returned,truncated,next_offset(null when done), and ahinttelling the agent how to continue or usesection:"speakers".read_dictation: same shape over entries (total_entries, …) when noentry_idis given;entry_idbehavior unchanged.maxUnpaginatedReadCharacters = 30_000(~7–8k tokens) — typical files pass through untouched; a long transcript auto-truncates with continuation info instead of dumping. Auto-windows fill to the budget with per-item overhead estimates and always advance at least one item.section:"speakers"unchanged; unparseable markdown falls back to the raw dump rather than erroring.Tools/TranscriptedMCP/CLAUDE.mdrows + size-guard gotcha; 8 new handler tests (windowing, offset-past-end totals, oversized auto-truncation, byte-identical small reads, entry_id precedence).How I checked it
scripts/dev/agent-preflight.sh.agents/test-matrix.ymlidentifiedswift test --package-path Tools/TranscriptedMCP+ stacked union (CaptureKit/CLI package tests, e2e smoke) — run by Swift CI on macOS at this exact head (f918b61), green: https://github.com/r3dbars/transcripted/actions/runs/28622792834 (the workflow runs the full matrix as the required merge gate)CI history: the first run failed on a Swift type-check timeout in three new test fixtures (labeled tuples with inline
Doublemath in.mapclosures); fixed inf918b61by a loop-basedmakeSequentialUtteranceshelper in TestHelpers, after which the full run passed.Authoring context: written in a Linux session with no local Swift toolchain; verification is the green macOS Swift CI run above.
Risk Review
.agent-review/visuals/evidence — n/aNotes
Stacked on #1362 (both modify
ToolHandlers.swift/Models.swift) — merge that first; GitHub will retarget this tomainautomatically. Part of the agent-surface audit series (#1356–#1362). Design choice worth flagging: files the parser can't window bypass the size guard via the raw fallback (documented in a comment) — erroring there would break reads of legacy/odd files entirely.Agent handoff
COORD_DONE: GREEN | (this PR) | bounded reads + pagination on both read tools | retarget after #1362 merges | none | Swift CI green at head f918b61 (full matrix) | merge #1362, retarget, human review + merge🤖 Generated with Claude Code
https://claude.ai/code/session_01GuGZaFRmNrqfGPpqf7WH4n