Repository navigation
feat: add a read-only dispatch tool to the MCP server - #25
Merged
Merged
Conversation
An orchestrator that launches a step agent in the background has to copy the message from `next` into the launch. One that sends the launch in the same batch as `next` sends a guessed message, which drops the `Fixes:` lines that carry guard errors. The `dispatch` tool runs the CLI's `dispatch` command, so an agent that gets only the run path reads its own message, byte for byte as `next` returned it. It takes no lock, writes nothing, and refuses when no dispatch is open. The server instructions and docs/mcp.md describe the background launch.
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
An orchestrator that launches a step agent in the background, such as with a workflow tool that returns before the agent ends, has to copy the message from
nextinto the launch. In a probe on October 22, 2026, the orchestrator sent the launch in the same batch asnexton both dispatches, so it launched with a message it guessed beforenextreturned. In a real loop,Fixes:carries guard errors that only Iterward holds, and a guessed message drops them.With this change, the orchestrator passes the agent only
Run: <RUN>, and the agent reads its own message from Iterward.What changes
mcp/tools/dispatch/dispatch.tool.ts: adispatchtool with one argument,run. It runs the CLI'sdispatchcommand and returns{ id, step, agent, attempt, document, openedAt, message }, withmessagebyte for byte asnextreturned it. It carriesreadOnlyHint: true, takes no lock, and refuses withdispatch refused: other: - no open dispatchwhen no dispatch is open.mcp/tools.ts: registers the tool aftershow, in the CLI's usage-line order.mcp/server.ts: theinitializeinstructions tell an agent that got only a run path to calldispatch.Specs:
dispatch.tool.spec.tscovers an open dispatch (message matchesnext, run file unchanged), no open dispatch (a refusal), and a malformed call.server.spec.tslists 12 tools, now one per CLI command butmcp, and addsdispatchto the read-only tools.conformance.spec.tsdoesn't list or count the tools, so it's unchanged.docs/mcp.md: the tool count and table,dispatchin theautoApprovelist and thereadOnlyHintlist, a description of the tool in place of the sentence that said the server has nodispatchtool, and a section on launching an agent in the background.README.mdanddocs/mcp.md: the.mcp.jsonexamples run@push-based/iterward@latestinstead of@VERSION.docs/mcp.mdsays that@latestrefuses a run of an earlier minor version, and how to pin the version that started the run.docs/cli.md,docs/protocol.md, and both READMEs don't name the MCP tool list or count, so they're unchanged.Compatibility
The run format doesn't change, so a run that 0.4.x started continues. The
feat:commit bumps 0.4.1 to 0.4.2, because nx adjusts semver bumps for a 0.x version by default.Checks
In
packages/iterward/,npm test(87 pass),npm run lint, andnpm run typecheckpass.