Repository navigation
feat(mcp)!: return text-only tool results by default; add mcp --structured #4466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ce50199
feat(mcp)!: return text-only tool results by default; add mcp --struc…
thymikee c031ce5
refactor(mcp): keep the structured-content mode private and restore a…
thymikee b1fc6ad
fix(mcp): shape pre-command tool-call errors by server mode; address …
thymikee 98a3594
docs(replay): align the divergence surface contract with text-only MCP
thymikee b4613c6
refactor(mcp): delete the default-server handlers without a productio…
thymikee 41cb575
test(mcp): measure the default server's tool list in the schema budge…
thymikee 791c722
docs(mcp): record why default errors are text, mark --structured help…
thymikee a4bc1e6
fix(mcp): preserve human error dispatch and log facts
thymikee 19ea4bc
docs(mcp): keep the CliFlags type to key facts; list the rejected def…
thymikee 5a5995e
refactor(command-output): stop exporting the candidate formatter that…
thymikee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| import assert from 'node:assert/strict'; | ||
| import { test } from 'vitest'; | ||
| import type { AgentDeviceClient } from '@agent-device/command-surface'; | ||
| import { AppError } from '@agent-device/kernel/errors'; | ||
| import { createCommandToolExecutor } from '../command-tools.ts'; | ||
|
|
||
| // The default MCP server returns text only, so a replay divergence must reach the model through | ||
| // the error text with its repair data, and its screen refs must still be pinned. | ||
| test('a default-mode divergence is error text carrying the repair data, and its refs are pinned', async () => { | ||
| const runCalls: Array<{ name: string; input: unknown }> = []; | ||
| const executor = createCommandToolExecutor({ | ||
| createClient: () => ({}) as AgentDeviceClient, | ||
| runCommand: async (_client, name, input) => { | ||
| runCalls.push({ name, input }); | ||
| if (name !== 'replay') return {}; | ||
| throw new AppError('REPLAY_DIVERGENCE', 'Replay failed at step 2 (click "Save")', { | ||
| divergence: { | ||
| version: 1, | ||
| kind: 'action-failure', | ||
| step: { index: 2, source: { path: '/tmp/flow.ad', line: 2 } }, | ||
| action: 'click "Save"', | ||
| screen: { | ||
| state: 'available', | ||
| refsGeneration: 12, | ||
| refs: [{ ref: 'e5', role: 'button', label: 'Save' }], | ||
| }, | ||
| suggestions: [ | ||
| { selector: 'id="save"', basis: 'id', ref: 'e5', role: 'button', label: 'Save' }, | ||
| ], | ||
| suggestionCount: 1, | ||
| resume: { allowed: true, from: 2, planDigest: 'digest-abc' }, | ||
| repairHint: 'state-repair', | ||
| }, | ||
| }); | ||
| }, | ||
| }); | ||
|
|
||
| const result = await executor.execute('replay', { path: '/tmp/flow.ad' }); | ||
|
|
||
| assert.equal(result.isError, true); | ||
| assert.equal('structuredContent' in result, false); | ||
| const text = result.content[0]?.text ?? ''; | ||
| assert.match(text, /^Error \(REPLAY_DIVERGENCE\)/); | ||
| assert.match(text, /Divergence at step 2 \(\/tmp\/flow\.ad:2\)/); | ||
| assert.match(text, /Repair hint: state-repair — .*--from 2 --plan-digest digest-abc/); | ||
| assert.match(text, /@e5 \[button\] "Save"/); | ||
| assert.match(text, /\[id\] "Save" id="save"/); | ||
|
|
||
| await executor.execute('press', { ref: '@e5' }); | ||
| assert.deepEqual(runCalls[1]?.input, { ref: '@e5~s12' }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.