Skip to content

Commit dc2bd70

Browse files
committed
feat(session): expose persisted flag in session-profile structured output
`session_use_defaults_profile` already wrote `persisted: true` into its result when called with `persist: true`, but the type and schema didn't surface it, so JSON consumers couldn't rely on the field. - Adds `persisted?: boolean` to `SessionProfileDomainResult`. - Adds the field to `xcodebuildmcp.output.session-profile/1.schema.json`. - Switches the persist-success unit test to verify the structured output carries `persisted: true` (in addition to the existing log assertion). - Adds a snapshot fixture exercising the persist-success path.
1 parent ac69ac6 commit dc2bd70

4 files changed

Lines changed: 25 additions & 6 deletions

File tree

schemas/structured-output/xcodebuildmcp.output.session-profile/1.schema.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
},
3434
"currentProfile": {
3535
"type": "string"
36+
},
37+
"persisted": {
38+
"type": "boolean"
3639
}
3740
},
3841
"required": [

src/mcp/tools/session-management/__tests__/session_use_defaults_profile.test.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ import {
99
schema,
1010
sessionUseDefaultsProfileLogic,
1111
} from '../session_use_defaults_profile.ts';
12-
import { allText, runLogic } from '../../../../test-utils/test-helpers.ts';
12+
import {
13+
allText,
14+
createMockToolHandlerContext,
15+
runLogic,
16+
} from '../../../../test-utils/test-helpers.ts';
1317

1418
describe('session-use-defaults-profile tool', () => {
1519
beforeEach(() => {
@@ -83,11 +87,11 @@ describe('session-use-defaults-profile tool', () => {
8387
sessionStore.setActiveProfile('ios');
8488
sessionStore.setActiveProfile(null);
8589

86-
const result = await runLogic(() =>
87-
sessionUseDefaultsProfileLogic({ profile: 'ios', persist: true }),
88-
);
89-
expect(result.isError).toBeFalsy();
90-
expect(allText(result)).toContain('Persisted active profile selection');
90+
const { ctx, result, run } = createMockToolHandlerContext();
91+
await run(() => sessionUseDefaultsProfileLogic({ profile: 'ios', persist: true }));
92+
expect(result.isError()).toBe(false);
93+
expect(result.text()).toContain('Persisted active profile selection');
94+
expect(ctx.structuredOutput?.result).toMatchObject({ persisted: true });
9195
expect(writes).toHaveLength(1);
9296
const parsed = parseYaml(writes[0].content) as { activeSessionDefaultsProfile?: string };
9397
expect(parsed.activeSessionDefaultsProfile).toBe('ios');
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"schema": "xcodebuildmcp.output.session-profile",
3+
"schemaVersion": "1",
4+
"didError": false,
5+
"error": null,
6+
"data": {
7+
"previousProfile": "(default)",
8+
"currentProfile": "MyCustomProfile",
9+
"persisted": true
10+
}
11+
}

src/types/domain-results.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,7 @@ export type SessionProfileDomainResult = ToolDomainResultBase & {
566566
kind: 'session-profile';
567567
previousProfile: string;
568568
currentProfile: string;
569+
persisted?: boolean;
569570
};
570571
export type SimulatorActionResultDomainResult = ToolDomainResultBase & {
571572
kind: 'simulator-action-result';

0 commit comments

Comments
 (0)