Skip to content

mcp(docs): Show how to read tool results - #195

Merged
tony merged 3 commits into
mcp-response-budgetfrom
mcp-client-guide
Dec 6, 2026
Merged

tony merged 3 commits into
mcp-response-budgetfrom
mcp-client-guide

Conversation

@tony

@tony tony commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Closes #182.

What changed, and why

MCP callers need to decode tool results, follow continuation cursors and distinguish admission from workspace completion. Tool discovery describes the response fields. The package ships a Go SDK example that finds a named session across pages and captures an exact pane.

The guide uses the result fields and cursor behavior from #194.

Checks run

The STDIO suites ran on pristine tmux 3.3 and upstream 3.8. The packaged client also ran against a relocated Linux release with the Go MCP SDK and read a pane beyond the first session page.

  • MCP STDIO on tmux 3.3 passed in 11.01 s.
  • MCP STDIO on tmux 3.8 passed in 8.79 s.
  • Go SDK and relocated release passed in 11.57 s.

Review evidence

MCP initialization owns client instructions and the tool catalogue owns per-operation descriptions. The packed Go client consumes the public STDIO protocol, including continuation and tool errors.

With the topic tests and the runtime code from 89df3c4ba, the focused check failed. The old initialization reply omitted response-decoding instructions, and the old catalogue omitted pagination guidance. The focused test failed in 5.28 s and passed on 15ee04c78 in 5.39 s.

mix test --warnings-as-errors --max-cases 2 --seed 624498 test/stdio_test.exs:16 from packages/mcp

Independent reversions also distinguished the two owners. Keeping the new test and reverting initialization alone failed in 1.40 s. Reverting tool descriptions alone failed in 1.33 s. The restored exchange passed in 1.89 s.

An independent reviewer recorded NO FINDINGS on 910e6e544.

Merge stack

The client guide uses the response and cursor contract in #194. Stack #206 · Changes in this PR

All six required Linux jobs passed on 15ee04c78. GitHub records the stack merge at 15b285de9. CI run · Merged commit

Tool use

Codex extracted this change from #169 and ran the checks above on the topic branch. A separate Codex reviewer checked the component boundaries and the two corrected test fixtures.

tony added 3 commits December 5, 2026 19:05
why: An SDK client could discover inputs without learning how to
decode a result, use its cursor or distinguish an admitted workspace
change from a completed operation.

what:
- Name the JSON text envelope and result fields in tool discovery.
- Ship a Go SDK example that walks pages and captures an exact pane.
- Document tool errors, omitted fields and operation polling.
why: An MCP client learns how to decode a tool result during initialization.
The discovery test still passed if the handshake lost those instructions.

what:
- Check both response fields in the real initialize reply.
@tony
tony force-pushed the mcp-client-guide branch from 910e6e5 to 15ee04c Compare December 6, 2026 01:08
@tony
tony added this pull request to stack #206 December 6, 2026 01:08
@tony
tony merged commit 15b285d into main Dec 6, 2026
6 of 10 checks passed
tony added a commit that referenced this pull request Dec 6, 2026
why: A tmux hook could add output to a pane or option read. A large
MCP reply could hide an operation outcome or advance a cursor before
the client received the page.

what:
- Fit the Program listener to the server socket path, wake waiters on
  exit, and retry pane removal after a lost reply (#191, #192, #193).
- Keep MCP operation outcomes readable and size pages before advancing
  their cursors. Show the STDIO client reading a result (#194, #195).
- Keep hook output out of pane captures and option reads. Use
  `Pane.wait_for_text/4` in the notebook (#196, #197).
- Check root exit separately from trace delivery in cold-start tests
  (#198).
- Document checkout dependencies, inherited sockets and capability
  APIs (#199, #200, #201).
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.

Show an MCP client how to follow a cursor and read an exact pane

1 participant