Skip to content

Commit de0f4dd

Browse files
committed
fix: expose trace artifacts in MCP schema
1 parent a2ef3d5 commit de0f4dd

2 files changed

Lines changed: 33 additions & 4 deletions

File tree

src/mcp/__tests__/command-tools.test.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,31 @@ test('MCP prepare outputSchema stays complete for the typed non-exposed command'
412412
assert.ok(prepareSchema.required?.includes('timing'));
413413
});
414414

415+
test('MCP stopped trace schema advertises its downloadable trace artifact', () => {
416+
const stoppedTrace = {
417+
trace: 'stopped',
418+
outPath: '/daemon/fixture.adtrace',
419+
artifacts: [
420+
{
421+
field: 'outPath',
422+
artifactType: 'trace-log',
423+
path: '/daemon/fixture.adtrace',
424+
localPath: '/client/fixture.adtrace',
425+
fileName: 'fixture.adtrace',
426+
},
427+
],
428+
};
429+
430+
assert.deepEqual(validateAgainstSchema(stoppedTrace, COMMAND_OUTPUT_SCHEMAS.trace), []);
431+
assert.notDeepEqual(
432+
validateAgainstSchema(
433+
{ trace: 'stopped', outPath: stoppedTrace.outPath },
434+
COMMAND_OUTPUT_SCHEMAS.trace,
435+
),
436+
[],
437+
);
438+
});
439+
415440
test('MCP untyped object tools stay byte-identical: no outputSchema key', () => {
416441
const tools = listCommandTools();
417442

src/mcp/command-output-schemas.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -686,10 +686,14 @@ export const COMMAND_OUTPUT_SCHEMAS = {
686686
'trace',
687687
'outPath',
688688
]),
689-
objectSchema({ trace: constSchema('stopped'), outPath: stringSchema() }, [
690-
'trace',
691-
'outPath',
692-
]),
689+
objectSchema(
690+
{
691+
trace: constSchema('stopped'),
692+
outPath: stringSchema(),
693+
artifacts: { type: 'array', items: artifactSchema },
694+
},
695+
['trace', 'outPath', 'artifacts'],
696+
),
693697
],
694698
},
695699
} satisfies Record<keyof CommandResultMap, JsonSchema>;

0 commit comments

Comments
 (0)