diff --git a/CHANGELOG.md b/CHANGELOG.md index e2a82a570..1130fa825 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [Unreleased] + +### Changed + +- Dictionary-shaped MCP inputs now use client-compatible wire representations ([#491](https://github.com/getsentry/XcodeBuildMCP/issues/491)). The `env` and `testRunnerEnv` inputs on build, launch, test, and session-default tools are arrays of `{ "key": "...", "value": "..." }` entries, while `xcode_ide_call_tool.arguments` is a JSON object string. XcodeBuildMCP converts these values to their existing internal objects only after MCP input validation. + ## [2.7.0] ### New! Xcode 27 Device Hub simulator support @@ -749,4 +755,3 @@ Please note that the UI automation features are an early preview and currently i ## [v1.0.1] - 2025-04-02 - Initial release of XcodeBuildMCP - Basic support for building iOS and macOS applications - diff --git a/package.json b/package.json index 3cc0ac88d..18eb6b5cc 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,8 @@ "test": "vitest run", "posttest": "npm run test:warden-watchdog", "test:warden-watchdog": "node --test scripts/__tests__/warden-watchdog.test.mjs", - "test:schema-fixtures": "vitest run src/snapshot-tests/__tests__/json-fixture-schema.test.ts", + "test:schema-fixtures": "npm run build && vitest run --config vitest.schema.config.ts", + "test:schema-fixtures:update": "UPDATE_SNAPSHOTS=1 npm run test:schema-fixtures", "test:snapshot": "npm run build && vitest run --config vitest.snapshot.config.ts", "test:snapshots": "npm run test:snapshot", "test:snapshot:device": "npm run build && vitest run --config vitest.snapshot.config.ts src/snapshot-tests/__tests__/device.snapshot.test.ts && vitest run --config vitest.snapshot.config.ts src/snapshot-tests/__tests__/cli-json.snapshot.test.ts src/snapshot-tests/__tests__/mcp-json.snapshot.test.ts -t 'device workflow'", diff --git a/src/core/manifest/import-tool-module.ts b/src/core/manifest/import-tool-module.ts index 12ad850f9..8c3f1f5dd 100644 --- a/src/core/manifest/import-tool-module.ts +++ b/src/core/manifest/import-tool-module.ts @@ -11,6 +11,7 @@ import { getPackageRoot } from './load-manifest.ts'; export interface ImportedToolModule { schema: ToolSchemaShape; + mcpSchema: ToolSchemaShape; handler: (params: Record, ctx?: ToolHandlerContext) => Promise; } @@ -19,7 +20,7 @@ const moduleCache = new Map(); /** * Import a tool module by its manifest module path. * - * Accepts named exports only: `export const schema = ...` and `export const handler = ...` + * Accepts named exports only: `schema`, optional MCP-specific `mcpSchema`, and `handler`. * * @param moduleId - Extensionless module path (e.g., 'mcp/tools/simulator/build_sim') * @returns Imported tool module with schema and handler @@ -50,6 +51,7 @@ export async function importToolModule(moduleId: string): Promise, ctx?: ToolHandlerContext, diff --git a/src/mcp/tools/device/build_run_device.ts b/src/mcp/tools/device/build_run_device.ts index f59294626..ccddf09bf 100644 --- a/src/mcp/tools/device/build_run_device.ts +++ b/src/mcp/tools/device/build_run_device.ts @@ -36,6 +36,10 @@ import { } from '../../../utils/xcodebuild-domain-results.ts'; import { resolveEffectiveDerivedDataPath } from '../../../utils/derived-data-path.ts'; import { createBuildInvocationFragment } from '../../../utils/xcodebuild-pipeline.ts'; +import { + createEnvironmentVariableInputSchema, + normalizeEnvironmentVariableArgument, +} from '../../../utils/environment-variable-input.ts'; function createBuildRunDeviceRequest(params: BuildRunDeviceParams): BuildInvocationRequest { return { @@ -78,6 +82,12 @@ const buildRunDeviceSchema = z.preprocess( withProjectOrWorkspace(baseSchemaObject), ); +const mcpFullSchemaObject = baseSchemaObject.extend({ + env: createEnvironmentVariableInputSchema( + 'Environment variables to pass to the launched app as key-value entries', + ), +}); + export type BuildRunDeviceParams = z.infer; type BuildRunDeviceResult = BuildRunResultDomainResult; @@ -300,6 +310,16 @@ const publicSchemaObject = baseSchemaObject.omit({ preferXcodebuild: true, } as const); +const mcpPublicSchemaObject = mcpFullSchemaObject.omit({ + projectPath: true, + workspacePath: true, + scheme: true, + deviceId: true, + configuration: true, + derivedDataPath: true, + preferXcodebuild: true, +} as const); + export async function build_run_deviceLogic( params: BuildRunDeviceParams, executor: CommandExecutor, @@ -335,6 +355,11 @@ export const schema = getSessionAwareToolSchemaShape({ legacy: baseSchemaObject, }); +export const mcpSchema = getSessionAwareToolSchemaShape({ + sessionAware: mcpPublicSchemaObject, + legacy: mcpFullSchemaObject, +}); + export const handler = createSessionAwareTool({ internalSchema: toInternalSchema(buildRunDeviceSchema), logicFunction: (params, executor) => @@ -345,4 +370,5 @@ export const handler = createSessionAwareTool({ { oneOf: ['projectPath', 'workspacePath'], message: 'Provide a project or workspace' }, ], exclusivePairs: [['projectPath', 'workspacePath']], + normalizeExplicitArgs: (args) => normalizeEnvironmentVariableArgument(args, 'env'), }); diff --git a/src/mcp/tools/device/launch_app_device.ts b/src/mcp/tools/device/launch_app_device.ts index 72c18b224..c2a12b006 100644 --- a/src/mcp/tools/device/launch_app_device.ts +++ b/src/mcp/tools/device/launch_app_device.ts @@ -27,6 +27,10 @@ import { buildLaunchSuccess, setLaunchResultStructuredOutput, } from '../../../utils/app-lifecycle-results.ts'; +import { + createEnvironmentVariableInputSchema, + normalizeEnvironmentVariableArgument, +} from '../../../utils/environment-variable-input.ts'; const launchAppDeviceSchema = z.object({ deviceId: z.string().describe('UDID of the device (obtained from list_devices)'), @@ -41,11 +45,22 @@ const launchAppDeviceSchema = z.object({ .describe('Environment variables to pass to the launched app (as key-value dictionary)'), }); +const mcpFullSchemaObject = launchAppDeviceSchema.extend({ + env: createEnvironmentVariableInputSchema( + 'Environment variables to pass to the launched app as key-value entries', + ), +}); + const publicSchemaObject = launchAppDeviceSchema.omit({ deviceId: true, bundleId: true, } as const); +const mcpPublicSchemaObject = mcpFullSchemaObject.omit({ + deviceId: true, + bundleId: true, +} as const); + type LaunchAppDeviceParams = z.infer; type LaunchAppDeviceResult = LaunchResultDomainResult; @@ -118,10 +133,16 @@ export const schema = getSessionAwareToolSchemaShape({ legacy: launchAppDeviceSchema, }); +export const mcpSchema = getSessionAwareToolSchemaShape({ + sessionAware: mcpPublicSchemaObject, + legacy: mcpFullSchemaObject, +}); + export const handler = createSessionAwareTool({ internalSchema: toInternalSchema(launchAppDeviceSchema), logicFunction: (params, executor) => launch_app_deviceLogic(params, executor, getDefaultFileSystemExecutor()), getExecutor: getDefaultCommandExecutor, requirements: [{ allOf: ['deviceId', 'bundleId'], message: 'Provide deviceId and bundleId' }], + normalizeExplicitArgs: (args) => normalizeEnvironmentVariableArgument(args, 'env'), }); diff --git a/src/mcp/tools/device/test_device.ts b/src/mcp/tools/device/test_device.ts index eb948ea55..11ee2ba5b 100644 --- a/src/mcp/tools/device/test_device.ts +++ b/src/mcp/tools/device/test_device.ts @@ -37,6 +37,10 @@ import type { BuildInvocationRequest } from '../../../types/domain-fragments.ts' import { resolveEffectiveDerivedDataPath } from '../../../utils/derived-data-path.ts'; import { createBuildInvocationFragment } from '../../../utils/xcodebuild-pipeline.ts'; import { displayPath } from '../../../utils/build-preflight.ts'; +import { + normalizeEnvironmentVariableArgument, + testRunnerEnvironmentSchema, +} from '../../../utils/environment-variable-input.ts'; const baseSchemaObject = z.object({ projectPath: z.string().optional().describe('Path to the .xcodeproj file'), @@ -73,6 +77,10 @@ const testDeviceSchema = z.preprocess( withProjectWorkspaceOrTestArtifact(baseSchemaObject), ); +const mcpFullSchemaObject = baseSchemaObject.extend({ + testRunnerEnv: testRunnerEnvironmentSchema, +}); + export type TestDeviceParams = z.infer; type TestDeviceResult = TestResultDomainResult; @@ -86,6 +94,16 @@ const publicSchemaObject = baseSchemaObject.omit({ preferXcodebuild: true, } as const); +const mcpPublicSchemaObject = mcpFullSchemaObject.omit({ + projectPath: true, + workspacePath: true, + scheme: true, + deviceId: true, + configuration: true, + derivedDataPath: true, + preferXcodebuild: true, +} as const); + interface PreparedTestDeviceExecution { configuration?: string; platform: XcodePlatform; @@ -192,6 +210,11 @@ export const schema = getSessionAwareToolSchemaShape({ legacy: baseSchemaObject, }); +export const mcpSchema = getSessionAwareToolSchemaShape({ + sessionAware: mcpPublicSchemaObject, + legacy: mcpFullSchemaObject, +}); + export const handler = createSessionAwareTool({ internalSchema: toInternalSchema(testDeviceSchema), logicFunction: (params, executor) => @@ -199,4 +222,5 @@ export const handler = createSessionAwareTool({ getExecutor: getDefaultCommandExecutor, requirements: [{ allOf: ['deviceId'], message: 'Provide deviceId' }], exclusivePairs: [...TEST_SOURCE_EXCLUSIVE_GROUPS, ['projectPath', 'workspacePath']], + normalizeExplicitArgs: (args) => normalizeEnvironmentVariableArgument(args, 'testRunnerEnv'), }); diff --git a/src/mcp/tools/macos/test_macos.ts b/src/mcp/tools/macos/test_macos.ts index 94e6448de..31c0107df 100644 --- a/src/mcp/tools/macos/test_macos.ts +++ b/src/mcp/tools/macos/test_macos.ts @@ -36,6 +36,10 @@ import type { BuildInvocationRequest } from '../../../types/domain-fragments.ts' import { resolveEffectiveDerivedDataPath } from '../../../utils/derived-data-path.ts'; import { createBuildInvocationFragment } from '../../../utils/xcodebuild-pipeline.ts'; import { displayPath } from '../../../utils/build-preflight.ts'; +import { + normalizeEnvironmentVariableArgument, + testRunnerEnvironmentSchema, +} from '../../../utils/environment-variable-input.ts'; const baseSchemaObject = z.object({ projectPath: z.string().optional().describe('Path to the .xcodeproj file'), @@ -65,6 +69,10 @@ const baseSchemaObject = z.object({ .describe('Show detailed test progress output (MCP defaults to true, CLI defaults to false)'), }); +const mcpFullSchemaObject = baseSchemaObject.extend({ + testRunnerEnv: testRunnerEnvironmentSchema, +}); + const publicSchemaObject = baseSchemaObject.omit({ projectPath: true, workspacePath: true, @@ -74,6 +82,15 @@ const publicSchemaObject = baseSchemaObject.omit({ preferXcodebuild: true, } as const); +const mcpPublicSchemaObject = mcpFullSchemaObject.omit({ + projectPath: true, + workspacePath: true, + scheme: true, + configuration: true, + derivedDataPath: true, + preferXcodebuild: true, +} as const); + const testMacosSchema = z.preprocess( nullifyEmptyStrings, withProjectWorkspaceOrTestArtifact(baseSchemaObject), @@ -181,10 +198,16 @@ export const schema = getSessionAwareToolSchemaShape({ legacy: baseSchemaObject, }); +export const mcpSchema = getSessionAwareToolSchemaShape({ + sessionAware: mcpPublicSchemaObject, + legacy: mcpFullSchemaObject, +}); + export const handler = createSessionAwareTool({ internalSchema: toInternalSchema(testMacosSchema), logicFunction: (params, executor) => testMacosLogic(params, executor, getDefaultFileSystemExecutor()), getExecutor: getDefaultCommandExecutor, exclusivePairs: [...TEST_SOURCE_EXCLUSIVE_GROUPS, ['projectPath', 'workspacePath']], + normalizeExplicitArgs: (args) => normalizeEnvironmentVariableArgument(args, 'testRunnerEnv'), }); diff --git a/src/mcp/tools/session-management/session_set_defaults.ts b/src/mcp/tools/session-management/session_set_defaults.ts index eb8f3ef8c..6b11b3a95 100644 --- a/src/mcp/tools/session-management/session_set_defaults.ts +++ b/src/mcp/tools/session-management/session_set_defaults.ts @@ -21,6 +21,10 @@ import type { CommandExecutor } from '../../../utils/execution/index.ts'; import { getDefaultCommandExecutor } from '../../../utils/execution/index.ts'; import { formatProfileLabel } from './session-format-helpers.ts'; import { toErrorMessage } from '../../../utils/errors.ts'; +import { + createEnvironmentVariableInputSchema, + normalizeEnvironmentVariableArgument, +} from '../../../utils/environment-variable-input.ts'; const schemaObj = sessionDefaultsSchema.extend({ profile: z @@ -39,8 +43,23 @@ const schemaObj = sessionDefaultsSchema.extend({ .describe('Persist provided defaults to .xcodebuildmcp/config.yaml'), }); +const mcpSchemaObj = schemaObj.extend({ + env: createEnvironmentVariableInputSchema( + 'Default environment variables to pass to launched apps as key-value entries', + ), +}); + type Params = z.input; +const internalSchema: z.ZodType = z.preprocess((input) => { + if (typeof input !== 'object' || input === null || Array.isArray(input)) { + return input; + } + + const args = input as Record; + return normalizeEnvironmentVariableArgument(args, 'env'); +}, schemaObj); + type SessionSetDefaultsContext = { executor: CommandExecutor; }; @@ -242,7 +261,8 @@ export async function sessionSetDefaultsLogic( } export const schema = schemaObj.shape; +export const mcpSchema = mcpSchemaObj.shape; -export const handler = createTypedToolWithContext(schemaObj, sessionSetDefaultsLogic, () => ({ +export const handler = createTypedToolWithContext(internalSchema, sessionSetDefaultsLogic, () => ({ executor: getDefaultCommandExecutor(), })); diff --git a/src/mcp/tools/simulator/launch_app_sim.ts b/src/mcp/tools/simulator/launch_app_sim.ts index 3fadc38b7..b133851bb 100644 --- a/src/mcp/tools/simulator/launch_app_sim.ts +++ b/src/mcp/tools/simulator/launch_app_sim.ts @@ -22,6 +22,10 @@ import { setLaunchResultStructuredOutput, type LaunchResultArtifacts, } from '../../../utils/app-lifecycle-results.ts'; +import { + createEnvironmentVariableInputSchema, + normalizeEnvironmentVariableArgument, +} from '../../../utils/environment-variable-input.ts'; const baseSchemaObject = z.object({ simulatorId: z @@ -57,6 +61,12 @@ const internalSchemaObject = z.object({ env: z.record(z.string(), z.string()).optional(), }); +const mcpFullSchemaObject = baseSchemaObject.extend({ + env: createEnvironmentVariableInputSchema( + 'Environment variables to pass to the launched app as key-value entries (SIMCTL_CHILD_ prefix added automatically)', + ), +}); + export type LaunchAppSimParams = z.infer; type ResolvedLaunchAppSimParams = LaunchAppSimParams & { simulatorId: string }; type LaunchAppSimResult = LaunchResultDomainResult; @@ -183,11 +193,24 @@ const publicSchemaObject = z.strictObject( } as const).shape, ); +const mcpPublicSchemaObject = z.strictObject( + mcpFullSchemaObject.omit({ + simulatorId: true, + simulatorName: true, + bundleId: true, + } as const).shape, +); + export const schema = getSessionAwareToolSchemaShape({ sessionAware: publicSchemaObject, legacy: baseSchemaObject, }); +export const mcpSchema = getSessionAwareToolSchemaShape({ + sessionAware: mcpPublicSchemaObject, + legacy: mcpFullSchemaObject, +}); + export const handler = createSessionAwareTool({ internalSchema: toInternalSchema(internalSchemaObject), logicFunction: launch_app_simLogic, @@ -197,4 +220,5 @@ export const handler = createSessionAwareTool({ { allOf: ['bundleId'], message: 'bundleId is required' }, ], exclusivePairs: [['simulatorId', 'simulatorName']], + normalizeExplicitArgs: (args) => normalizeEnvironmentVariableArgument(args, 'env'), }); diff --git a/src/mcp/tools/simulator/test_sim.ts b/src/mcp/tools/simulator/test_sim.ts index 3c7886b23..b2fa4486b 100644 --- a/src/mcp/tools/simulator/test_sim.ts +++ b/src/mcp/tools/simulator/test_sim.ts @@ -41,6 +41,10 @@ import type { BuildInvocationRequest } from '../../../types/domain-fragments.ts' import { resolveEffectiveDerivedDataPath } from '../../../utils/derived-data-path.ts'; import { createBuildInvocationFragment } from '../../../utils/xcodebuild-pipeline.ts'; import { displayPath } from '../../../utils/build-preflight.ts'; +import { + normalizeEnvironmentVariableArgument, + testRunnerEnvironmentSchema, +} from '../../../utils/environment-variable-input.ts'; const baseSchemaObject = z.object({ projectPath: z @@ -97,6 +101,10 @@ const testSimulatorSchema = z.preprocess( withSimulatorIdOrName(withProjectWorkspaceOrTestArtifact(baseSchemaObject)), ); +const mcpFullSchemaObject = baseSchemaObject.extend({ + testRunnerEnv: testRunnerEnvironmentSchema, +}); + type TestSimulatorParams = z.infer; type TestSimulatorResult = TestResultDomainResult; @@ -298,11 +306,28 @@ const publicSchemaObject = baseSchemaObject.omit({ preferXcodebuild: true, } as const); +const mcpPublicSchemaObject = mcpFullSchemaObject.omit({ + projectPath: true, + workspacePath: true, + scheme: true, + simulatorId: true, + simulatorName: true, + configuration: true, + useLatestOS: true, + derivedDataPath: true, + preferXcodebuild: true, +} as const); + export const schema = getSessionAwareToolSchemaShape({ sessionAware: publicSchemaObject, legacy: baseSchemaObject, }); +export const mcpSchema = getSessionAwareToolSchemaShape({ + sessionAware: mcpPublicSchemaObject, + legacy: mcpFullSchemaObject, +}); + export const handler = createSessionAwareTool({ internalSchema: toInternalSchema(testSimulatorSchema), logicFunction: (params, executor) => @@ -316,4 +341,5 @@ export const handler = createSessionAwareTool({ ['projectPath', 'workspacePath'], ['simulatorId', 'simulatorName'], ], + normalizeExplicitArgs: (args) => normalizeEnvironmentVariableArgument(args, 'testRunnerEnv'), }); diff --git a/src/mcp/tools/xcode-ide/__tests__/bridge_tools.test.ts b/src/mcp/tools/xcode-ide/__tests__/bridge_tools.test.ts index 666978428..a06ecb9dd 100644 --- a/src/mcp/tools/xcode-ide/__tests__/bridge_tools.test.ts +++ b/src/mcp/tools/xcode-ide/__tests__/bridge_tools.test.ts @@ -179,7 +179,7 @@ describe('xcode-ide bridge tools (standalone fallback)', () => { it('call handler forwards remote tool calls and writes a raw response artifact', async () => { const result = await callHandler(ideCallToolHandler, { remoteTool: 'toolA', - arguments: { foo: 'bar' }, + arguments: '{"foo":"bar"}', }); const text = allText(result); const artifactDir = join( @@ -212,6 +212,27 @@ describe('xcode-ide bridge tools (standalone fallback)', () => { expect(clientMocks.disconnect).not.toHaveBeenCalled(); }); + it('call handler preserves already-decoded CLI arguments', async () => { + const result = await callHandler(ideCallToolHandler, { + remoteTool: 'toolA', + arguments: { foo: 'bar' }, + }); + + expect(result.isError).toBeFalsy(); + expect(clientMocks.callTool).toHaveBeenCalledWith('toolA', { foo: 'bar' }, {}); + }); + + it('reports invalid MCP JSON at the arguments field', async () => { + const result = await callHandler(ideCallToolHandler, { + remoteTool: 'toolA', + arguments: 'not-json', + }); + + expect(result.isError).toBe(true); + expect(allText(result)).toContain('arguments: Invalid input'); + expect(allText(result)).not.toContain('arguments.arguments'); + }); + it('call handler hard-fails when the raw response artifact cannot be written', async () => { const blockingAppDir = join(tempAppDir, 'app-dir-file'); writeFileSync(blockingAppDir, 'not a directory'); @@ -224,7 +245,7 @@ describe('xcode-ide bridge tools (standalone fallback)', () => { const result = await callHandler(ideCallToolHandler, { remoteTool: 'toolA', - arguments: { foo: 'bar' }, + arguments: '{"foo":"bar"}', }); const text = allText(result); diff --git a/src/mcp/tools/xcode-ide/xcode_ide_call_tool.ts b/src/mcp/tools/xcode-ide/xcode_ide_call_tool.ts index 852ffc304..60c890f2f 100644 --- a/src/mcp/tools/xcode-ide/xcode_ide_call_tool.ts +++ b/src/mcp/tools/xcode-ide/xcode_ide_call_tool.ts @@ -12,13 +12,8 @@ import { toBridgeCallResultDomainResult, } from './shared.ts'; -const schemaObject = z.object({ +const baseSchemaObject = z.object({ remoteTool: z.string().min(1).describe('Exact remote Xcode MCP tool name.'), - arguments: z - .record(z.string(), z.unknown()) - .optional() - .default({}) - .describe('Arguments payload to forward to the remote Xcode MCP tool.'), timeoutMs: z .number() .int() @@ -28,7 +23,55 @@ const schemaObject = z.object({ .describe('Optional timeout override in milliseconds for this single tool call.'), }); -type Params = z.infer; +const argumentsRecordSchema = z.record(z.string(), z.unknown()); + +const argumentsJsonSchema = z.string().transform((argumentsJson, ctx) => { + let parsedArguments: unknown; + try { + parsedArguments = JSON.parse(argumentsJson); + } catch { + ctx.addIssue({ + code: 'custom', + message: 'Must be valid JSON encoding an object.', + }); + return z.NEVER; + } + + if ( + typeof parsedArguments !== 'object' || + parsedArguments === null || + Array.isArray(parsedArguments) + ) { + ctx.addIssue({ + code: 'custom', + message: 'Must be a JSON object.', + }); + return z.NEVER; + } + + return parsedArguments as Record; +}); + +const schemaObject = baseSchemaObject.extend({ + arguments: argumentsRecordSchema + .optional() + .default({}) + .describe('Arguments for the remote Xcode MCP tool.'), +}); + +const mcpSchemaObject = baseSchemaObject.extend({ + arguments: z + .string() + .optional() + .default('{}') + .describe('JSON object string containing arguments for the remote Xcode MCP tool.'), +}); + +const internalSchema = baseSchemaObject.extend({ + arguments: z.union([argumentsRecordSchema, argumentsJsonSchema]).optional().default({}), +}); + +type Params = z.output; export function createXcodeIdeCallToolExecutor() { return createBridgeToolExecutor({ @@ -61,9 +104,10 @@ export async function xcodeIdeCallToolLogic(params: Params): Promise { } export const schema = schemaObject.shape; +export const mcpSchema = mcpSchemaObject.shape; export const handler = createTypedToolWithContext( - schemaObject, + internalSchema, (params: Params) => xcodeIdeCallToolLogic(params), () => undefined, ); diff --git a/src/runtime/tool-catalog.ts b/src/runtime/tool-catalog.ts index 3918fe7b4..b3cd1db06 100644 --- a/src/runtime/tool-catalog.ts +++ b/src/runtime/tool-catalog.ts @@ -173,7 +173,7 @@ export async function buildToolCatalogFromManifest(opts: { annotations: toolManifest.annotations, outputSchema: toolManifest.outputSchema, nextStepTemplates: toolManifest.nextSteps, - mcpSchema: toolModule.schema, + mcpSchema: toolModule.mcpSchema, cliSchema: toolModule.schema, stateful: toolManifest.routing?.stateful ?? false, handler: toolModule.handler as ToolDefinition['handler'], diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/batch.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/batch.json new file mode 100644 index 000000000..ab46f8c17 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/batch.json @@ -0,0 +1,492 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Batch UI Actions"}, + "description": "UI automation batch for multiple same-screen elementRef taps, especially visible settings switches that can be toggled without intermediate assertions. The input key is steps, never commands, and each step is an object such as {\"action\":\"tap\",\"elementRef\":\"e1\"}; do not pass raw command strings. Use refs from the latest snapshot_ui or wait_for_ui output, for example {\"steps\":[{\"action\":\"tap\",\"elementRef\":\"e1\"},{\"action\":\"tap\",\"elementRef\":\"e2\"}]}. Omit preDelay/postDelay for switch elementRefs; switches execute as touch down/up steps and reject delays.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "axCache": { + "enum": ["perBatch","perStep","none"], + "type": "string" + }, + "pollInterval": {"exclusiveMinimum":0,"type":"number"}, + "simulatorId": {"format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","type":"string"}, + "steps": { + "description": "Required array of step objects, for example [{\"action\":\"tap\",\"elementRef\":\"e1\"}]. Do not use commands or raw command strings.", + "items": { + "additionalProperties": false, + "properties": { + "action": {"const":"tap","type":"string"}, + "elementRef": {"description":"Runtime elementRef from the latest snapshot_ui or wait_for_ui output","minLength":1,"type":"string"}, + "postDelay": {"description":"Seconds after this step. Omit for switch elementRefs.","maximum":10,"minimum":0,"type":"number"}, + "preDelay": {"description":"Seconds before this step. Omit for switch elementRefs.","maximum":10,"minimum":0,"type":"number"} + }, + "required": ["action","elementRef"], + "type": "object" + }, + "maxItems": 100, + "minItems": 1, + "type": "array" + }, + "waitTimeout": {"minimum":0,"type":"number"} + }, + "required": ["simulatorId","steps"], + "type": "object" + }, + "name": "batch", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "compactRuntimeSnapshot": { + "additionalProperties": false, + "properties": { + "count": {"minimum":0,"type":"integer"}, + "evidence": { + "description": "Non-actionable semantic evidence rows in role|label|value|identifier format. These rows intentionally omit element refs.", + "items": {"type":"string"}, + "type": "array" + }, + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "scroll": { + "items": {"type":"string"}, + "type": "array" + }, + "seq": {"minimum":0,"type":"integer"}, + "targets": { + "items": {"type":"string"}, + "type": "array" + }, + "text": { + "items": {"type":"string"}, + "type": "array" + }, + "type": {"const":"runtime-snapshot"}, + "udid": {"type":"string"} + }, + "required": ["type","rs","screenHash","seq","count","targets","scroll","udid"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "direction": { + "enum": ["up","down","left","right"] + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "frame": { + "additionalProperties": false, + "properties": { + "height": {"type":"number"}, + "width": {"type":"number"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y","width","height"], + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "point": { + "additionalProperties": false, + "properties": { + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y"], + "type": "object" + }, + "recoverableUiError": { + "additionalProperties": false, + "properties": { + "candidates": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "code": { + "enum": ["SNAPSHOT_MISSING","SNAPSHOT_EXPIRED","SNAPSHOT_PARSE_FAILED","SNAPSHOT_CAPTURE_FAILED","ELEMENT_REF_NOT_FOUND","TARGET_NOT_FOUND","TARGET_AMBIGUOUS","TARGET_NOT_ACTIONABLE","WAIT_TIMEOUT","UI_STATE_CHANGED","ACTION_FAILED"] + }, + "elementRef": {"type":"string"}, + "message": {"type":"string"}, + "recoveryHint": {"type":"string"}, + "snapshotAgeMs": {"minimum":0,"type":"integer"}, + "timeoutMs": {"minimum":0,"type":"integer"} + }, + "required": ["code","message","recoveryHint"], + "type": "object" + }, + "runtimeActionName": { + "enum": ["tap","typeText","longPress","touch","swipeWithin"] + }, + "runtimeElement": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionName"}, + "type": "array" + }, + "frame": {"$ref":"#/$defs/frame"}, + "identifier": {"type":"string"}, + "label": {"type":"string"}, + "ref": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "role": {"$ref":"#/$defs/runtimeElementRole"}, + "state": {"$ref":"#/$defs/runtimeElementState"}, + "value": {"type":"string"} + }, + "required": ["ref","frame","actions"], + "type": "object" + }, + "runtimeElementRole": { + "enum": ["application","button","cell","image","keyboard-key","list","menu","other","scroll-view","slider","switch","tab","text","text-field","window"] + }, + "runtimeElementState": { + "additionalProperties": false, + "properties": { + "enabled": {"type":"boolean"}, + "focused": {"type":"boolean"}, + "selected": {"type":"boolean"}, + "visible": {"type":"boolean"} + }, + "type": "object" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.ui-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"}, + "withinElementRef": {"type":"string"} + }, + "required": ["type","withinElementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"} + }, + "required": ["type","from","to"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"swipe"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "elementRef": {"type":"string"}, + "from": {"$ref":"#/$defs/point"}, + "steps": {"minimum":1,"type":"integer"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"drag"} + }, + "required": ["type","elementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"touch"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "elementRef": {"type":"string"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "button": {"type":"string"}, + "type": {"const":"button"} + }, + "required": ["type","button"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "gesture": {"type":"string"}, + "type": {"const":"gesture"} + }, + "required": ["type","gesture"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCode": {"minimum":0,"type":"integer"}, + "type": {"const":"key-press"} + }, + "required": ["type","keyCode"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCodes": { + "items": {"minimum":0,"type":"integer"}, + "type": "array" + }, + "type": {"const":"key-sequence"} + }, + "required": ["type","keyCodes"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "stepCount": {"minimum":1,"type":"integer"}, + "type": {"const":"batch"} + }, + "required": ["type","stepCount"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "capture": {"$ref":"#/$defs/compactRuntimeSnapshot"}, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"}, + "uiError": {"$ref":"#/$defs/recoverableUiError"} + }, + "required": ["summary","action","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.ui-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/boot_sim.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/boot_sim.json new file mode 100644 index 000000000..1ce899027 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/boot_sim.json @@ -0,0 +1,252 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Boot Simulator"}, + "description": "Boot iOS simulator for manual/non-build flows. Not required before simulator build-and-run (build_run_sim).", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "simulatorId": {"description":"UUID of the simulator to use (obtained from list_sims). Provide EITHER this OR simulatorName, not both","type":"string"}, + "simulatorName": {"description":"Name of the simulator (e.g., 'iPhone 17'). Provide EITHER this OR simulatorId, not both","type":"string"} + }, + "type": "object" + }, + "name": "boot_sim", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.simulator-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "type": {"const":"boot"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"erase"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"open"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"reset-location"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "coordinates": { + "additionalProperties": false, + "properties": { + "latitude": {"maximum":90,"minimum":-90,"type":"number"}, + "longitude": {"maximum":180,"minimum":-180,"type":"number"} + }, + "required": ["latitude","longitude"], + "type": "object" + }, + "type": {"const":"set-location"} + }, + "required": ["type","coordinates"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "appearance": {"type":"string"}, + "type": {"const":"set-appearance"} + }, + "required": ["type","appearance"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "dataNetwork": {"type":"string"}, + "type": {"const":"statusbar"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-software-keyboard"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-connect-hardware-keyboard"} + }, + "required": ["type"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","action"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.simulator-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/build_device.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/build_device.json new file mode 100644 index 000000000..b6cb84198 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/build_device.json @@ -0,0 +1,236 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Build Device"}, + "description": "Build for device.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "buildForTesting": {"description":"Build reusable test products without running tests (default: false)","type":"boolean"}, + "configuration": {"description":"Build configuration (Debug, Release)","type":"string"}, + "derivedDataPath": {"type":"string"}, + "deviceId": {"description":"UDID of the destination device","type":"string"}, + "extraArgs": { + "items": {"type":"string"}, + "type": "array" + }, + "platform": { + "description": "Device platform: iOS, watchOS, tvOS, or visionOS. Defaults to iOS.", + "enum": ["iOS","watchOS","tvOS","visionOS"], + "type": "string" + }, + "preferXcodebuild": {"type":"boolean"}, + "projectPath": {"description":"Path to the .xcodeproj file","type":"string"}, + "scheme": {"description":"The scheme to build","type":"string"}, + "testProductsPath": {"description":"Output path for the .xctestproducts bundle when buildForTesting is true","type":"string"}, + "workspacePath": {"description":"Path to the .xcworkspace file","type":"string"} + }, + "required": ["scheme"], + "type": "object" + }, + "name": "build_device", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "buildInvocationRequest": { + "additionalProperties": false, + "properties": { + "arch": {"type":"string"}, + "buildForTesting": {"type":"boolean"}, + "configuration": {"type":"string"}, + "derivedDataPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "executableName": {"type":"string"}, + "onlyTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulatorId": {"type":"string"}, + "simulatorName": {"type":"string"}, + "skipTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + }, + "targetName": {"type":"string"}, + "testProductsPath": {"type":"string"}, + "workspacePath": {"type":"string"}, + "xctestrunPath": {"type":"string"} + }, + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.build-result/3.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "anyOf": [ + { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appPath": {"type":"string"}, + "buildLogPath": {"type":"string"}, + "bundleId": {"type":"string"}, + "configuration": {"type":"string"}, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "scheme": {"type":"string"}, + "testProductsPath": {"type":"string"}, + "workspacePath": {"type":"string"}, + "xctestrunPaths": { + "items": {"type":"string"}, + "type": "array" + } + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "request": {"$ref":"#/$defs/buildInvocationRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + {"type":"null"} + ] + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.build-result"}, + "schemaVersion": {"const":"3"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/build_macos.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/build_macos.json new file mode 100644 index 000000000..73b444583 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/build_macos.json @@ -0,0 +1,235 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Build macOS"}, + "description": "Build macOS app.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "arch": { + "description": "Architecture to build for (arm64 or x86_64). For macOS only.", + "enum": ["arm64","x86_64"], + "type": "string" + }, + "buildForTesting": {"description":"Build reusable test products without running tests (default: false)","type":"boolean"}, + "configuration": {"description":"Build configuration (Debug, Release, etc.)","type":"string"}, + "derivedDataPath": {"type":"string"}, + "extraArgs": { + "items": {"type":"string"}, + "type": "array" + }, + "preferXcodebuild": {"type":"boolean"}, + "projectPath": {"description":"Path to the .xcodeproj file","type":"string"}, + "scheme": {"description":"The scheme to use","type":"string"}, + "testProductsPath": {"description":"Output path for the .xctestproducts bundle when buildForTesting is true","type":"string"}, + "workspacePath": {"description":"Path to the .xcworkspace file","type":"string"} + }, + "required": ["scheme"], + "type": "object" + }, + "name": "build_macos", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "buildInvocationRequest": { + "additionalProperties": false, + "properties": { + "arch": {"type":"string"}, + "buildForTesting": {"type":"boolean"}, + "configuration": {"type":"string"}, + "derivedDataPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "executableName": {"type":"string"}, + "onlyTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulatorId": {"type":"string"}, + "simulatorName": {"type":"string"}, + "skipTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + }, + "targetName": {"type":"string"}, + "testProductsPath": {"type":"string"}, + "workspacePath": {"type":"string"}, + "xctestrunPath": {"type":"string"} + }, + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.build-result/3.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "anyOf": [ + { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appPath": {"type":"string"}, + "buildLogPath": {"type":"string"}, + "bundleId": {"type":"string"}, + "configuration": {"type":"string"}, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "scheme": {"type":"string"}, + "testProductsPath": {"type":"string"}, + "workspacePath": {"type":"string"}, + "xctestrunPaths": { + "items": {"type":"string"}, + "type": "array" + } + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "request": {"$ref":"#/$defs/buildInvocationRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + {"type":"null"} + ] + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.build-result"}, + "schemaVersion": {"const":"3"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/build_run_device.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/build_run_device.json new file mode 100644 index 000000000..2938049ed --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/build_run_device.json @@ -0,0 +1,257 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Build Run Device"}, + "description": "Build, install, and launch on physical device. Preferred single-step run tool when defaults are set.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "configuration": {"description":"Build configuration (Debug, Release, etc.)","type":"string"}, + "derivedDataPath": {"type":"string"}, + "deviceId": {"description":"UDID of the device (obtained from list_devices)","type":"string"}, + "env": { + "description": "Environment variables to pass to the launched app as key-value entries", + "items": { + "additionalProperties": false, + "properties": { + "key": {"minLength":1,"type":"string"}, + "value": {"type":"string"} + }, + "required": ["key","value"], + "type": "object" + }, + "type": "array" + }, + "extraArgs": { + "description": "Additional xcodebuild/build-settings arguments (not app launch arguments)", + "items": {"type":"string"}, + "type": "array" + }, + "launchArgs": { + "description": "Arguments passed to the launched app process on physical device runtime", + "items": {"type":"string"}, + "type": "array" + }, + "platform": { + "description": "Device platform: iOS, watchOS, tvOS, or visionOS. Defaults to iOS.", + "enum": ["iOS","watchOS","tvOS","visionOS"], + "type": "string" + }, + "preferXcodebuild": {"type":"boolean"}, + "projectPath": {"description":"Path to the .xcodeproj file","type":"string"}, + "scheme": {"description":"The scheme to build and run","type":"string"}, + "workspacePath": {"description":"Path to the .xcworkspace file","type":"string"} + }, + "required": ["scheme","deviceId"], + "type": "object" + }, + "name": "build_run_device", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "buildInvocationRequest": { + "additionalProperties": false, + "properties": { + "arch": {"type":"string"}, + "configuration": {"type":"string"}, + "derivedDataPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "executableName": {"type":"string"}, + "onlyTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulatorId": {"type":"string"}, + "simulatorName": {"type":"string"}, + "skipTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + }, + "targetName": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.build-run-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appPath": {"type":"string"}, + "buildLogPath": {"type":"string"}, + "bundleId": {"type":"string"}, + "deviceId": {"type":"string"}, + "executablePath": {"type":"string"}, + "osLogPath": {"type":"string"}, + "packagePath": {"type":"string"}, + "processId": {"minimum":1,"type":"integer"}, + "runtimeLogPath": {"type":"string"}, + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "output": { + "additionalProperties": false, + "properties": { + "stderr": { + "items": {"type":"string"}, + "type": "array" + }, + "stdout": { + "items": {"type":"string"}, + "type": "array" + } + }, + "required": ["stdout","stderr"], + "type": "object" + }, + "request": {"$ref":"#/$defs/buildInvocationRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.build-run-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/build_run_macos.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/build_run_macos.json new file mode 100644 index 000000000..a2f9fc2fe --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/build_run_macos.json @@ -0,0 +1,243 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Build Run macOS"}, + "description": "Build and run macOS app.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "arch": { + "description": "Architecture to build for (arm64 or x86_64). For macOS only.", + "enum": ["arm64","x86_64"], + "type": "string" + }, + "configuration": {"description":"Build configuration (Debug, Release, etc.)","type":"string"}, + "derivedDataPath": {"type":"string"}, + "extraArgs": { + "description": "Additional xcodebuild/build-settings arguments (not app launch arguments)", + "items": {"type":"string"}, + "type": "array" + }, + "launchArgs": { + "description": "Arguments passed to the launched app process on macOS runtime", + "items": {"type":"string"}, + "type": "array" + }, + "preferXcodebuild": {"type":"boolean"}, + "projectPath": {"description":"Path to the .xcodeproj file","type":"string"}, + "scheme": {"description":"The scheme to use","type":"string"}, + "workspacePath": {"description":"Path to the .xcworkspace file","type":"string"} + }, + "required": ["scheme"], + "type": "object" + }, + "name": "build_run_macos", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "buildInvocationRequest": { + "additionalProperties": false, + "properties": { + "arch": {"type":"string"}, + "configuration": {"type":"string"}, + "derivedDataPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "executableName": {"type":"string"}, + "onlyTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulatorId": {"type":"string"}, + "simulatorName": {"type":"string"}, + "skipTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + }, + "targetName": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.build-run-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appPath": {"type":"string"}, + "buildLogPath": {"type":"string"}, + "bundleId": {"type":"string"}, + "deviceId": {"type":"string"}, + "executablePath": {"type":"string"}, + "osLogPath": {"type":"string"}, + "packagePath": {"type":"string"}, + "processId": {"minimum":1,"type":"integer"}, + "runtimeLogPath": {"type":"string"}, + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "output": { + "additionalProperties": false, + "properties": { + "stderr": { + "items": {"type":"string"}, + "type": "array" + }, + "stdout": { + "items": {"type":"string"}, + "type": "array" + } + }, + "required": ["stdout","stderr"], + "type": "object" + }, + "request": {"$ref":"#/$defs/buildInvocationRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.build-run-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/build_run_sim.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/build_run_sim.json new file mode 100644 index 000000000..5d5b260d9 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/build_run_sim.json @@ -0,0 +1,241 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Build Run Simulator"}, + "description": "Build, install, and launch on iOS Simulator, booting it when needed. Runtime logs are captured automatically and the log file path is included in the response. Preferred single-step run tool when defaults are set.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "configuration": {"description":"Build configuration (Debug, Release, etc.)","type":"string"}, + "derivedDataPath": {"type":"string"}, + "extraArgs": { + "description": "Additional xcodebuild/build-settings arguments (not app launch arguments)", + "items": {"type":"string"}, + "type": "array" + }, + "launchArgs": { + "description": "Arguments passed to the launched app process on simulator runtime", + "items": {"type":"string"}, + "type": "array" + }, + "preferXcodebuild": {"type":"boolean"}, + "projectPath": {"description":"Path to .xcodeproj file. Provide EITHER this OR workspacePath, not both","type":"string"}, + "scheme": {"description":"The scheme to use (Required)","type":"string"}, + "simulatorId": {"description":"UUID of the simulator (from list_sims). Provide EITHER this OR simulatorName, not both","type":"string"}, + "simulatorName": {"description":"Name of the simulator (e.g., 'iPhone 17'). Provide EITHER this OR simulatorId, not both","type":"string"}, + "useLatestOS": {"description":"Whether to use the latest OS version for the named simulator","type":"boolean"}, + "workspacePath": {"description":"Path to .xcworkspace file. Provide EITHER this OR projectPath, not both","type":"string"} + }, + "required": ["scheme"], + "type": "object" + }, + "name": "build_run_sim", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "buildInvocationRequest": { + "additionalProperties": false, + "properties": { + "arch": {"type":"string"}, + "configuration": {"type":"string"}, + "derivedDataPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "executableName": {"type":"string"}, + "onlyTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulatorId": {"type":"string"}, + "simulatorName": {"type":"string"}, + "skipTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + }, + "targetName": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.build-run-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appPath": {"type":"string"}, + "buildLogPath": {"type":"string"}, + "bundleId": {"type":"string"}, + "deviceId": {"type":"string"}, + "executablePath": {"type":"string"}, + "osLogPath": {"type":"string"}, + "packagePath": {"type":"string"}, + "processId": {"minimum":1,"type":"integer"}, + "runtimeLogPath": {"type":"string"}, + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "output": { + "additionalProperties": false, + "properties": { + "stderr": { + "items": {"type":"string"}, + "type": "array" + }, + "stdout": { + "items": {"type":"string"}, + "type": "array" + } + }, + "required": ["stdout","stderr"], + "type": "object" + }, + "request": {"$ref":"#/$defs/buildInvocationRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.build-run-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/build_sim.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/build_sim.json new file mode 100644 index 000000000..08765c5ce --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/build_sim.json @@ -0,0 +1,233 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Build Simulator"}, + "description": "Build for iOS sim (compile-only, no launch).", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "buildForTesting": {"description":"Build reusable test products without running tests (default: false)","type":"boolean"}, + "configuration": {"description":"Build configuration (Debug, Release, etc.)","type":"string"}, + "derivedDataPath": {"type":"string"}, + "extraArgs": { + "items": {"type":"string"}, + "type": "array" + }, + "preferXcodebuild": {"type":"boolean"}, + "projectPath": {"description":"Path to .xcodeproj file. Provide EITHER this OR workspacePath, not both","type":"string"}, + "scheme": {"description":"The scheme to use (Required)","type":"string"}, + "simulatorId": {"description":"UUID of the simulator (from list_sims). Provide EITHER this OR simulatorName, not both","type":"string"}, + "simulatorName": {"description":"Name of the simulator (e.g., 'iPhone 17'). Provide EITHER this OR simulatorId, not both","type":"string"}, + "testProductsPath": {"description":"Output path for the .xctestproducts bundle when buildForTesting is true","type":"string"}, + "useLatestOS": {"description":"Whether to use the latest OS version for the named simulator","type":"boolean"}, + "workspacePath": {"description":"Path to .xcworkspace file. Provide EITHER this OR projectPath, not both","type":"string"} + }, + "required": ["scheme"], + "type": "object" + }, + "name": "build_sim", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "buildInvocationRequest": { + "additionalProperties": false, + "properties": { + "arch": {"type":"string"}, + "buildForTesting": {"type":"boolean"}, + "configuration": {"type":"string"}, + "derivedDataPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "executableName": {"type":"string"}, + "onlyTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulatorId": {"type":"string"}, + "simulatorName": {"type":"string"}, + "skipTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + }, + "targetName": {"type":"string"}, + "testProductsPath": {"type":"string"}, + "workspacePath": {"type":"string"}, + "xctestrunPath": {"type":"string"} + }, + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.build-result/3.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "anyOf": [ + { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appPath": {"type":"string"}, + "buildLogPath": {"type":"string"}, + "bundleId": {"type":"string"}, + "configuration": {"type":"string"}, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "scheme": {"type":"string"}, + "testProductsPath": {"type":"string"}, + "workspacePath": {"type":"string"}, + "xctestrunPaths": { + "items": {"type":"string"}, + "type": "array" + } + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "request": {"$ref":"#/$defs/buildInvocationRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + {"type":"null"} + ] + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.build-result"}, + "schemaVersion": {"const":"3"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/button.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/button.json new file mode 100644 index 000000000..18708bc1c --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/button.json @@ -0,0 +1,475 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Hardware Button"}, + "description": "Press simulator hardware button.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "buttonType": { + "description": "apple-pay|home|lock|side-button|siri", + "enum": ["apple-pay","home","lock","side-button","siri"], + "type": "string" + }, + "duration": {"description":"seconds","maximum":10,"minimum":0,"type":"number"}, + "simulatorId": {"format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","type":"string"} + }, + "required": ["simulatorId","buttonType"], + "type": "object" + }, + "name": "button", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "compactRuntimeSnapshot": { + "additionalProperties": false, + "properties": { + "count": {"minimum":0,"type":"integer"}, + "evidence": { + "description": "Non-actionable semantic evidence rows in role|label|value|identifier format. These rows intentionally omit element refs.", + "items": {"type":"string"}, + "type": "array" + }, + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "scroll": { + "items": {"type":"string"}, + "type": "array" + }, + "seq": {"minimum":0,"type":"integer"}, + "targets": { + "items": {"type":"string"}, + "type": "array" + }, + "text": { + "items": {"type":"string"}, + "type": "array" + }, + "type": {"const":"runtime-snapshot"}, + "udid": {"type":"string"} + }, + "required": ["type","rs","screenHash","seq","count","targets","scroll","udid"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "direction": { + "enum": ["up","down","left","right"] + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "frame": { + "additionalProperties": false, + "properties": { + "height": {"type":"number"}, + "width": {"type":"number"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y","width","height"], + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "point": { + "additionalProperties": false, + "properties": { + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y"], + "type": "object" + }, + "recoverableUiError": { + "additionalProperties": false, + "properties": { + "candidates": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "code": { + "enum": ["SNAPSHOT_MISSING","SNAPSHOT_EXPIRED","SNAPSHOT_PARSE_FAILED","SNAPSHOT_CAPTURE_FAILED","ELEMENT_REF_NOT_FOUND","TARGET_NOT_FOUND","TARGET_AMBIGUOUS","TARGET_NOT_ACTIONABLE","WAIT_TIMEOUT","UI_STATE_CHANGED","ACTION_FAILED"] + }, + "elementRef": {"type":"string"}, + "message": {"type":"string"}, + "recoveryHint": {"type":"string"}, + "snapshotAgeMs": {"minimum":0,"type":"integer"}, + "timeoutMs": {"minimum":0,"type":"integer"} + }, + "required": ["code","message","recoveryHint"], + "type": "object" + }, + "runtimeActionName": { + "enum": ["tap","typeText","longPress","touch","swipeWithin"] + }, + "runtimeElement": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionName"}, + "type": "array" + }, + "frame": {"$ref":"#/$defs/frame"}, + "identifier": {"type":"string"}, + "label": {"type":"string"}, + "ref": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "role": {"$ref":"#/$defs/runtimeElementRole"}, + "state": {"$ref":"#/$defs/runtimeElementState"}, + "value": {"type":"string"} + }, + "required": ["ref","frame","actions"], + "type": "object" + }, + "runtimeElementRole": { + "enum": ["application","button","cell","image","keyboard-key","list","menu","other","scroll-view","slider","switch","tab","text","text-field","window"] + }, + "runtimeElementState": { + "additionalProperties": false, + "properties": { + "enabled": {"type":"boolean"}, + "focused": {"type":"boolean"}, + "selected": {"type":"boolean"}, + "visible": {"type":"boolean"} + }, + "type": "object" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.ui-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"}, + "withinElementRef": {"type":"string"} + }, + "required": ["type","withinElementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"} + }, + "required": ["type","from","to"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"swipe"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "elementRef": {"type":"string"}, + "from": {"$ref":"#/$defs/point"}, + "steps": {"minimum":1,"type":"integer"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"drag"} + }, + "required": ["type","elementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"touch"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "elementRef": {"type":"string"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "button": {"type":"string"}, + "type": {"const":"button"} + }, + "required": ["type","button"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "gesture": {"type":"string"}, + "type": {"const":"gesture"} + }, + "required": ["type","gesture"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCode": {"minimum":0,"type":"integer"}, + "type": {"const":"key-press"} + }, + "required": ["type","keyCode"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCodes": { + "items": {"minimum":0,"type":"integer"}, + "type": "array" + }, + "type": {"const":"key-sequence"} + }, + "required": ["type","keyCodes"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "stepCount": {"minimum":1,"type":"integer"}, + "type": {"const":"batch"} + }, + "required": ["type","stepCount"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "capture": {"$ref":"#/$defs/compactRuntimeSnapshot"}, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"}, + "uiError": {"$ref":"#/$defs/recoverableUiError"} + }, + "required": ["summary","action","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.ui-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/clean.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/clean.json new file mode 100644 index 000000000..7be4d7dba --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/clean.json @@ -0,0 +1,223 @@ +{ + "annotations": {"destructiveHint":true,"openWorldHint":false,"readOnlyHint":false,"title":"Clean"}, + "description": "Clean build products.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "configuration": {"description":"Optional: Build configuration to clean (Debug, Release, etc.)","type":"string"}, + "derivedDataPath": {"type":"string"}, + "extraArgs": { + "items": {"type":"string"}, + "type": "array" + }, + "platform": { + "enum": ["macOS","iOS","iOS Simulator","watchOS","watchOS Simulator","tvOS","tvOS Simulator","visionOS","visionOS Simulator"], + "type": "string" + }, + "preferXcodebuild": {"type":"boolean"}, + "projectPath": {"description":"Path to the .xcodeproj file","type":"string"}, + "scheme": {"description":"Optional: The scheme to clean","type":"string"}, + "workspacePath": {"description":"Path to the .xcworkspace file","type":"string"} + }, + "type": "object" + }, + "name": "clean", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "buildInvocationRequest": { + "additionalProperties": false, + "properties": { + "arch": {"type":"string"}, + "configuration": {"type":"string"}, + "derivedDataPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "executableName": {"type":"string"}, + "onlyTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulatorId": {"type":"string"}, + "simulatorName": {"type":"string"}, + "skipTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + }, + "targetName": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.build-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "anyOf": [ + { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appPath": {"type":"string"}, + "buildLogPath": {"type":"string"}, + "bundleId": {"type":"string"}, + "configuration": {"type":"string"}, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "scheme": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "request": {"$ref":"#/$defs/buildInvocationRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + {"type":"null"} + ] + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.build-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/debug_attach_sim.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/debug_attach_sim.json new file mode 100644 index 000000000..2cf16cd66 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/debug_attach_sim.json @@ -0,0 +1,177 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Debug Attach Sim"}, + "description": "Attach LLDB to sim app.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "bundleId": {"description":"Attach by bundle identifier. Provide bundleId without pid; waitFor may be used with this mode.","type":"string"}, + "continueOnAttach": {"default":true,"description":"default: true","type":"boolean"}, + "makeCurrent": {"default":true,"description":"Set debug session as current (default: true)","type":"boolean"}, + "pid": {"description":"Attach to an already-running process by PID. Provide pid without bundleId and without waitFor.","exclusiveMinimum":0,"maximum":9007199254740991,"type":"integer"}, + "simulatorId": {"description":"UUID of the simulator to use (obtained from list_sims). Provide EITHER this OR simulatorName, not both","type":"string"}, + "simulatorName": {"description":"Name of the simulator (e.g., 'iPhone 17'). Provide EITHER this OR simulatorId, not both","type":"string"}, + "waitFor": {"description":"Only valid when attaching by bundleId. For PID attach, omit waitFor or set it to false.","type":"boolean"} + }, + "type": "object" + }, + "name": "debug_attach_sim", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.debug-session-action/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "enum": ["attach","continue","detach"] + }, + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "processId": {"minimum":1,"type":"integer"}, + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "session": { + "additionalProperties": false, + "properties": { + "connectionState": { + "enum": ["attached","detached"] + }, + "debugSessionId": {"type":"string"}, + "executionState": { + "enum": ["paused","running"] + } + }, + "required": ["debugSessionId","connectionState"], + "type": "object" + } + }, + "required": ["action"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.debug-session-action"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/debug_breakpoint_add.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/debug_breakpoint_add.json new file mode 100644 index 000000000..7f1141650 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/debug_breakpoint_add.json @@ -0,0 +1,220 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Debug Breakpoint Add"}, + "description": "Add breakpoint.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "condition": {"description":"Expression for breakpoint condition","type":"string"}, + "debugSessionId": {"description":"default: current session","type":"string"}, + "file": {"type":"string"}, + "function": {"type":"string"}, + "line": {"exclusiveMinimum":0,"maximum":9007199254740991,"type":"integer"} + }, + "type": "object" + }, + "name": "debug_breakpoint_add", + "outputSchema": { + "$defs": { + "addFileLineBreakpoint": { + "additionalProperties": false, + "properties": { + "breakpointId": {"minimum":1,"type":"integer"}, + "file": {"type":"string"}, + "kind": {"const":"file-line"}, + "line": {"minimum":1,"type":"integer"} + }, + "required": ["kind","file","line"], + "type": "object" + }, + "addFunctionBreakpoint": { + "additionalProperties": false, + "properties": { + "breakpointId": {"minimum":1,"type":"integer"}, + "kind": {"const":"function"}, + "name": {"type":"string"} + }, + "required": ["kind","name"], + "type": "object" + }, + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "removeBreakpoint": { + "additionalProperties": false, + "properties": { + "breakpointId": {"minimum":1,"type":"integer"} + }, + "required": ["breakpointId"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.debug-breakpoint-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "allOf": [ + { + "if": { + "properties": { + "action": {"const":"add"} + }, + "required": ["action"] + }, + "then": { + "properties": { + "breakpoint": { + "oneOf": [ + {"$ref":"#/$defs/addFileLineBreakpoint"}, + {"$ref":"#/$defs/addFunctionBreakpoint"} + ] + } + } + } + }, + { + "if": { + "properties": { + "action": {"const":"remove"} + }, + "required": ["action"] + }, + "then": { + "properties": { + "breakpoint": {"$ref":"#/$defs/removeBreakpoint"} + } + } + } + ], + "properties": { + "action": { + "enum": ["add","remove"] + }, + "breakpoint": { + "oneOf": [ + {"$ref":"#/$defs/addFileLineBreakpoint"}, + {"$ref":"#/$defs/addFunctionBreakpoint"}, + {"$ref":"#/$defs/removeBreakpoint"} + ] + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"} + }, + "required": ["action","breakpoint"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.debug-breakpoint-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/debug_breakpoint_remove.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/debug_breakpoint_remove.json new file mode 100644 index 000000000..c5dfc6df0 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/debug_breakpoint_remove.json @@ -0,0 +1,218 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Debug Breakpoint Remove"}, + "description": "Remove breakpoint.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "breakpointId": {"exclusiveMinimum":0,"maximum":9007199254740991,"type":"integer"}, + "debugSessionId": {"description":"default: current session","type":"string"} + }, + "required": ["breakpointId"], + "type": "object" + }, + "name": "debug_breakpoint_remove", + "outputSchema": { + "$defs": { + "addFileLineBreakpoint": { + "additionalProperties": false, + "properties": { + "breakpointId": {"minimum":1,"type":"integer"}, + "file": {"type":"string"}, + "kind": {"const":"file-line"}, + "line": {"minimum":1,"type":"integer"} + }, + "required": ["kind","file","line"], + "type": "object" + }, + "addFunctionBreakpoint": { + "additionalProperties": false, + "properties": { + "breakpointId": {"minimum":1,"type":"integer"}, + "kind": {"const":"function"}, + "name": {"type":"string"} + }, + "required": ["kind","name"], + "type": "object" + }, + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "removeBreakpoint": { + "additionalProperties": false, + "properties": { + "breakpointId": {"minimum":1,"type":"integer"} + }, + "required": ["breakpointId"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.debug-breakpoint-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "allOf": [ + { + "if": { + "properties": { + "action": {"const":"add"} + }, + "required": ["action"] + }, + "then": { + "properties": { + "breakpoint": { + "oneOf": [ + {"$ref":"#/$defs/addFileLineBreakpoint"}, + {"$ref":"#/$defs/addFunctionBreakpoint"} + ] + } + } + } + }, + { + "if": { + "properties": { + "action": {"const":"remove"} + }, + "required": ["action"] + }, + "then": { + "properties": { + "breakpoint": {"$ref":"#/$defs/removeBreakpoint"} + } + } + } + ], + "properties": { + "action": { + "enum": ["add","remove"] + }, + "breakpoint": { + "oneOf": [ + {"$ref":"#/$defs/addFileLineBreakpoint"}, + {"$ref":"#/$defs/addFunctionBreakpoint"}, + {"$ref":"#/$defs/removeBreakpoint"} + ] + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"} + }, + "required": ["action","breakpoint"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.debug-breakpoint-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/debug_continue.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/debug_continue.json new file mode 100644 index 000000000..0e891f749 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/debug_continue.json @@ -0,0 +1,171 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Debug Continue"}, + "description": "Continue debug session.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "debugSessionId": {"description":"default: current session","type":"string"} + }, + "type": "object" + }, + "name": "debug_continue", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.debug-session-action/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "enum": ["attach","continue","detach"] + }, + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "processId": {"minimum":1,"type":"integer"}, + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "session": { + "additionalProperties": false, + "properties": { + "connectionState": { + "enum": ["attached","detached"] + }, + "debugSessionId": {"type":"string"}, + "executionState": { + "enum": ["paused","running"] + } + }, + "required": ["debugSessionId","connectionState"], + "type": "object" + } + }, + "required": ["action"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.debug-session-action"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/debug_detach.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/debug_detach.json new file mode 100644 index 000000000..d0755f380 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/debug_detach.json @@ -0,0 +1,171 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Debug Detach"}, + "description": "Detach debugger.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "debugSessionId": {"description":"default: current session","type":"string"} + }, + "type": "object" + }, + "name": "debug_detach", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.debug-session-action/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "enum": ["attach","continue","detach"] + }, + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "processId": {"minimum":1,"type":"integer"}, + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "session": { + "additionalProperties": false, + "properties": { + "connectionState": { + "enum": ["attached","detached"] + }, + "debugSessionId": {"type":"string"}, + "executionState": { + "enum": ["paused","running"] + } + }, + "required": ["debugSessionId","connectionState"], + "type": "object" + } + }, + "required": ["action"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.debug-session-action"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/debug_lldb_command.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/debug_lldb_command.json new file mode 100644 index 000000000..daae7d690 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/debug_lldb_command.json @@ -0,0 +1,152 @@ +{ + "annotations": {"destructiveHint":true,"openWorldHint":false,"readOnlyHint":false,"title":"Debug LLDB Command"}, + "description": "Run LLDB command.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "command": {"type":"string"}, + "debugSessionId": {"description":"default: current session","type":"string"}, + "timeoutMs": {"exclusiveMinimum":0,"maximum":9007199254740991,"type":"integer"} + }, + "required": ["command"], + "type": "object" + }, + "name": "debug_lldb_command", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.debug-command-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "command": {"type":"string"}, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "outputLines": { + "items": {"type":"string"}, + "type": "array" + } + }, + "required": ["command","outputLines"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.debug-command-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/debug_stack.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/debug_stack.json new file mode 100644 index 000000000..806dae5b3 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/debug_stack.json @@ -0,0 +1,184 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Debug Stack"}, + "description": "Get backtrace.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "debugSessionId": {"description":"default: current session","type":"string"}, + "maxFrames": {"exclusiveMinimum":0,"maximum":9007199254740991,"type":"integer"}, + "threadIndex": {"maximum":9007199254740991,"minimum":0,"type":"integer"} + }, + "type": "object" + }, + "name": "debug_stack", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.debug-stack-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "anyOf": [ + { + "additionalProperties": false, + "properties": { + "threads": { + "items": { + "additionalProperties": false, + "properties": { + "frames": { + "items": { + "additionalProperties": false, + "properties": { + "displayLocation": {"type":"string"}, + "index": {"minimum":0,"type":"integer"}, + "symbol": {"type":"string"} + }, + "required": ["index","symbol","displayLocation"], + "type": "object" + }, + "type": "array" + }, + "name": {"type":"string"}, + "threadId": {"minimum":1,"type":"integer"}, + "truncated": {"type":"boolean"} + }, + "required": ["threadId","name","truncated","frames"], + "type": "object" + }, + "type": "array" + } + }, + "required": ["threads"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"} + }, + "required": ["diagnostics"], + "type": "object" + }, + {"type":"null"} + ] + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.debug-stack-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/debug_variables.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/debug_variables.json new file mode 100644 index 000000000..1f3675346 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/debug_variables.json @@ -0,0 +1,208 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Debug Variables"}, + "description": "Get frame variables.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "debugSessionId": {"description":"default: current session","type":"string"}, + "frameIndex": {"maximum":9007199254740991,"minimum":0,"type":"integer"} + }, + "type": "object" + }, + "name": "debug_variables", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.debug-variables-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "anyOf": [ + { + "additionalProperties": false, + "properties": { + "scopes": { + "additionalProperties": false, + "properties": { + "globals": { + "additionalProperties": false, + "properties": { + "variables": { + "items": {"additionalProperties":true,"type":"object"}, + "type": "array" + } + }, + "required": ["variables"], + "type": "object" + }, + "locals": { + "additionalProperties": false, + "properties": { + "variables": { + "items": {"additionalProperties":true,"type":"object"}, + "type": "array" + } + }, + "required": ["variables"], + "type": "object" + }, + "registers": { + "additionalProperties": false, + "properties": { + "groups": { + "items": { + "additionalProperties": false, + "properties": { + "name": {"type":"string"}, + "variables": { + "items": {"additionalProperties":true,"type":"object"}, + "type": "array" + } + }, + "required": ["name","variables"], + "type": "object" + }, + "type": "array" + } + }, + "required": ["groups"], + "type": "object" + } + }, + "required": ["locals","globals","registers"], + "type": "object" + } + }, + "required": ["scopes"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"} + }, + "required": ["diagnostics"], + "type": "object" + }, + {"type":"null"} + ] + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.debug-variables-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/discover_projs.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/discover_projs.json new file mode 100644 index 000000000..101b6707b --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/discover_projs.json @@ -0,0 +1,185 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Discover Projects"}, + "description": "Scans a directory (defaults to workspace root) to find Xcode project (.xcodeproj) and workspace (.xcworkspace) files. Use when project/workspace path is unknown.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "maxDepth": {"maximum":9007199254740991,"minimum":0,"type":"integer"}, + "scanPath": {"type":"string"}, + "workspaceRoot": {"type":"string"} + }, + "required": ["workspaceRoot"], + "type": "object" + }, + "name": "discover_projs", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "pathItem": { + "additionalProperties": false, + "properties": { + "path": {"type":"string"} + }, + "required": ["path"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.project-list/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "scanPath": {"type":"string"}, + "workspaceRoot": {"type":"string"} + }, + "required": ["workspaceRoot","scanPath"], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "projects": { + "items": {"$ref":"#/$defs/pathItem"}, + "type": "array" + }, + "summary": { + "additionalProperties": false, + "properties": { + "maxDepth": {"minimum":0,"type":"integer"}, + "projectCount": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "workspaceCount": {"minimum":0,"type":"integer"} + }, + "required": ["status","maxDepth"], + "type": "object" + }, + "workspaces": { + "items": {"$ref":"#/$defs/pathItem"}, + "type": "array" + } + }, + "required": ["summary","artifacts","projects","workspaces"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.project-list"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/doctor.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/doctor.json new file mode 100644 index 000000000..3133f2a19 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/doctor.json @@ -0,0 +1,167 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Doctor"}, + "description": "MCP environment info.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "nonRedacted": {"description":"Opt-in: when true, disable redaction and include full raw doctor output.","type":"boolean"} + }, + "type": "object" + }, + "name": "doctor", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.doctor-report/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "description": "Structured output envelope for environment and dependency diagnostics.", + "properties": { + "data": { + "anyOf": [ + { + "additionalProperties": false, + "properties": { + "checks": { + "items": { + "additionalProperties": false, + "properties": { + "message": {"type":"string"}, + "name": {"type":"string"}, + "status": { + "enum": ["ok","warning","error"] + } + }, + "required": ["name","status","message"], + "type": "object" + }, + "type": "array" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "serverVersion": {"type":"string"} + }, + "required": ["serverVersion","checks"], + "type": "object" + }, + {"type":"null"} + ] + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.doctor-report"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "title": "Doctor Report", + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/drag.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/drag.json new file mode 100644 index 000000000..b15b0e671 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/drag.json @@ -0,0 +1,480 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Drag"}, + "description": "Drag from a visible runtime elementRef in a direction, then return a refreshed runtime UI snapshot. Use this for exposed sheet grabbers or real scroll/list content refs when nextSteps suggests dragging; do not use raw screen coordinates.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "direction": { + "description": "Drag direction: up, down, left, or right", + "enum": ["up","down","left","right"], + "type": "string" + }, + "distance": {"description":"Normalized drag distance greater than 0 and up to 1 within the resolved element or viewport","exclusiveMinimum":0,"maximum":1,"type":"number"}, + "duration": {"description":"seconds","exclusiveMinimum":0,"type":"number"}, + "elementRef": {"description":"Runtime elementRef from the latest snapshot_ui or wait_for_ui output","minLength":1,"type":"string"}, + "postDelay": {"description":"seconds","maximum":10,"minimum":0,"type":"number"}, + "preDelay": {"description":"seconds","maximum":10,"minimum":0,"type":"number"}, + "simulatorId": {"format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","type":"string"}, + "steps": {"maximum":1000,"minimum":1,"type":"integer"} + }, + "required": ["simulatorId","elementRef","direction"], + "type": "object" + }, + "name": "drag", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "compactRuntimeSnapshot": { + "additionalProperties": false, + "properties": { + "count": {"minimum":0,"type":"integer"}, + "evidence": { + "description": "Non-actionable semantic evidence rows in role|label|value|identifier format. These rows intentionally omit element refs.", + "items": {"type":"string"}, + "type": "array" + }, + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "scroll": { + "items": {"type":"string"}, + "type": "array" + }, + "seq": {"minimum":0,"type":"integer"}, + "targets": { + "items": {"type":"string"}, + "type": "array" + }, + "text": { + "items": {"type":"string"}, + "type": "array" + }, + "type": {"const":"runtime-snapshot"}, + "udid": {"type":"string"} + }, + "required": ["type","rs","screenHash","seq","count","targets","scroll","udid"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "direction": { + "enum": ["up","down","left","right"] + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "frame": { + "additionalProperties": false, + "properties": { + "height": {"type":"number"}, + "width": {"type":"number"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y","width","height"], + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "point": { + "additionalProperties": false, + "properties": { + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y"], + "type": "object" + }, + "recoverableUiError": { + "additionalProperties": false, + "properties": { + "candidates": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "code": { + "enum": ["SNAPSHOT_MISSING","SNAPSHOT_EXPIRED","SNAPSHOT_PARSE_FAILED","SNAPSHOT_CAPTURE_FAILED","ELEMENT_REF_NOT_FOUND","TARGET_NOT_FOUND","TARGET_AMBIGUOUS","TARGET_NOT_ACTIONABLE","WAIT_TIMEOUT","UI_STATE_CHANGED","ACTION_FAILED"] + }, + "elementRef": {"type":"string"}, + "message": {"type":"string"}, + "recoveryHint": {"type":"string"}, + "snapshotAgeMs": {"minimum":0,"type":"integer"}, + "timeoutMs": {"minimum":0,"type":"integer"} + }, + "required": ["code","message","recoveryHint"], + "type": "object" + }, + "runtimeActionName": { + "enum": ["tap","typeText","longPress","touch","swipeWithin"] + }, + "runtimeElement": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionName"}, + "type": "array" + }, + "frame": {"$ref":"#/$defs/frame"}, + "identifier": {"type":"string"}, + "label": {"type":"string"}, + "ref": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "role": {"$ref":"#/$defs/runtimeElementRole"}, + "state": {"$ref":"#/$defs/runtimeElementState"}, + "value": {"type":"string"} + }, + "required": ["ref","frame","actions"], + "type": "object" + }, + "runtimeElementRole": { + "enum": ["application","button","cell","image","keyboard-key","list","menu","other","scroll-view","slider","switch","tab","text","text-field","window"] + }, + "runtimeElementState": { + "additionalProperties": false, + "properties": { + "enabled": {"type":"boolean"}, + "focused": {"type":"boolean"}, + "selected": {"type":"boolean"}, + "visible": {"type":"boolean"} + }, + "type": "object" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.ui-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"}, + "withinElementRef": {"type":"string"} + }, + "required": ["type","withinElementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"} + }, + "required": ["type","from","to"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"swipe"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "elementRef": {"type":"string"}, + "from": {"$ref":"#/$defs/point"}, + "steps": {"minimum":1,"type":"integer"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"drag"} + }, + "required": ["type","elementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"touch"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "elementRef": {"type":"string"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "button": {"type":"string"}, + "type": {"const":"button"} + }, + "required": ["type","button"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "gesture": {"type":"string"}, + "type": {"const":"gesture"} + }, + "required": ["type","gesture"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCode": {"minimum":0,"type":"integer"}, + "type": {"const":"key-press"} + }, + "required": ["type","keyCode"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCodes": { + "items": {"minimum":0,"type":"integer"}, + "type": "array" + }, + "type": {"const":"key-sequence"} + }, + "required": ["type","keyCodes"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "stepCount": {"minimum":1,"type":"integer"}, + "type": {"const":"batch"} + }, + "required": ["type","stepCount"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "capture": {"$ref":"#/$defs/compactRuntimeSnapshot"}, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"}, + "uiError": {"$ref":"#/$defs/recoverableUiError"} + }, + "required": ["summary","action","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.ui-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/erase_sims.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/erase_sims.json new file mode 100644 index 000000000..2dc560203 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/erase_sims.json @@ -0,0 +1,258 @@ +{ + "annotations": {"destructiveHint":true,"openWorldHint":false,"readOnlyHint":false,"title":"Erase Simulators"}, + "description": "Erase simulator.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "shutdownFirst": {"type":"boolean"}, + "simulatorId": { + "description": "UDID of the simulator to erase.", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + } + }, + "required": ["simulatorId"], + "type": "object" + }, + "name": "erase_sims", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.simulator-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "type": {"const":"boot"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"erase"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"open"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"reset-location"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "coordinates": { + "additionalProperties": false, + "properties": { + "latitude": {"maximum":90,"minimum":-90,"type":"number"}, + "longitude": {"maximum":180,"minimum":-180,"type":"number"} + }, + "required": ["latitude","longitude"], + "type": "object" + }, + "type": {"const":"set-location"} + }, + "required": ["type","coordinates"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "appearance": {"type":"string"}, + "type": {"const":"set-appearance"} + }, + "required": ["type","appearance"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "dataNetwork": {"type":"string"}, + "type": {"const":"statusbar"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-software-keyboard"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-connect-hardware-keyboard"} + }, + "required": ["type"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","action"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.simulator-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/gesture.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/gesture.json new file mode 100644 index 000000000..3f97790d3 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/gesture.json @@ -0,0 +1,480 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Gesture"}, + "description": "Simulator gesture preset.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "delta": {"description":"Distance to move in pixels.","maximum":200,"minimum":0,"type":"number"}, + "duration": {"description":"Duration of the gesture in seconds.","maximum":10,"minimum":0,"type":"number"}, + "postDelay": {"description":"Delay after completing the gesture in seconds.","maximum":10,"minimum":0,"type":"number"}, + "preDelay": {"description":"Delay before starting the gesture in seconds.","maximum":10,"minimum":0,"type":"number"}, + "preset": { + "description": "scroll-up|scroll-down|scroll-left|scroll-right|swipe-from-left-edge|swipe-from-right-edge|swipe-from-top-edge|swipe-from-bottom-edge", + "enum": ["scroll-up","scroll-down","scroll-left","scroll-right","swipe-from-left-edge","swipe-from-right-edge","swipe-from-top-edge","swipe-from-bottom-edge"], + "type": "string" + }, + "screenHeight": {"description":"Screen height in pixels. Used for gesture calculations. Auto-detected if not provided.","maximum":3000,"minimum":1,"type":"integer"}, + "screenWidth": {"description":"Screen width in pixels. Used for gesture calculations. Auto-detected if not provided.","maximum":2000,"minimum":1,"type":"integer"}, + "simulatorId": {"format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","type":"string"} + }, + "required": ["simulatorId","preset"], + "type": "object" + }, + "name": "gesture", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "compactRuntimeSnapshot": { + "additionalProperties": false, + "properties": { + "count": {"minimum":0,"type":"integer"}, + "evidence": { + "description": "Non-actionable semantic evidence rows in role|label|value|identifier format. These rows intentionally omit element refs.", + "items": {"type":"string"}, + "type": "array" + }, + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "scroll": { + "items": {"type":"string"}, + "type": "array" + }, + "seq": {"minimum":0,"type":"integer"}, + "targets": { + "items": {"type":"string"}, + "type": "array" + }, + "text": { + "items": {"type":"string"}, + "type": "array" + }, + "type": {"const":"runtime-snapshot"}, + "udid": {"type":"string"} + }, + "required": ["type","rs","screenHash","seq","count","targets","scroll","udid"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "direction": { + "enum": ["up","down","left","right"] + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "frame": { + "additionalProperties": false, + "properties": { + "height": {"type":"number"}, + "width": {"type":"number"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y","width","height"], + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "point": { + "additionalProperties": false, + "properties": { + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y"], + "type": "object" + }, + "recoverableUiError": { + "additionalProperties": false, + "properties": { + "candidates": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "code": { + "enum": ["SNAPSHOT_MISSING","SNAPSHOT_EXPIRED","SNAPSHOT_PARSE_FAILED","SNAPSHOT_CAPTURE_FAILED","ELEMENT_REF_NOT_FOUND","TARGET_NOT_FOUND","TARGET_AMBIGUOUS","TARGET_NOT_ACTIONABLE","WAIT_TIMEOUT","UI_STATE_CHANGED","ACTION_FAILED"] + }, + "elementRef": {"type":"string"}, + "message": {"type":"string"}, + "recoveryHint": {"type":"string"}, + "snapshotAgeMs": {"minimum":0,"type":"integer"}, + "timeoutMs": {"minimum":0,"type":"integer"} + }, + "required": ["code","message","recoveryHint"], + "type": "object" + }, + "runtimeActionName": { + "enum": ["tap","typeText","longPress","touch","swipeWithin"] + }, + "runtimeElement": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionName"}, + "type": "array" + }, + "frame": {"$ref":"#/$defs/frame"}, + "identifier": {"type":"string"}, + "label": {"type":"string"}, + "ref": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "role": {"$ref":"#/$defs/runtimeElementRole"}, + "state": {"$ref":"#/$defs/runtimeElementState"}, + "value": {"type":"string"} + }, + "required": ["ref","frame","actions"], + "type": "object" + }, + "runtimeElementRole": { + "enum": ["application","button","cell","image","keyboard-key","list","menu","other","scroll-view","slider","switch","tab","text","text-field","window"] + }, + "runtimeElementState": { + "additionalProperties": false, + "properties": { + "enabled": {"type":"boolean"}, + "focused": {"type":"boolean"}, + "selected": {"type":"boolean"}, + "visible": {"type":"boolean"} + }, + "type": "object" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.ui-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"}, + "withinElementRef": {"type":"string"} + }, + "required": ["type","withinElementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"} + }, + "required": ["type","from","to"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"swipe"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "elementRef": {"type":"string"}, + "from": {"$ref":"#/$defs/point"}, + "steps": {"minimum":1,"type":"integer"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"drag"} + }, + "required": ["type","elementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"touch"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "elementRef": {"type":"string"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "button": {"type":"string"}, + "type": {"const":"button"} + }, + "required": ["type","button"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "gesture": {"type":"string"}, + "type": {"const":"gesture"} + }, + "required": ["type","gesture"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCode": {"minimum":0,"type":"integer"}, + "type": {"const":"key-press"} + }, + "required": ["type","keyCode"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCodes": { + "items": {"minimum":0,"type":"integer"}, + "type": "array" + }, + "type": {"const":"key-sequence"} + }, + "required": ["type","keyCodes"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "stepCount": {"minimum":1,"type":"integer"}, + "type": {"const":"batch"} + }, + "required": ["type","stepCount"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "capture": {"$ref":"#/$defs/compactRuntimeSnapshot"}, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"}, + "uiError": {"$ref":"#/$defs/recoverableUiError"} + }, + "required": ["summary","action","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.ui-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/get_app_bundle_id.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/get_app_bundle_id.json new file mode 100644 index 000000000..a572f2ce6 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/get_app_bundle_id.json @@ -0,0 +1,154 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Get App Bundle ID"}, + "description": "Extract bundle id from .app.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "appPath": {"description":"Path to the .app bundle","type":"string"} + }, + "required": ["appPath"], + "type": "object" + }, + "name": "get_app_bundle_id", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.bundle-id/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "appPath": {"type":"string"}, + "bundleId": {"type":"string"} + }, + "required": ["appPath"], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"} + }, + "required": ["artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.bundle-id"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/get_coverage_report.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/get_coverage_report.json new file mode 100644 index 000000000..910b56372 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/get_coverage_report.json @@ -0,0 +1,228 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Get Coverage Report"}, + "description": "Show per-target code coverage from an xcresult bundle.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "showFiles": {"default":false,"description":"When true, include per-file coverage breakdown under each target","type":"boolean"}, + "target": {"description":"Filter results to a specific target name","type":"string"}, + "xcresultPath": {"description":"Path to the .xcresult bundle","type":"string"} + }, + "required": ["xcresultPath"], + "type": "object" + }, + "name": "get_coverage_report", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.coverage-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "file": {"type":"string"}, + "sourceFilePath": {"type":"string"}, + "target": {"type":"string"}, + "xcresultPath": {"type":"string"} + }, + "required": ["xcresultPath"], + "type": "object" + }, + "coverageScope": { + "enum": ["report","file"] + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "functions": { + "additionalProperties": false, + "properties": { + "fullCoverageCount": {"minimum":0,"type":"integer"}, + "notCovered": { + "items": { + "additionalProperties": false, + "properties": { + "coveredLines": {"minimum":0,"type":"integer"}, + "executableLines": {"minimum":0,"type":"integer"}, + "line": {"minimum":1,"type":"integer"}, + "name": {"type":"string"} + }, + "required": ["line","name","coveredLines","executableLines"], + "type": "object" + }, + "type": "array" + }, + "notCoveredFunctionCount": {"minimum":0,"type":"integer"}, + "notCoveredLineCount": {"minimum":0,"type":"integer"}, + "partialCoverage": { + "items": { + "additionalProperties": false, + "properties": { + "coveragePct": {"maximum":100,"minimum":0,"type":"number"}, + "coveredLines": {"minimum":0,"type":"integer"}, + "executableLines": {"minimum":0,"type":"integer"}, + "line": {"minimum":1,"type":"integer"}, + "name": {"type":"string"} + }, + "required": ["line","name","coveragePct","coveredLines","executableLines"], + "type": "object" + }, + "type": "array" + }, + "partialCoverageFunctionCount": {"minimum":0,"type":"integer"} + }, + "required": ["fullCoverageCount","notCoveredFunctionCount","notCoveredLineCount","partialCoverageFunctionCount"], + "type": "object" + }, + "summary": { + "additionalProperties": false, + "properties": { + "coveragePct": {"maximum":100,"minimum":0,"type":"number"}, + "coveredLines": {"minimum":0,"type":"integer"}, + "executableLines": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + }, + "targets": { + "items": { + "additionalProperties": false, + "properties": { + "coveragePct": {"maximum":100,"minimum":0,"type":"number"}, + "coveredLines": {"minimum":0,"type":"integer"}, + "executableLines": {"minimum":0,"type":"integer"}, + "name": {"type":"string"} + }, + "required": ["name","coveragePct","coveredLines","executableLines"], + "type": "object" + }, + "type": "array" + } + }, + "required": ["summary","coverageScope","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.coverage-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/get_device_app_path.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/get_device_app_path.json new file mode 100644 index 000000000..b93eefe7b --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/get_device_app_path.json @@ -0,0 +1,199 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Get Device App Path"}, + "description": "Get device built app path.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "configuration": {"description":"Build configuration (Debug, Release, etc.)","type":"string"}, + "derivedDataPath": {"type":"string"}, + "platform": { + "description": "Device platform: iOS, watchOS, tvOS, or visionOS. Defaults to iOS.", + "enum": ["iOS","watchOS","tvOS","visionOS"], + "type": "string" + }, + "projectPath": {"description":"Path to the .xcodeproj file","type":"string"}, + "scheme": {"description":"The scheme to use","type":"string"}, + "workspacePath": {"description":"Path to the .xcworkspace file","type":"string"} + }, + "required": ["scheme"], + "type": "object" + }, + "name": "get_device_app_path", + "outputSchema": { + "$defs": { + "appPathRequest": { + "additionalProperties": false, + "properties": { + "configuration": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulator": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "type": "object" + }, + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.app-path/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "anyOf": [ + { + "properties": {"artifacts":true}, + "required": ["artifacts"] + }, + { + "properties": {"diagnostics":true}, + "required": ["diagnostics"] + } + ], + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "appPath": {"type":"string"} + }, + "required": ["appPath"], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "request": {"$ref":"#/$defs/appPathRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "required": [], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.app-path"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/get_file_coverage.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/get_file_coverage.json new file mode 100644 index 000000000..940ddf6f7 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/get_file_coverage.json @@ -0,0 +1,228 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Get File Coverage"}, + "description": "Show function-level coverage and uncovered line ranges for a specific file.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "file": {"description":"Source file name or path to inspect","type":"string"}, + "showLines": {"default":false,"description":"When true, include uncovered line ranges from the archive","type":"boolean"}, + "xcresultPath": {"description":"Path to the .xcresult bundle","type":"string"} + }, + "required": ["xcresultPath","file"], + "type": "object" + }, + "name": "get_file_coverage", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.coverage-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "file": {"type":"string"}, + "sourceFilePath": {"type":"string"}, + "target": {"type":"string"}, + "xcresultPath": {"type":"string"} + }, + "required": ["xcresultPath"], + "type": "object" + }, + "coverageScope": { + "enum": ["report","file"] + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "functions": { + "additionalProperties": false, + "properties": { + "fullCoverageCount": {"minimum":0,"type":"integer"}, + "notCovered": { + "items": { + "additionalProperties": false, + "properties": { + "coveredLines": {"minimum":0,"type":"integer"}, + "executableLines": {"minimum":0,"type":"integer"}, + "line": {"minimum":1,"type":"integer"}, + "name": {"type":"string"} + }, + "required": ["line","name","coveredLines","executableLines"], + "type": "object" + }, + "type": "array" + }, + "notCoveredFunctionCount": {"minimum":0,"type":"integer"}, + "notCoveredLineCount": {"minimum":0,"type":"integer"}, + "partialCoverage": { + "items": { + "additionalProperties": false, + "properties": { + "coveragePct": {"maximum":100,"minimum":0,"type":"number"}, + "coveredLines": {"minimum":0,"type":"integer"}, + "executableLines": {"minimum":0,"type":"integer"}, + "line": {"minimum":1,"type":"integer"}, + "name": {"type":"string"} + }, + "required": ["line","name","coveragePct","coveredLines","executableLines"], + "type": "object" + }, + "type": "array" + }, + "partialCoverageFunctionCount": {"minimum":0,"type":"integer"} + }, + "required": ["fullCoverageCount","notCoveredFunctionCount","notCoveredLineCount","partialCoverageFunctionCount"], + "type": "object" + }, + "summary": { + "additionalProperties": false, + "properties": { + "coveragePct": {"maximum":100,"minimum":0,"type":"number"}, + "coveredLines": {"minimum":0,"type":"integer"}, + "executableLines": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + }, + "targets": { + "items": { + "additionalProperties": false, + "properties": { + "coveragePct": {"maximum":100,"minimum":0,"type":"number"}, + "coveredLines": {"minimum":0,"type":"integer"}, + "executableLines": {"minimum":0,"type":"integer"}, + "name": {"type":"string"} + }, + "required": ["name","coveragePct","coveredLines","executableLines"], + "type": "object" + }, + "type": "array" + } + }, + "required": ["summary","coverageScope","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.coverage-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/get_mac_app_path.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/get_mac_app_path.json new file mode 100644 index 000000000..783303fb6 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/get_mac_app_path.json @@ -0,0 +1,203 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Get macOS App Path"}, + "description": "Get macOS built app path.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "arch": { + "description": "Architecture to build for (arm64 or x86_64). For macOS only.", + "enum": ["arm64","x86_64"], + "type": "string" + }, + "configuration": {"description":"Build configuration (Debug, Release, etc.)","type":"string"}, + "derivedDataPath": {"type":"string"}, + "extraArgs": { + "items": {"type":"string"}, + "type": "array" + }, + "projectPath": {"description":"Path to the .xcodeproj file","type":"string"}, + "scheme": {"description":"The scheme to use","type":"string"}, + "workspacePath": {"description":"Path to the .xcworkspace file","type":"string"} + }, + "required": ["scheme"], + "type": "object" + }, + "name": "get_mac_app_path", + "outputSchema": { + "$defs": { + "appPathRequest": { + "additionalProperties": false, + "properties": { + "configuration": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulator": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "type": "object" + }, + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.app-path/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "anyOf": [ + { + "properties": {"artifacts":true}, + "required": ["artifacts"] + }, + { + "properties": {"diagnostics":true}, + "required": ["diagnostics"] + } + ], + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "appPath": {"type":"string"} + }, + "required": ["appPath"], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "request": {"$ref":"#/$defs/appPathRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "required": [], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.app-path"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/get_mac_bundle_id.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/get_mac_bundle_id.json new file mode 100644 index 000000000..0092db45b --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/get_mac_bundle_id.json @@ -0,0 +1,154 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Get Mac Bundle ID"}, + "description": "Extract bundle id from macOS .app.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "appPath": {"description":"Path to the .app bundle","type":"string"} + }, + "required": ["appPath"], + "type": "object" + }, + "name": "get_mac_bundle_id", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.bundle-id/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "appPath": {"type":"string"}, + "bundleId": {"type":"string"} + }, + "required": ["appPath"], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"} + }, + "required": ["artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.bundle-id"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/get_sim_app_path.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/get_sim_app_path.json new file mode 100644 index 000000000..387369966 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/get_sim_app_path.json @@ -0,0 +1,201 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Get Simulator App Path"}, + "description": "Get sim built app path.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "configuration": {"description":"Build configuration (Debug, Release, etc.)","type":"string"}, + "derivedDataPath": {"type":"string"}, + "platform": { + "enum": ["iOS Simulator","watchOS Simulator","tvOS Simulator","visionOS Simulator"], + "type": "string" + }, + "projectPath": {"description":"Path to .xcodeproj file. Provide EITHER this OR workspacePath, not both","type":"string"}, + "scheme": {"description":"The scheme to use (Required)","type":"string"}, + "simulatorId": {"description":"UUID of the simulator (from list_sims). Provide EITHER this OR simulatorName, not both","type":"string"}, + "simulatorName": {"description":"Name of the simulator (e.g., 'iPhone 17'). Provide EITHER this OR simulatorId, not both","type":"string"}, + "useLatestOS": {"description":"Whether to use the latest OS version for the named simulator","type":"boolean"}, + "workspacePath": {"description":"Path to .xcworkspace file. Provide EITHER this OR projectPath, not both","type":"string"} + }, + "required": ["scheme","platform"], + "type": "object" + }, + "name": "get_sim_app_path", + "outputSchema": { + "$defs": { + "appPathRequest": { + "additionalProperties": false, + "properties": { + "configuration": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulator": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "type": "object" + }, + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.app-path/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "anyOf": [ + { + "properties": {"artifacts":true}, + "required": ["artifacts"] + }, + { + "properties": {"diagnostics":true}, + "required": ["diagnostics"] + } + ], + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "appPath": {"type":"string"} + }, + "required": ["appPath"], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "request": {"$ref":"#/$defs/appPathRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "required": [], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.app-path"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/install_app_device.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/install_app_device.json new file mode 100644 index 000000000..2f7e0ae38 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/install_app_device.json @@ -0,0 +1,167 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Install App Device"}, + "description": "Install app on device.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "appPath": {"type":"string"}, + "deviceId": {"description":"UDID of the device (obtained from list_devices)","minLength":1,"type":"string"} + }, + "required": ["deviceId","appPath"], + "type": "object" + }, + "name": "install_app_device", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.install-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "appPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "simulatorId": {"type":"string"} + }, + "required": ["appPath"], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.install-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/install_app_sim.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/install_app_sim.json new file mode 100644 index 000000000..aff524ffd --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/install_app_sim.json @@ -0,0 +1,168 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Install App Simulator"}, + "description": "Install app on sim.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "appPath": {"description":"Path to the .app bundle to install","type":"string"}, + "simulatorId": {"description":"UUID of the simulator to use (obtained from list_sims). Provide EITHER this OR simulatorName, not both","type":"string"}, + "simulatorName": {"description":"Name of the simulator (e.g., 'iPhone 17'). Provide EITHER this OR simulatorId, not both","type":"string"} + }, + "required": ["appPath"], + "type": "object" + }, + "name": "install_app_sim", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.install-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "appPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "simulatorId": {"type":"string"} + }, + "required": ["appPath"], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.install-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/key_press.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/key_press.json new file mode 100644 index 000000000..3a8a06af2 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/key_press.json @@ -0,0 +1,471 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Key Press"}, + "description": "Press one hardware key using an AXe HID key code. Prefer type_text for text entry. Common values include 40 Return/Enter, 42 Backspace, 43 Tab, and 44 Space.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "duration": {"description":"seconds","maximum":10,"minimum":0,"type":"number"}, + "keyCode": {"description":"HID keycode. Common values: 40 Return/Enter, 42 Backspace, 43 Tab, 44 Space.","maximum":255,"minimum":0,"type":"integer"}, + "simulatorId": {"format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","type":"string"} + }, + "required": ["simulatorId","keyCode"], + "type": "object" + }, + "name": "key_press", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "compactRuntimeSnapshot": { + "additionalProperties": false, + "properties": { + "count": {"minimum":0,"type":"integer"}, + "evidence": { + "description": "Non-actionable semantic evidence rows in role|label|value|identifier format. These rows intentionally omit element refs.", + "items": {"type":"string"}, + "type": "array" + }, + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "scroll": { + "items": {"type":"string"}, + "type": "array" + }, + "seq": {"minimum":0,"type":"integer"}, + "targets": { + "items": {"type":"string"}, + "type": "array" + }, + "text": { + "items": {"type":"string"}, + "type": "array" + }, + "type": {"const":"runtime-snapshot"}, + "udid": {"type":"string"} + }, + "required": ["type","rs","screenHash","seq","count","targets","scroll","udid"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "direction": { + "enum": ["up","down","left","right"] + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "frame": { + "additionalProperties": false, + "properties": { + "height": {"type":"number"}, + "width": {"type":"number"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y","width","height"], + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "point": { + "additionalProperties": false, + "properties": { + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y"], + "type": "object" + }, + "recoverableUiError": { + "additionalProperties": false, + "properties": { + "candidates": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "code": { + "enum": ["SNAPSHOT_MISSING","SNAPSHOT_EXPIRED","SNAPSHOT_PARSE_FAILED","SNAPSHOT_CAPTURE_FAILED","ELEMENT_REF_NOT_FOUND","TARGET_NOT_FOUND","TARGET_AMBIGUOUS","TARGET_NOT_ACTIONABLE","WAIT_TIMEOUT","UI_STATE_CHANGED","ACTION_FAILED"] + }, + "elementRef": {"type":"string"}, + "message": {"type":"string"}, + "recoveryHint": {"type":"string"}, + "snapshotAgeMs": {"minimum":0,"type":"integer"}, + "timeoutMs": {"minimum":0,"type":"integer"} + }, + "required": ["code","message","recoveryHint"], + "type": "object" + }, + "runtimeActionName": { + "enum": ["tap","typeText","longPress","touch","swipeWithin"] + }, + "runtimeElement": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionName"}, + "type": "array" + }, + "frame": {"$ref":"#/$defs/frame"}, + "identifier": {"type":"string"}, + "label": {"type":"string"}, + "ref": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "role": {"$ref":"#/$defs/runtimeElementRole"}, + "state": {"$ref":"#/$defs/runtimeElementState"}, + "value": {"type":"string"} + }, + "required": ["ref","frame","actions"], + "type": "object" + }, + "runtimeElementRole": { + "enum": ["application","button","cell","image","keyboard-key","list","menu","other","scroll-view","slider","switch","tab","text","text-field","window"] + }, + "runtimeElementState": { + "additionalProperties": false, + "properties": { + "enabled": {"type":"boolean"}, + "focused": {"type":"boolean"}, + "selected": {"type":"boolean"}, + "visible": {"type":"boolean"} + }, + "type": "object" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.ui-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"}, + "withinElementRef": {"type":"string"} + }, + "required": ["type","withinElementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"} + }, + "required": ["type","from","to"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"swipe"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "elementRef": {"type":"string"}, + "from": {"$ref":"#/$defs/point"}, + "steps": {"minimum":1,"type":"integer"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"drag"} + }, + "required": ["type","elementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"touch"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "elementRef": {"type":"string"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "button": {"type":"string"}, + "type": {"const":"button"} + }, + "required": ["type","button"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "gesture": {"type":"string"}, + "type": {"const":"gesture"} + }, + "required": ["type","gesture"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCode": {"minimum":0,"type":"integer"}, + "type": {"const":"key-press"} + }, + "required": ["type","keyCode"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCodes": { + "items": {"minimum":0,"type":"integer"}, + "type": "array" + }, + "type": {"const":"key-sequence"} + }, + "required": ["type","keyCodes"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "stepCount": {"minimum":1,"type":"integer"}, + "type": {"const":"batch"} + }, + "required": ["type","stepCount"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "capture": {"$ref":"#/$defs/compactRuntimeSnapshot"}, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"}, + "uiError": {"$ref":"#/$defs/recoverableUiError"} + }, + "required": ["summary","action","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.ui-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/key_sequence.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/key_sequence.json new file mode 100644 index 000000000..fb391714e --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/key_sequence.json @@ -0,0 +1,477 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Key Sequence"}, + "description": "Press hardware keys using AXe HID key codes. Prefer type_text for text entry. Common values include 40 Return/Enter, 42 Backspace, 43 Tab, and 44 Space.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "delay": {"maximum":5,"minimum":0,"type":"number"}, + "keyCodes": { + "description": "HID keycodes. Common values: 40 Return/Enter, 42 Backspace, 43 Tab, 44 Space.", + "items": {"maximum":255,"minimum":0,"type":"integer"}, + "maxItems": 100, + "minItems": 1, + "type": "array" + }, + "simulatorId": {"format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","type":"string"} + }, + "required": ["simulatorId","keyCodes"], + "type": "object" + }, + "name": "key_sequence", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "compactRuntimeSnapshot": { + "additionalProperties": false, + "properties": { + "count": {"minimum":0,"type":"integer"}, + "evidence": { + "description": "Non-actionable semantic evidence rows in role|label|value|identifier format. These rows intentionally omit element refs.", + "items": {"type":"string"}, + "type": "array" + }, + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "scroll": { + "items": {"type":"string"}, + "type": "array" + }, + "seq": {"minimum":0,"type":"integer"}, + "targets": { + "items": {"type":"string"}, + "type": "array" + }, + "text": { + "items": {"type":"string"}, + "type": "array" + }, + "type": {"const":"runtime-snapshot"}, + "udid": {"type":"string"} + }, + "required": ["type","rs","screenHash","seq","count","targets","scroll","udid"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "direction": { + "enum": ["up","down","left","right"] + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "frame": { + "additionalProperties": false, + "properties": { + "height": {"type":"number"}, + "width": {"type":"number"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y","width","height"], + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "point": { + "additionalProperties": false, + "properties": { + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y"], + "type": "object" + }, + "recoverableUiError": { + "additionalProperties": false, + "properties": { + "candidates": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "code": { + "enum": ["SNAPSHOT_MISSING","SNAPSHOT_EXPIRED","SNAPSHOT_PARSE_FAILED","SNAPSHOT_CAPTURE_FAILED","ELEMENT_REF_NOT_FOUND","TARGET_NOT_FOUND","TARGET_AMBIGUOUS","TARGET_NOT_ACTIONABLE","WAIT_TIMEOUT","UI_STATE_CHANGED","ACTION_FAILED"] + }, + "elementRef": {"type":"string"}, + "message": {"type":"string"}, + "recoveryHint": {"type":"string"}, + "snapshotAgeMs": {"minimum":0,"type":"integer"}, + "timeoutMs": {"minimum":0,"type":"integer"} + }, + "required": ["code","message","recoveryHint"], + "type": "object" + }, + "runtimeActionName": { + "enum": ["tap","typeText","longPress","touch","swipeWithin"] + }, + "runtimeElement": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionName"}, + "type": "array" + }, + "frame": {"$ref":"#/$defs/frame"}, + "identifier": {"type":"string"}, + "label": {"type":"string"}, + "ref": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "role": {"$ref":"#/$defs/runtimeElementRole"}, + "state": {"$ref":"#/$defs/runtimeElementState"}, + "value": {"type":"string"} + }, + "required": ["ref","frame","actions"], + "type": "object" + }, + "runtimeElementRole": { + "enum": ["application","button","cell","image","keyboard-key","list","menu","other","scroll-view","slider","switch","tab","text","text-field","window"] + }, + "runtimeElementState": { + "additionalProperties": false, + "properties": { + "enabled": {"type":"boolean"}, + "focused": {"type":"boolean"}, + "selected": {"type":"boolean"}, + "visible": {"type":"boolean"} + }, + "type": "object" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.ui-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"}, + "withinElementRef": {"type":"string"} + }, + "required": ["type","withinElementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"} + }, + "required": ["type","from","to"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"swipe"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "elementRef": {"type":"string"}, + "from": {"$ref":"#/$defs/point"}, + "steps": {"minimum":1,"type":"integer"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"drag"} + }, + "required": ["type","elementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"touch"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "elementRef": {"type":"string"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "button": {"type":"string"}, + "type": {"const":"button"} + }, + "required": ["type","button"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "gesture": {"type":"string"}, + "type": {"const":"gesture"} + }, + "required": ["type","gesture"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCode": {"minimum":0,"type":"integer"}, + "type": {"const":"key-press"} + }, + "required": ["type","keyCode"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCodes": { + "items": {"minimum":0,"type":"integer"}, + "type": "array" + }, + "type": {"const":"key-sequence"} + }, + "required": ["type","keyCodes"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "stepCount": {"minimum":1,"type":"integer"}, + "type": {"const":"batch"} + }, + "required": ["type","stepCount"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "capture": {"$ref":"#/$defs/compactRuntimeSnapshot"}, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"}, + "uiError": {"$ref":"#/$defs/recoverableUiError"} + }, + "required": ["summary","action","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.ui-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/launch_app_device.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/launch_app_device.json new file mode 100644 index 000000000..114a28d97 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/launch_app_device.json @@ -0,0 +1,190 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Launch App Device"}, + "description": "Launch app on device.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "bundleId": {"type":"string"}, + "deviceId": {"description":"UDID of the device (obtained from list_devices)","type":"string"}, + "env": { + "description": "Environment variables to pass to the launched app as key-value entries", + "items": { + "additionalProperties": false, + "properties": { + "key": {"minLength":1,"type":"string"}, + "value": {"type":"string"} + }, + "required": ["key","value"], + "type": "object" + }, + "type": "array" + }, + "launchArgs": { + "description": "Arguments passed to the launched app process on physical device runtime", + "items": {"type":"string"}, + "type": "array" + } + }, + "required": ["deviceId","bundleId"], + "type": "object" + }, + "name": "launch_app_device", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.launch-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appPath": {"type":"string"}, + "bundleId": {"type":"string"}, + "deviceId": {"type":"string"}, + "osLogPath": {"type":"string"}, + "processId": {"minimum":1,"type":"integer"}, + "runtimeLogPath": {"type":"string"}, + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.launch-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/launch_app_sim.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/launch_app_sim.json new file mode 100644 index 000000000..70fff21b3 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/launch_app_sim.json @@ -0,0 +1,191 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Launch App Simulator"}, + "description": "Launch app on simulator. Runtime logs are captured automatically and the log file path is included in the response.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "bundleId": {"description":"Bundle identifier of the app to launch","type":"string"}, + "env": { + "description": "Environment variables to pass to the launched app as key-value entries (SIMCTL_CHILD_ prefix added automatically)", + "items": { + "additionalProperties": false, + "properties": { + "key": {"minLength":1,"type":"string"}, + "value": {"type":"string"} + }, + "required": ["key","value"], + "type": "object" + }, + "type": "array" + }, + "launchArgs": { + "description": "Arguments passed to the launched app process on simulator runtime", + "items": {"type":"string"}, + "type": "array" + }, + "simulatorId": {"description":"UUID of the simulator to use (obtained from list_sims). Provide EITHER this OR simulatorName, not both","type":"string"}, + "simulatorName": {"description":"Name of the simulator (e.g., 'iPhone 17'). Provide EITHER this OR simulatorId, not both","type":"string"} + }, + "required": ["bundleId"], + "type": "object" + }, + "name": "launch_app_sim", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.launch-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appPath": {"type":"string"}, + "bundleId": {"type":"string"}, + "deviceId": {"type":"string"}, + "osLogPath": {"type":"string"}, + "processId": {"minimum":1,"type":"integer"}, + "runtimeLogPath": {"type":"string"}, + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.launch-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/launch_mac_app.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/launch_mac_app.json new file mode 100644 index 000000000..fe55e7fda --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/launch_mac_app.json @@ -0,0 +1,176 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Launch macOS App"}, + "description": "Launch macOS app.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "appPath": {"type":"string"}, + "launchArgs": { + "description": "Arguments passed to the launched app process on macOS runtime", + "items": {"type":"string"}, + "type": "array" + } + }, + "required": ["appPath"], + "type": "object" + }, + "name": "launch_mac_app", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.launch-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appPath": {"type":"string"}, + "bundleId": {"type":"string"}, + "deviceId": {"type":"string"}, + "osLogPath": {"type":"string"}, + "processId": {"minimum":1,"type":"integer"}, + "runtimeLogPath": {"type":"string"}, + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.launch-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/list_devices.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/list_devices.json new file mode 100644 index 000000000..c0e63a1b8 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/list_devices.json @@ -0,0 +1,158 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"List Devices"}, + "description": "List connected devices.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": {}, + "type": "object" + }, + "name": "list_devices", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.device-list/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "devices": { + "items": { + "additionalProperties": false, + "properties": { + "deviceId": {"type":"string"}, + "isAvailable": {"type":"boolean"}, + "name": {"type":"string"}, + "osVersion": {"type":"string"}, + "platform": {"type":"string"}, + "state": {"type":"string"} + }, + "required": ["name","deviceId","platform","state","isAvailable","osVersion"], + "type": "object" + }, + "type": "array" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"} + }, + "required": ["devices"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.device-list"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/list_schemes.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/list_schemes.json new file mode 100644 index 000000000..3b51170a6 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/list_schemes.json @@ -0,0 +1,169 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"List Schemes"}, + "description": "List Xcode schemes.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "projectPath": {"description":"Path to the .xcodeproj file","type":"string"}, + "workspacePath": {"description":"Path to the .xcworkspace file","type":"string"} + }, + "type": "object" + }, + "name": "list_schemes", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.scheme-list/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "workspacePath": {"type":"string"} + }, + "required": ["workspacePath"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "projectPath": {"type":"string"} + }, + "required": ["projectPath"], + "type": "object" + } + ] + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "schemes": { + "items": {"type":"string"}, + "type": "array" + } + }, + "required": ["artifacts","schemes"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.scheme-list"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/list_sims.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/list_sims.json new file mode 100644 index 000000000..6ec62e1c3 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/list_sims.json @@ -0,0 +1,130 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"List Simulators"}, + "description": "List iOS simulators.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "enabled": {"type":"boolean"} + }, + "type": "object" + }, + "name": "list_sims", + "outputSchema": { + "$defs": { + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.simulator-list/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "simulators": { + "items": { + "additionalProperties": false, + "properties": { + "isAvailable": {"type":"boolean"}, + "name": {"type":"string"}, + "runtime": {"type":"string"}, + "simulatorId": {"type":"string"}, + "state": {"type":"string"} + }, + "required": ["name","simulatorId","state","isAvailable","runtime"], + "type": "object" + }, + "type": "array" + } + }, + "required": ["simulators"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.simulator-list"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/long_press.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/long_press.json new file mode 100644 index 000000000..18e2792df --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/long_press.json @@ -0,0 +1,471 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Long Press"}, + "description": "Long press a UI element by elementRef from a current rs/1 runtime snapshot.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "duration": {"description":"milliseconds","exclusiveMinimum":0,"maximum":10000,"type":"integer"}, + "elementRef": {"minLength":1,"type":"string"}, + "simulatorId": {"format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","type":"string"} + }, + "required": ["simulatorId","elementRef","duration"], + "type": "object" + }, + "name": "long_press", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "compactRuntimeSnapshot": { + "additionalProperties": false, + "properties": { + "count": {"minimum":0,"type":"integer"}, + "evidence": { + "description": "Non-actionable semantic evidence rows in role|label|value|identifier format. These rows intentionally omit element refs.", + "items": {"type":"string"}, + "type": "array" + }, + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "scroll": { + "items": {"type":"string"}, + "type": "array" + }, + "seq": {"minimum":0,"type":"integer"}, + "targets": { + "items": {"type":"string"}, + "type": "array" + }, + "text": { + "items": {"type":"string"}, + "type": "array" + }, + "type": {"const":"runtime-snapshot"}, + "udid": {"type":"string"} + }, + "required": ["type","rs","screenHash","seq","count","targets","scroll","udid"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "direction": { + "enum": ["up","down","left","right"] + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "frame": { + "additionalProperties": false, + "properties": { + "height": {"type":"number"}, + "width": {"type":"number"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y","width","height"], + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "point": { + "additionalProperties": false, + "properties": { + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y"], + "type": "object" + }, + "recoverableUiError": { + "additionalProperties": false, + "properties": { + "candidates": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "code": { + "enum": ["SNAPSHOT_MISSING","SNAPSHOT_EXPIRED","SNAPSHOT_PARSE_FAILED","SNAPSHOT_CAPTURE_FAILED","ELEMENT_REF_NOT_FOUND","TARGET_NOT_FOUND","TARGET_AMBIGUOUS","TARGET_NOT_ACTIONABLE","WAIT_TIMEOUT","UI_STATE_CHANGED","ACTION_FAILED"] + }, + "elementRef": {"type":"string"}, + "message": {"type":"string"}, + "recoveryHint": {"type":"string"}, + "snapshotAgeMs": {"minimum":0,"type":"integer"}, + "timeoutMs": {"minimum":0,"type":"integer"} + }, + "required": ["code","message","recoveryHint"], + "type": "object" + }, + "runtimeActionName": { + "enum": ["tap","typeText","longPress","touch","swipeWithin"] + }, + "runtimeElement": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionName"}, + "type": "array" + }, + "frame": {"$ref":"#/$defs/frame"}, + "identifier": {"type":"string"}, + "label": {"type":"string"}, + "ref": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "role": {"$ref":"#/$defs/runtimeElementRole"}, + "state": {"$ref":"#/$defs/runtimeElementState"}, + "value": {"type":"string"} + }, + "required": ["ref","frame","actions"], + "type": "object" + }, + "runtimeElementRole": { + "enum": ["application","button","cell","image","keyboard-key","list","menu","other","scroll-view","slider","switch","tab","text","text-field","window"] + }, + "runtimeElementState": { + "additionalProperties": false, + "properties": { + "enabled": {"type":"boolean"}, + "focused": {"type":"boolean"}, + "selected": {"type":"boolean"}, + "visible": {"type":"boolean"} + }, + "type": "object" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.ui-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"}, + "withinElementRef": {"type":"string"} + }, + "required": ["type","withinElementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"} + }, + "required": ["type","from","to"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"swipe"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "elementRef": {"type":"string"}, + "from": {"$ref":"#/$defs/point"}, + "steps": {"minimum":1,"type":"integer"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"drag"} + }, + "required": ["type","elementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"touch"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "elementRef": {"type":"string"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "button": {"type":"string"}, + "type": {"const":"button"} + }, + "required": ["type","button"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "gesture": {"type":"string"}, + "type": {"const":"gesture"} + }, + "required": ["type","gesture"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCode": {"minimum":0,"type":"integer"}, + "type": {"const":"key-press"} + }, + "required": ["type","keyCode"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCodes": { + "items": {"minimum":0,"type":"integer"}, + "type": "array" + }, + "type": {"const":"key-sequence"} + }, + "required": ["type","keyCodes"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "stepCount": {"minimum":1,"type":"integer"}, + "type": {"const":"batch"} + }, + "required": ["type","stepCount"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "capture": {"$ref":"#/$defs/compactRuntimeSnapshot"}, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"}, + "uiError": {"$ref":"#/$defs/recoverableUiError"} + }, + "required": ["summary","action","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.ui-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/manage-workflows.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/manage-workflows.json new file mode 100644 index 000000000..010a81f54 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/manage-workflows.json @@ -0,0 +1,133 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Manage Workflows"}, + "description": "Workflows are groups of tools exposed by XcodeBuildMCP. By default, not all workflows (and therefore tools) are enabled; only simulator tools are enabled by default. Some workflows are mandatory and can't be disabled.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "enable": {"description":"Enable or disable the selected workflows.","type":"boolean"}, + "workflowNames": { + "description": "Workflow directory name(s).", + "items": {"type":"string"}, + "type": "array" + } + }, + "required": ["workflowNames","enable"], + "type": "object" + }, + "name": "manage-workflows", + "outputSchema": { + "$defs": { + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.workflow-selection/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "description": "Structured output envelope for enabling and disabling MCP workflows.", + "properties": { + "data": { + "anyOf": [ + { + "additionalProperties": false, + "properties": { + "enabledWorkflows": { + "items": {"type":"string"}, + "type": "array" + }, + "registeredToolCount": {"minimum":0,"type":"integer"} + }, + "required": ["enabledWorkflows","registeredToolCount"], + "type": "object" + }, + {"type":"null"} + ] + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.workflow-selection"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "title": "Workflow Selection", + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/open_sim.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/open_sim.json new file mode 100644 index 000000000..0842ef367 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/open_sim.json @@ -0,0 +1,249 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Open Simulator"}, + "description": "Open the simulator frontend for visibility and manual workflows. Not required before simulator build-and-run (build_run_sim).", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": {}, + "type": "object" + }, + "name": "open_sim", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.simulator-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "type": {"const":"boot"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"erase"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"open"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"reset-location"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "coordinates": { + "additionalProperties": false, + "properties": { + "latitude": {"maximum":90,"minimum":-90,"type":"number"}, + "longitude": {"maximum":180,"minimum":-180,"type":"number"} + }, + "required": ["latitude","longitude"], + "type": "object" + }, + "type": {"const":"set-location"} + }, + "required": ["type","coordinates"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "appearance": {"type":"string"}, + "type": {"const":"set-appearance"} + }, + "required": ["type","appearance"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "dataNetwork": {"type":"string"}, + "type": {"const":"statusbar"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-software-keyboard"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-connect-hardware-keyboard"} + }, + "required": ["type"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","action"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.simulator-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/record_sim_video.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/record_sim_video.json new file mode 100644 index 000000000..30c211ac7 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/record_sim_video.json @@ -0,0 +1,399 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Record Simulator Video"}, + "description": "Record sim video.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "fps": {"description":"default: 30","maximum":120,"minimum":1,"type":"integer"}, + "outputFile": {"description":"Path to write MP4 file","type":"string"}, + "simulatorId": { + "description": "UUID of the simulator to record", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + }, + "start": {"type":"boolean"}, + "stop": {"type":"boolean"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "name": "record_sim_video", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "compactRuntimeSnapshot": { + "additionalProperties": false, + "properties": { + "count": {"minimum":0,"type":"integer"}, + "evidence": { + "description": "Non-actionable semantic evidence rows in role|label|value|identifier format. These rows intentionally omit element refs.", + "items": {"type":"string"}, + "type": "array" + }, + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "scroll": { + "items": {"type":"string"}, + "type": "array" + }, + "seq": {"minimum":0,"type":"integer"}, + "targets": { + "items": {"type":"string"}, + "type": "array" + }, + "text": { + "items": {"type":"string"}, + "type": "array" + }, + "type": {"const":"runtime-snapshot"}, + "udid": {"type":"string"} + }, + "required": ["type","rs","screenHash","seq","count","targets","scroll","udid"], + "type": "object" + }, + "compactRuntimeSnapshotUnchanged": { + "additionalProperties": false, + "properties": { + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "seq": {"minimum":0,"type":"integer"}, + "type": {"const":"runtime-snapshot-unchanged"}, + "udid": {"type":"string"}, + "unchanged": {"const":true} + }, + "required": ["type","rs","screenHash","seq","unchanged","udid"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "frame": { + "additionalProperties": false, + "properties": { + "height": {"type":"number"}, + "width": {"type":"number"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y","width","height"], + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "recoverableUiError": { + "additionalProperties": false, + "properties": { + "candidates": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "code": { + "enum": ["SNAPSHOT_MISSING","SNAPSHOT_EXPIRED","SNAPSHOT_PARSE_FAILED","SNAPSHOT_CAPTURE_FAILED","ELEMENT_REF_NOT_FOUND","TARGET_NOT_FOUND","TARGET_AMBIGUOUS","TARGET_NOT_ACTIONABLE","WAIT_TIMEOUT","UI_STATE_CHANGED","ACTION_FAILED"] + }, + "elementRef": {"type":"string"}, + "message": {"type":"string"}, + "recoveryHint": {"type":"string"}, + "snapshotAgeMs": {"minimum":0,"type":"integer"}, + "timeoutMs": {"minimum":0,"type":"integer"} + }, + "required": ["code","message","recoveryHint"], + "type": "object" + }, + "runtimeActionHint": { + "additionalProperties": false, + "properties": { + "action": {"$ref":"#/$defs/runtimeActionName"}, + "elementRef": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "label": {"type":"string"} + }, + "required": ["action","elementRef"], + "type": "object" + }, + "runtimeActionName": { + "enum": ["tap","typeText","longPress","touch","swipeWithin"] + }, + "runtimeElement": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionName"}, + "type": "array" + }, + "frame": {"$ref":"#/$defs/frame"}, + "identifier": {"type":"string"}, + "label": {"type":"string"}, + "ref": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "role": {"$ref":"#/$defs/runtimeElementRole"}, + "state": {"$ref":"#/$defs/runtimeElementState"}, + "value": {"type":"string"} + }, + "required": ["ref","frame","actions"], + "type": "object" + }, + "runtimeElementRole": { + "enum": ["application","button","cell","image","keyboard-key","list","menu","other","scroll-view","slider","switch","tab","text","text-field","window"] + }, + "runtimeElementState": { + "additionalProperties": false, + "properties": { + "enabled": {"type":"boolean"}, + "focused": {"type":"boolean"}, + "selected": {"type":"boolean"}, + "visible": {"type":"boolean"} + }, + "type": "object" + }, + "runtimeSnapshot": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionHint"}, + "type": "array" + }, + "capturedAtMs": {"minimum":0,"type":"integer"}, + "elements": { + "items": {"$ref":"#/$defs/runtimeElement"}, + "type": "array" + }, + "expiresAtMs": {"minimum":0,"type":"integer"}, + "protocol": {"const":"rs/1"}, + "screenHash": {"minLength":1,"type":"string"}, + "seq": {"minimum":0,"type":"integer"}, + "simulatorId": {"type":"string"}, + "type": {"const":"runtime-snapshot"} + }, + "required": ["type","protocol","simulatorId","screenHash","seq","capturedAtMs","expiresAtMs","elements","actions"], + "type": "object" + }, + "runtimeSnapshotUnchanged": { + "additionalProperties": false, + "properties": { + "protocol": {"const":"rs/1"}, + "screenHash": {"minLength":1,"type":"string"}, + "seq": {"minimum":0,"type":"integer"}, + "simulatorId": {"type":"string"}, + "type": {"const":"runtime-snapshot-unchanged"} + }, + "required": ["type","protocol","simulatorId","screenHash","seq"], + "type": "object" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + }, + "uiHierarchyCapture": { + "additionalProperties": false, + "properties": { + "type": {"const":"ui-hierarchy"}, + "uiHierarchy": { + "items": {"$ref":"#/$defs/uiHierarchyNode"}, + "type": "array" + } + }, + "required": ["type","uiHierarchy"], + "type": "object" + }, + "uiHierarchyNode": {"type":"object"}, + "videoRecordingCapture": { + "additionalProperties": false, + "properties": { + "fps": {"minimum":1,"type":"integer"}, + "outputFile": {"type":"string"}, + "sessionId": {"type":"string"}, + "state": { + "enum": ["started","stopped"] + }, + "type": {"const":"video-recording"} + }, + "required": ["type","state"], + "type": "object" + }, + "waitMatch": { + "additionalProperties": false, + "properties": { + "matches": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "predicate": {"$ref":"#/$defs/waitPredicate"} + }, + "required": ["predicate","matches"], + "type": "object" + }, + "waitPredicate": { + "enum": ["exists","gone","enabled","focused","textContains","settled"] + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.capture-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "screenshotPath": {"type":"string"}, + "simulatorId": {"type":"string"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "capture": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "format": {"type":"string"}, + "height": {"minimum":0,"type":"integer"}, + "width": {"minimum":0,"type":"integer"} + }, + "required": ["format","width","height"], + "type": "object" + }, + {"$ref":"#/$defs/uiHierarchyCapture"}, + {"$ref":"#/$defs/runtimeSnapshot"}, + {"$ref":"#/$defs/compactRuntimeSnapshot"}, + {"$ref":"#/$defs/videoRecordingCapture"}, + {"$ref":"#/$defs/runtimeSnapshotUnchanged"}, + {"$ref":"#/$defs/compactRuntimeSnapshotUnchanged"} + ] + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"}, + "uiError": {"$ref":"#/$defs/recoverableUiError"}, + "waitMatch": {"$ref":"#/$defs/waitMatch"} + }, + "required": ["summary","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.capture-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/reset_sim_location.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/reset_sim_location.json new file mode 100644 index 000000000..ac19dc72f --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/reset_sim_location.json @@ -0,0 +1,257 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Reset Simulator Location"}, + "description": "Reset sim location.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "simulatorId": { + "description": "UUID of the simulator to use (obtained from list_simulators)", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + } + }, + "required": ["simulatorId"], + "type": "object" + }, + "name": "reset_sim_location", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.simulator-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "type": {"const":"boot"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"erase"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"open"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"reset-location"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "coordinates": { + "additionalProperties": false, + "properties": { + "latitude": {"maximum":90,"minimum":-90,"type":"number"}, + "longitude": {"maximum":180,"minimum":-180,"type":"number"} + }, + "required": ["latitude","longitude"], + "type": "object" + }, + "type": {"const":"set-location"} + }, + "required": ["type","coordinates"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "appearance": {"type":"string"}, + "type": {"const":"set-appearance"} + }, + "required": ["type","appearance"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "dataNetwork": {"type":"string"}, + "type": {"const":"statusbar"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-software-keyboard"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-connect-hardware-keyboard"} + }, + "required": ["type"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","action"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.simulator-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/scaffold_ios_project.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/scaffold_ios_project.json new file mode 100644 index 000000000..90a106f8d --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/scaffold_ios_project.json @@ -0,0 +1,196 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Scaffold iOS Project"}, + "description": "Scaffold iOS project.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "bundleIdentifier": {"type":"string"}, + "currentProjectVersion": {"type":"string"}, + "customizeNames": {"default":true,"type":"boolean"}, + "deploymentTarget": {"type":"string"}, + "displayName": {"type":"string"}, + "marketingVersion": {"type":"string"}, + "outputPath": {"type":"string"}, + "projectName": {"minLength":1,"type":"string"}, + "supportedOrientations": { + "items": { + "enum": ["portrait","landscape-left","landscape-right","portrait-upside-down"], + "type": "string" + }, + "type": "array" + }, + "supportedOrientationsIpad": { + "items": { + "enum": ["portrait","landscape-left","landscape-right","portrait-upside-down"], + "type": "string" + }, + "type": "array" + }, + "targetedDeviceFamily": { + "items": { + "enum": ["iphone","ipad","universal"], + "type": "string" + }, + "type": "array" + } + }, + "required": ["projectName","outputPath"], + "type": "object" + }, + "name": "scaffold_ios_project", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.scaffold-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "outputPath": {"type":"string"}, + "projectName": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "required": ["projectName","outputPath"], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": { + "additionalProperties": false, + "properties": { + "platform": { + "enum": ["iOS","macOS"] + }, + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status","platform"], + "type": "object" + } + }, + "required": ["summary","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.scaffold-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/scaffold_macos_project.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/scaffold_macos_project.json new file mode 100644 index 000000000..7d5754dc3 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/scaffold_macos_project.json @@ -0,0 +1,175 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Scaffold macOS Project"}, + "description": "Scaffold macOS project.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "bundleIdentifier": {"type":"string"}, + "currentProjectVersion": {"type":"string"}, + "customizeNames": {"default":true,"type":"boolean"}, + "deploymentTarget": {"type":"string"}, + "displayName": {"type":"string"}, + "marketingVersion": {"type":"string"}, + "outputPath": {"type":"string"}, + "projectName": {"minLength":1,"type":"string"} + }, + "required": ["projectName","outputPath"], + "type": "object" + }, + "name": "scaffold_macos_project", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.scaffold-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "outputPath": {"type":"string"}, + "projectName": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "required": ["projectName","outputPath"], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": { + "additionalProperties": false, + "properties": { + "platform": { + "enum": ["iOS","macOS"] + }, + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status","platform"], + "type": "object" + } + }, + "required": ["summary","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.scaffold-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/screenshot.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/screenshot.json new file mode 100644 index 000000000..5fffff72d --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/screenshot.json @@ -0,0 +1,395 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Screenshot"}, + "description": "Capture screenshot.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "returnFormat": { + "description": "Return image path or base64 data (path|base64)", + "enum": ["path","base64"], + "type": "string" + }, + "simulatorId": {"format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","type":"string"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "name": "screenshot", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "compactRuntimeSnapshot": { + "additionalProperties": false, + "properties": { + "count": {"minimum":0,"type":"integer"}, + "evidence": { + "description": "Non-actionable semantic evidence rows in role|label|value|identifier format. These rows intentionally omit element refs.", + "items": {"type":"string"}, + "type": "array" + }, + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "scroll": { + "items": {"type":"string"}, + "type": "array" + }, + "seq": {"minimum":0,"type":"integer"}, + "targets": { + "items": {"type":"string"}, + "type": "array" + }, + "text": { + "items": {"type":"string"}, + "type": "array" + }, + "type": {"const":"runtime-snapshot"}, + "udid": {"type":"string"} + }, + "required": ["type","rs","screenHash","seq","count","targets","scroll","udid"], + "type": "object" + }, + "compactRuntimeSnapshotUnchanged": { + "additionalProperties": false, + "properties": { + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "seq": {"minimum":0,"type":"integer"}, + "type": {"const":"runtime-snapshot-unchanged"}, + "udid": {"type":"string"}, + "unchanged": {"const":true} + }, + "required": ["type","rs","screenHash","seq","unchanged","udid"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "frame": { + "additionalProperties": false, + "properties": { + "height": {"type":"number"}, + "width": {"type":"number"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y","width","height"], + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "recoverableUiError": { + "additionalProperties": false, + "properties": { + "candidates": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "code": { + "enum": ["SNAPSHOT_MISSING","SNAPSHOT_EXPIRED","SNAPSHOT_PARSE_FAILED","SNAPSHOT_CAPTURE_FAILED","ELEMENT_REF_NOT_FOUND","TARGET_NOT_FOUND","TARGET_AMBIGUOUS","TARGET_NOT_ACTIONABLE","WAIT_TIMEOUT","UI_STATE_CHANGED","ACTION_FAILED"] + }, + "elementRef": {"type":"string"}, + "message": {"type":"string"}, + "recoveryHint": {"type":"string"}, + "snapshotAgeMs": {"minimum":0,"type":"integer"}, + "timeoutMs": {"minimum":0,"type":"integer"} + }, + "required": ["code","message","recoveryHint"], + "type": "object" + }, + "runtimeActionHint": { + "additionalProperties": false, + "properties": { + "action": {"$ref":"#/$defs/runtimeActionName"}, + "elementRef": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "label": {"type":"string"} + }, + "required": ["action","elementRef"], + "type": "object" + }, + "runtimeActionName": { + "enum": ["tap","typeText","longPress","touch","swipeWithin"] + }, + "runtimeElement": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionName"}, + "type": "array" + }, + "frame": {"$ref":"#/$defs/frame"}, + "identifier": {"type":"string"}, + "label": {"type":"string"}, + "ref": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "role": {"$ref":"#/$defs/runtimeElementRole"}, + "state": {"$ref":"#/$defs/runtimeElementState"}, + "value": {"type":"string"} + }, + "required": ["ref","frame","actions"], + "type": "object" + }, + "runtimeElementRole": { + "enum": ["application","button","cell","image","keyboard-key","list","menu","other","scroll-view","slider","switch","tab","text","text-field","window"] + }, + "runtimeElementState": { + "additionalProperties": false, + "properties": { + "enabled": {"type":"boolean"}, + "focused": {"type":"boolean"}, + "selected": {"type":"boolean"}, + "visible": {"type":"boolean"} + }, + "type": "object" + }, + "runtimeSnapshot": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionHint"}, + "type": "array" + }, + "capturedAtMs": {"minimum":0,"type":"integer"}, + "elements": { + "items": {"$ref":"#/$defs/runtimeElement"}, + "type": "array" + }, + "expiresAtMs": {"minimum":0,"type":"integer"}, + "protocol": {"const":"rs/1"}, + "screenHash": {"minLength":1,"type":"string"}, + "seq": {"minimum":0,"type":"integer"}, + "simulatorId": {"type":"string"}, + "type": {"const":"runtime-snapshot"} + }, + "required": ["type","protocol","simulatorId","screenHash","seq","capturedAtMs","expiresAtMs","elements","actions"], + "type": "object" + }, + "runtimeSnapshotUnchanged": { + "additionalProperties": false, + "properties": { + "protocol": {"const":"rs/1"}, + "screenHash": {"minLength":1,"type":"string"}, + "seq": {"minimum":0,"type":"integer"}, + "simulatorId": {"type":"string"}, + "type": {"const":"runtime-snapshot-unchanged"} + }, + "required": ["type","protocol","simulatorId","screenHash","seq"], + "type": "object" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + }, + "uiHierarchyCapture": { + "additionalProperties": false, + "properties": { + "type": {"const":"ui-hierarchy"}, + "uiHierarchy": { + "items": {"$ref":"#/$defs/uiHierarchyNode"}, + "type": "array" + } + }, + "required": ["type","uiHierarchy"], + "type": "object" + }, + "uiHierarchyNode": {"type":"object"}, + "videoRecordingCapture": { + "additionalProperties": false, + "properties": { + "fps": {"minimum":1,"type":"integer"}, + "outputFile": {"type":"string"}, + "sessionId": {"type":"string"}, + "state": { + "enum": ["started","stopped"] + }, + "type": {"const":"video-recording"} + }, + "required": ["type","state"], + "type": "object" + }, + "waitMatch": { + "additionalProperties": false, + "properties": { + "matches": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "predicate": {"$ref":"#/$defs/waitPredicate"} + }, + "required": ["predicate","matches"], + "type": "object" + }, + "waitPredicate": { + "enum": ["exists","gone","enabled","focused","textContains","settled"] + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.capture-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "screenshotPath": {"type":"string"}, + "simulatorId": {"type":"string"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "capture": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "format": {"type":"string"}, + "height": {"minimum":0,"type":"integer"}, + "width": {"minimum":0,"type":"integer"} + }, + "required": ["format","width","height"], + "type": "object" + }, + {"$ref":"#/$defs/uiHierarchyCapture"}, + {"$ref":"#/$defs/runtimeSnapshot"}, + {"$ref":"#/$defs/compactRuntimeSnapshot"}, + {"$ref":"#/$defs/videoRecordingCapture"}, + {"$ref":"#/$defs/runtimeSnapshotUnchanged"}, + {"$ref":"#/$defs/compactRuntimeSnapshotUnchanged"} + ] + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"}, + "uiError": {"$ref":"#/$defs/recoverableUiError"}, + "waitMatch": {"$ref":"#/$defs/waitMatch"} + }, + "required": ["summary","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.capture-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/session_clear_defaults.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/session_clear_defaults.json new file mode 100644 index 000000000..11a55da8b --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/session_clear_defaults.json @@ -0,0 +1,268 @@ +{ + "annotations": {"destructiveHint":true,"openWorldHint":false,"readOnlyHint":false,"title":"Clear Session Defaults"}, + "description": "Clear session defaults for the active profile or a specified profile.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "all": {"description":"Clear all defaults across global and named profiles. Cannot be combined with keys/profile.","type":"boolean"}, + "keys": { + "items": { + "enum": ["projectPath","workspacePath","scheme","configuration","simulatorName","simulatorId","simulatorPlatform","deviceId","useLatestOS","arch","suppressWarnings","derivedDataPath","preferXcodebuild","platform","bundleId","env","extraArgs"], + "type": "string" + }, + "type": "array" + }, + "profile": {"description":"Clear defaults for this named profile instead of the active profile.","minLength":1,"type":"string"} + }, + "type": "object" + }, + "name": "session_clear_defaults", + "outputSchema": { + "$defs": { + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "sessionDefaultsOperation": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "type": {"const":"show"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"sync-xcode"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "activatedProfile": {"type":"string"}, + "changedKeys": { + "items": {"type":"string"}, + "type": "array" + }, + "notices": { + "items": {"type":"string"}, + "type": "array" + }, + "persisted": {"type":"boolean"}, + "type": {"const":"set"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "clearedKeys": { + "items": {"type":"string"}, + "type": "array" + }, + "profile": {"type":"string"}, + "scope": { + "enum": ["all","profile","current"] + }, + "type": {"const":"clear"} + }, + "required": ["type","scope"], + "type": "object" + } + ] + }, + "sessionDefaultsProfile": { + "additionalProperties": false, + "properties": { + "arch": { + "anyOf": [ + {"const":null}, + { + "enum": ["arm64","x86_64"] + } + ] + }, + "bundleId": { + "type": ["string","null"] + }, + "configuration": { + "type": ["string","null"] + }, + "derivedDataPath": { + "type": ["string","null"] + }, + "deviceId": { + "type": ["string","null"] + }, + "env": { + "anyOf": [ + {"const":null}, + { + "additionalProperties": {"type":"string"}, + "propertyNames": {"minLength":1,"type":"string"}, + "type": "object" + } + ] + }, + "extraArgs": { + "anyOf": [ + {"const":null}, + { + "items": {"type":"string"}, + "type": "array" + } + ] + }, + "platform": { + "type": ["string","null"] + }, + "preferXcodebuild": { + "type": ["boolean","null"] + }, + "projectPath": { + "type": ["string","null"] + }, + "scheme": { + "type": ["string","null"] + }, + "simulatorId": { + "type": ["string","null"] + }, + "simulatorName": { + "type": ["string","null"] + }, + "simulatorPlatform": { + "anyOf": [ + {"const":null}, + { + "enum": ["iOS Simulator","watchOS Simulator","tvOS Simulator","visionOS Simulator"] + } + ] + }, + "suppressWarnings": { + "type": ["boolean","null"] + }, + "useLatestOS": { + "type": ["boolean","null"] + }, + "workspacePath": { + "type": ["string","null"] + } + }, + "required": ["projectPath","workspacePath","scheme","configuration","simulatorName","simulatorId","simulatorPlatform","deviceId","useLatestOS","arch","suppressWarnings","derivedDataPath","preferXcodebuild","platform","bundleId","env"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.session-defaults/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "currentProfile": {"type":"string"}, + "operation": {"$ref":"#/$defs/sessionDefaultsOperation"}, + "profiles": { + "additionalProperties": {"$ref":"#/$defs/sessionDefaultsProfile"}, + "properties": { + "(default)": {"$ref":"#/$defs/sessionDefaultsProfile"} + }, + "required": ["(default)"], + "type": "object" + } + }, + "required": ["currentProfile","profiles"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.session-defaults"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/session_set_defaults.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/session_set_defaults.json new file mode 100644 index 000000000..e658e9e43 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/session_set_defaults.json @@ -0,0 +1,302 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Set Session Defaults"}, + "description": "Set session defaults for the active profile, or for a specified profile and make it active.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "arch": { + "enum": ["arm64","x86_64"], + "type": "string" + }, + "bundleId": {"description":"Default bundle ID for launch/stop/log tools when working on a single app.","minLength":1,"type":"string"}, + "configuration": {"description":"Build configuration for Xcode and SwiftPM tools (e.g. 'Debug' or 'Release').","minLength":1,"type":"string"}, + "createIfNotExists": {"default":false,"description":"Create the named profile if it does not exist. Defaults to false.","type":"boolean"}, + "derivedDataPath": {"description":"Default DerivedData path for Xcode build/test/clean tools.","minLength":1,"type":"string"}, + "deviceId": {"minLength":1,"type":"string"}, + "env": { + "description": "Default environment variables to pass to launched apps as key-value entries", + "items": { + "additionalProperties": false, + "properties": { + "key": {"minLength":1,"type":"string"}, + "value": {"type":"string"} + }, + "required": ["key","value"], + "type": "object" + }, + "type": "array" + }, + "extraArgs": { + "description": "Default extra xcodebuild arguments for tools that accept extraArgs.", + "items": {"type":"string"}, + "type": "array" + }, + "persist": {"description":"Persist provided defaults to .xcodebuildmcp/config.yaml","type":"boolean"}, + "platform": {"description":"Default device platform for device tools (e.g. iOS, watchOS).","minLength":1,"type":"string"}, + "preferXcodebuild": {"description":"Prefer xcodebuild over incremental builds for Xcode build/test/clean tools.","type":"boolean"}, + "profile": {"description":"Set defaults for this named profile and make it active for the current session.","minLength":1,"type":"string"}, + "projectPath": {"description":"xcodeproj path (xor workspacePath)","minLength":1,"type":"string"}, + "scheme": {"minLength":1,"type":"string"}, + "simulatorId": {"description":"Machine-local simulator UDID, materialized from simulatorName when one is set; UDIDs are not portable across machines.","minLength":1,"type":"string"}, + "simulatorName": {"description":"Canonical, machine-portable simulator selector (safe to share via SCM); the background refresh re-resolves it to this machine’s UDID.","minLength":1,"type":"string"}, + "simulatorPlatform": { + "description": "Cached platform derived from the selected simulator’s runtime; must be cleared/recomputed whenever the simulator selector changes.", + "enum": ["iOS Simulator","watchOS Simulator","tvOS Simulator","visionOS Simulator"], + "type": "string" + }, + "suppressWarnings": {"type":"boolean"}, + "useLatestOS": {"type":"boolean"}, + "workspacePath": {"description":"xcworkspace path (xor projectPath)","minLength":1,"type":"string"} + }, + "type": "object" + }, + "name": "session_set_defaults", + "outputSchema": { + "$defs": { + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "sessionDefaultsOperation": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "type": {"const":"show"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"sync-xcode"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "activatedProfile": {"type":"string"}, + "changedKeys": { + "items": {"type":"string"}, + "type": "array" + }, + "notices": { + "items": {"type":"string"}, + "type": "array" + }, + "persisted": {"type":"boolean"}, + "type": {"const":"set"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "clearedKeys": { + "items": {"type":"string"}, + "type": "array" + }, + "profile": {"type":"string"}, + "scope": { + "enum": ["all","profile","current"] + }, + "type": {"const":"clear"} + }, + "required": ["type","scope"], + "type": "object" + } + ] + }, + "sessionDefaultsProfile": { + "additionalProperties": false, + "properties": { + "arch": { + "anyOf": [ + {"const":null}, + { + "enum": ["arm64","x86_64"] + } + ] + }, + "bundleId": { + "type": ["string","null"] + }, + "configuration": { + "type": ["string","null"] + }, + "derivedDataPath": { + "type": ["string","null"] + }, + "deviceId": { + "type": ["string","null"] + }, + "env": { + "anyOf": [ + {"const":null}, + { + "additionalProperties": {"type":"string"}, + "propertyNames": {"minLength":1,"type":"string"}, + "type": "object" + } + ] + }, + "extraArgs": { + "anyOf": [ + {"const":null}, + { + "items": {"type":"string"}, + "type": "array" + } + ] + }, + "platform": { + "type": ["string","null"] + }, + "preferXcodebuild": { + "type": ["boolean","null"] + }, + "projectPath": { + "type": ["string","null"] + }, + "scheme": { + "type": ["string","null"] + }, + "simulatorId": { + "type": ["string","null"] + }, + "simulatorName": { + "type": ["string","null"] + }, + "simulatorPlatform": { + "anyOf": [ + {"const":null}, + { + "enum": ["iOS Simulator","watchOS Simulator","tvOS Simulator","visionOS Simulator"] + } + ] + }, + "suppressWarnings": { + "type": ["boolean","null"] + }, + "useLatestOS": { + "type": ["boolean","null"] + }, + "workspacePath": { + "type": ["string","null"] + } + }, + "required": ["projectPath","workspacePath","scheme","configuration","simulatorName","simulatorId","simulatorPlatform","deviceId","useLatestOS","arch","suppressWarnings","derivedDataPath","preferXcodebuild","platform","bundleId","env"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.session-defaults/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "currentProfile": {"type":"string"}, + "operation": {"$ref":"#/$defs/sessionDefaultsOperation"}, + "profiles": { + "additionalProperties": {"$ref":"#/$defs/sessionDefaultsProfile"}, + "properties": { + "(default)": {"$ref":"#/$defs/sessionDefaultsProfile"} + }, + "required": ["(default)"], + "type": "object" + } + }, + "required": ["currentProfile","profiles"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.session-defaults"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/session_show_defaults.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/session_show_defaults.json new file mode 100644 index 000000000..dad883fd2 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/session_show_defaults.json @@ -0,0 +1,258 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Show Session Defaults"}, + "description": "Show current active defaults. Required before your first build/run/test call in a session — do not assume defaults are configured.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": {}, + "type": "object" + }, + "name": "session_show_defaults", + "outputSchema": { + "$defs": { + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "sessionDefaultsOperation": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "type": {"const":"show"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"sync-xcode"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "activatedProfile": {"type":"string"}, + "changedKeys": { + "items": {"type":"string"}, + "type": "array" + }, + "notices": { + "items": {"type":"string"}, + "type": "array" + }, + "persisted": {"type":"boolean"}, + "type": {"const":"set"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "clearedKeys": { + "items": {"type":"string"}, + "type": "array" + }, + "profile": {"type":"string"}, + "scope": { + "enum": ["all","profile","current"] + }, + "type": {"const":"clear"} + }, + "required": ["type","scope"], + "type": "object" + } + ] + }, + "sessionDefaultsProfile": { + "additionalProperties": false, + "properties": { + "arch": { + "anyOf": [ + {"const":null}, + { + "enum": ["arm64","x86_64"] + } + ] + }, + "bundleId": { + "type": ["string","null"] + }, + "configuration": { + "type": ["string","null"] + }, + "derivedDataPath": { + "type": ["string","null"] + }, + "deviceId": { + "type": ["string","null"] + }, + "env": { + "anyOf": [ + {"const":null}, + { + "additionalProperties": {"type":"string"}, + "propertyNames": {"minLength":1,"type":"string"}, + "type": "object" + } + ] + }, + "extraArgs": { + "anyOf": [ + {"const":null}, + { + "items": {"type":"string"}, + "type": "array" + } + ] + }, + "platform": { + "type": ["string","null"] + }, + "preferXcodebuild": { + "type": ["boolean","null"] + }, + "projectPath": { + "type": ["string","null"] + }, + "scheme": { + "type": ["string","null"] + }, + "simulatorId": { + "type": ["string","null"] + }, + "simulatorName": { + "type": ["string","null"] + }, + "simulatorPlatform": { + "anyOf": [ + {"const":null}, + { + "enum": ["iOS Simulator","watchOS Simulator","tvOS Simulator","visionOS Simulator"] + } + ] + }, + "suppressWarnings": { + "type": ["boolean","null"] + }, + "useLatestOS": { + "type": ["boolean","null"] + }, + "workspacePath": { + "type": ["string","null"] + } + }, + "required": ["projectPath","workspacePath","scheme","configuration","simulatorName","simulatorId","simulatorPlatform","deviceId","useLatestOS","arch","suppressWarnings","derivedDataPath","preferXcodebuild","platform","bundleId","env"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.session-defaults/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "currentProfile": {"type":"string"}, + "operation": {"$ref":"#/$defs/sessionDefaultsOperation"}, + "profiles": { + "additionalProperties": {"$ref":"#/$defs/sessionDefaultsProfile"}, + "properties": { + "(default)": {"$ref":"#/$defs/sessionDefaultsProfile"} + }, + "required": ["(default)"], + "type": "object" + } + }, + "required": ["currentProfile","profiles"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.session-defaults"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/session_use_defaults_profile.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/session_use_defaults_profile.json new file mode 100644 index 000000000..79bb51f4e --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/session_use_defaults_profile.json @@ -0,0 +1,120 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Use Session Defaults Profile"}, + "description": "Switch the active session defaults profile.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "global": {"description":"Activate the global unnamed defaults profile.","type":"boolean"}, + "persist": {"description":"Persist activeSessionDefaultsProfile to .xcodebuildmcp/config.yaml.","type":"boolean"}, + "profile": {"description":"Activate a named session defaults profile (example: ios or watch).","minLength":1,"type":"string"} + }, + "type": "object" + }, + "name": "session_use_defaults_profile", + "outputSchema": { + "$defs": { + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.session-profile/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "currentProfile": {"type":"string"}, + "persisted": {"type":"boolean"}, + "previousProfile": {"type":"string"} + }, + "required": ["previousProfile","currentProfile"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.session-profile"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/set_sim_appearance.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/set_sim_appearance.json new file mode 100644 index 000000000..bf883fb1f --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/set_sim_appearance.json @@ -0,0 +1,262 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Set Simulator Appearance"}, + "description": "Set sim appearance.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "mode": { + "description": "dark|light", + "enum": ["dark","light"], + "type": "string" + }, + "simulatorId": { + "description": "UUID of the simulator to use (obtained from list_simulators)", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + } + }, + "required": ["simulatorId","mode"], + "type": "object" + }, + "name": "set_sim_appearance", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.simulator-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "type": {"const":"boot"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"erase"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"open"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"reset-location"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "coordinates": { + "additionalProperties": false, + "properties": { + "latitude": {"maximum":90,"minimum":-90,"type":"number"}, + "longitude": {"maximum":180,"minimum":-180,"type":"number"} + }, + "required": ["latitude","longitude"], + "type": "object" + }, + "type": {"const":"set-location"} + }, + "required": ["type","coordinates"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "appearance": {"type":"string"}, + "type": {"const":"set-appearance"} + }, + "required": ["type","appearance"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "dataNetwork": {"type":"string"}, + "type": {"const":"statusbar"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-software-keyboard"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-connect-hardware-keyboard"} + }, + "required": ["type"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","action"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.simulator-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/set_sim_location.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/set_sim_location.json new file mode 100644 index 000000000..23ed8834c --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/set_sim_location.json @@ -0,0 +1,259 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Set Simulator Location"}, + "description": "Set sim location.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "latitude": {"type":"number"}, + "longitude": {"type":"number"}, + "simulatorId": { + "description": "UUID of the simulator to use (obtained from list_simulators)", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + } + }, + "required": ["simulatorId","latitude","longitude"], + "type": "object" + }, + "name": "set_sim_location", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.simulator-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "type": {"const":"boot"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"erase"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"open"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"reset-location"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "coordinates": { + "additionalProperties": false, + "properties": { + "latitude": {"maximum":90,"minimum":-90,"type":"number"}, + "longitude": {"maximum":180,"minimum":-180,"type":"number"} + }, + "required": ["latitude","longitude"], + "type": "object" + }, + "type": {"const":"set-location"} + }, + "required": ["type","coordinates"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "appearance": {"type":"string"}, + "type": {"const":"set-appearance"} + }, + "required": ["type","appearance"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "dataNetwork": {"type":"string"}, + "type": {"const":"statusbar"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-software-keyboard"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-connect-hardware-keyboard"} + }, + "required": ["type"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","action"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.simulator-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/show_build_settings.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/show_build_settings.json new file mode 100644 index 000000000..c4590b0dd --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/show_build_settings.json @@ -0,0 +1,169 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Show Build Settings"}, + "description": "Show build settings.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "projectPath": {"description":"Path to the .xcodeproj file","type":"string"}, + "scheme": {"description":"Scheme name to show build settings for (Required)","type":"string"}, + "workspacePath": {"description":"Path to the .xcworkspace file","type":"string"} + }, + "required": ["scheme"], + "type": "object" + }, + "name": "show_build_settings", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "orderedEntry": { + "additionalProperties": false, + "properties": { + "key": {"type":"string"}, + "value": {"type":"string"} + }, + "required": ["key","value"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.build-settings/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "scheme": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "required": ["workspacePath","scheme"], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "entries": { + "items": {"$ref":"#/$defs/orderedEntry"}, + "type": "array" + } + }, + "required": ["artifacts","entries"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.build-settings"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/sim_statusbar.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/sim_statusbar.json new file mode 100644 index 000000000..c2ac3cc3f --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/sim_statusbar.json @@ -0,0 +1,262 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Simulator Statusbar"}, + "description": "Set sim status bar network.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "dataNetwork": { + "description": "clear|hide|wifi|3g|4g|lte|lte-a|lte+|5g|5g+|5g-uwb|5g-uc", + "enum": ["clear","hide","wifi","3g","4g","lte","lte-a","lte+","5g","5g+","5g-uwb","5g-uc"], + "type": "string" + }, + "simulatorId": { + "description": "UUID of the simulator to use (obtained from list_simulators)", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + } + }, + "required": ["simulatorId","dataNetwork"], + "type": "object" + }, + "name": "sim_statusbar", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.simulator-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "type": {"const":"boot"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"erase"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"open"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"reset-location"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "coordinates": { + "additionalProperties": false, + "properties": { + "latitude": {"maximum":90,"minimum":-90,"type":"number"}, + "longitude": {"maximum":180,"minimum":-180,"type":"number"} + }, + "required": ["latitude","longitude"], + "type": "object" + }, + "type": {"const":"set-location"} + }, + "required": ["type","coordinates"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "appearance": {"type":"string"}, + "type": {"const":"set-appearance"} + }, + "required": ["type","appearance"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "dataNetwork": {"type":"string"}, + "type": {"const":"statusbar"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-software-keyboard"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-connect-hardware-keyboard"} + }, + "required": ["type"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","action"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.simulator-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/snapshot_ui.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/snapshot_ui.json new file mode 100644 index 000000000..71c3ab739 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/snapshot_ui.json @@ -0,0 +1,391 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Snapshot UI"}, + "description": "Capture a semantic rs/1 runtime UI snapshot with elementRef targets. Observe once, use tap for one target or batch for multiple same-screen targets, and refresh after navigation, scrolling, sheet changes, or obvious layout changes.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "simulatorId": {"format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","type":"string"}, + "sinceScreenHash": {"description":"Return an unchanged response when the current screen hash matches this value","minLength":1,"type":"string"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "name": "snapshot_ui", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "compactRuntimeSnapshot": { + "additionalProperties": false, + "properties": { + "count": {"minimum":0,"type":"integer"}, + "evidence": { + "description": "Non-actionable semantic evidence rows in role|label|value|identifier format. These rows intentionally omit element refs.", + "items": {"type":"string"}, + "type": "array" + }, + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "scroll": { + "items": {"type":"string"}, + "type": "array" + }, + "seq": {"minimum":0,"type":"integer"}, + "targets": { + "items": {"type":"string"}, + "type": "array" + }, + "text": { + "items": {"type":"string"}, + "type": "array" + }, + "type": {"const":"runtime-snapshot"}, + "udid": {"type":"string"} + }, + "required": ["type","rs","screenHash","seq","count","targets","scroll","udid"], + "type": "object" + }, + "compactRuntimeSnapshotUnchanged": { + "additionalProperties": false, + "properties": { + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "seq": {"minimum":0,"type":"integer"}, + "type": {"const":"runtime-snapshot-unchanged"}, + "udid": {"type":"string"}, + "unchanged": {"const":true} + }, + "required": ["type","rs","screenHash","seq","unchanged","udid"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "frame": { + "additionalProperties": false, + "properties": { + "height": {"type":"number"}, + "width": {"type":"number"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y","width","height"], + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "recoverableUiError": { + "additionalProperties": false, + "properties": { + "candidates": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "code": { + "enum": ["SNAPSHOT_MISSING","SNAPSHOT_EXPIRED","SNAPSHOT_PARSE_FAILED","SNAPSHOT_CAPTURE_FAILED","ELEMENT_REF_NOT_FOUND","TARGET_NOT_FOUND","TARGET_AMBIGUOUS","TARGET_NOT_ACTIONABLE","WAIT_TIMEOUT","UI_STATE_CHANGED","ACTION_FAILED"] + }, + "elementRef": {"type":"string"}, + "message": {"type":"string"}, + "recoveryHint": {"type":"string"}, + "snapshotAgeMs": {"minimum":0,"type":"integer"}, + "timeoutMs": {"minimum":0,"type":"integer"} + }, + "required": ["code","message","recoveryHint"], + "type": "object" + }, + "runtimeActionHint": { + "additionalProperties": false, + "properties": { + "action": {"$ref":"#/$defs/runtimeActionName"}, + "elementRef": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "label": {"type":"string"} + }, + "required": ["action","elementRef"], + "type": "object" + }, + "runtimeActionName": { + "enum": ["tap","typeText","longPress","touch","swipeWithin"] + }, + "runtimeElement": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionName"}, + "type": "array" + }, + "frame": {"$ref":"#/$defs/frame"}, + "identifier": {"type":"string"}, + "label": {"type":"string"}, + "ref": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "role": {"$ref":"#/$defs/runtimeElementRole"}, + "state": {"$ref":"#/$defs/runtimeElementState"}, + "value": {"type":"string"} + }, + "required": ["ref","frame","actions"], + "type": "object" + }, + "runtimeElementRole": { + "enum": ["application","button","cell","image","keyboard-key","list","menu","other","scroll-view","slider","switch","tab","text","text-field","window"] + }, + "runtimeElementState": { + "additionalProperties": false, + "properties": { + "enabled": {"type":"boolean"}, + "focused": {"type":"boolean"}, + "selected": {"type":"boolean"}, + "visible": {"type":"boolean"} + }, + "type": "object" + }, + "runtimeSnapshot": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionHint"}, + "type": "array" + }, + "capturedAtMs": {"minimum":0,"type":"integer"}, + "elements": { + "items": {"$ref":"#/$defs/runtimeElement"}, + "type": "array" + }, + "expiresAtMs": {"minimum":0,"type":"integer"}, + "protocol": {"const":"rs/1"}, + "screenHash": {"minLength":1,"type":"string"}, + "seq": {"minimum":0,"type":"integer"}, + "simulatorId": {"type":"string"}, + "type": {"const":"runtime-snapshot"} + }, + "required": ["type","protocol","simulatorId","screenHash","seq","capturedAtMs","expiresAtMs","elements","actions"], + "type": "object" + }, + "runtimeSnapshotUnchanged": { + "additionalProperties": false, + "properties": { + "protocol": {"const":"rs/1"}, + "screenHash": {"minLength":1,"type":"string"}, + "seq": {"minimum":0,"type":"integer"}, + "simulatorId": {"type":"string"}, + "type": {"const":"runtime-snapshot-unchanged"} + }, + "required": ["type","protocol","simulatorId","screenHash","seq"], + "type": "object" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + }, + "uiHierarchyCapture": { + "additionalProperties": false, + "properties": { + "type": {"const":"ui-hierarchy"}, + "uiHierarchy": { + "items": {"$ref":"#/$defs/uiHierarchyNode"}, + "type": "array" + } + }, + "required": ["type","uiHierarchy"], + "type": "object" + }, + "uiHierarchyNode": {"type":"object"}, + "videoRecordingCapture": { + "additionalProperties": false, + "properties": { + "fps": {"minimum":1,"type":"integer"}, + "outputFile": {"type":"string"}, + "sessionId": {"type":"string"}, + "state": { + "enum": ["started","stopped"] + }, + "type": {"const":"video-recording"} + }, + "required": ["type","state"], + "type": "object" + }, + "waitMatch": { + "additionalProperties": false, + "properties": { + "matches": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "predicate": {"$ref":"#/$defs/waitPredicate"} + }, + "required": ["predicate","matches"], + "type": "object" + }, + "waitPredicate": { + "enum": ["exists","gone","enabled","focused","textContains","settled"] + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.capture-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "screenshotPath": {"type":"string"}, + "simulatorId": {"type":"string"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "capture": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "format": {"type":"string"}, + "height": {"minimum":0,"type":"integer"}, + "width": {"minimum":0,"type":"integer"} + }, + "required": ["format","width","height"], + "type": "object" + }, + {"$ref":"#/$defs/uiHierarchyCapture"}, + {"$ref":"#/$defs/runtimeSnapshot"}, + {"$ref":"#/$defs/compactRuntimeSnapshot"}, + {"$ref":"#/$defs/videoRecordingCapture"}, + {"$ref":"#/$defs/runtimeSnapshotUnchanged"}, + {"$ref":"#/$defs/compactRuntimeSnapshotUnchanged"} + ] + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"}, + "uiError": {"$ref":"#/$defs/recoverableUiError"}, + "waitMatch": {"$ref":"#/$defs/waitMatch"} + }, + "required": ["summary","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.capture-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/stop_app_device.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/stop_app_device.json new file mode 100644 index 000000000..f6a330b90 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/stop_app_device.json @@ -0,0 +1,170 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Stop App Device"}, + "description": "Stop device app.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "deviceId": {"description":"UDID of the device (obtained from list_devices)","type":"string"}, + "processId": {"type":"number"} + }, + "required": ["deviceId","processId"], + "type": "object" + }, + "name": "stop_app_device", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.stop-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appName": {"type":"string"}, + "bundleId": {"type":"string"}, + "deviceId": {"type":"string"}, + "processId": {"minimum":1,"type":"integer"}, + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.stop-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/stop_app_sim.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/stop_app_sim.json new file mode 100644 index 000000000..7449867cb --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/stop_app_sim.json @@ -0,0 +1,171 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Stop App Simulator"}, + "description": "Stop sim app.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "bundleId": {"description":"Bundle identifier of the app to stop","type":"string"}, + "simulatorId": {"description":"UUID of the simulator to use (obtained from list_sims). Provide EITHER this OR simulatorName, not both","type":"string"}, + "simulatorName": {"description":"Name of the simulator (e.g., 'iPhone 17'). Provide EITHER this OR simulatorId, not both","type":"string"} + }, + "required": ["bundleId"], + "type": "object" + }, + "name": "stop_app_sim", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.stop-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appName": {"type":"string"}, + "bundleId": {"type":"string"}, + "deviceId": {"type":"string"}, + "processId": {"minimum":1,"type":"integer"}, + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.stop-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/stop_mac_app.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/stop_mac_app.json new file mode 100644 index 000000000..009a782e5 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/stop_mac_app.json @@ -0,0 +1,169 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Stop macOS App"}, + "description": "Stop macOS app.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "appName": {"minLength":1,"type":"string"}, + "processId": {"exclusiveMinimum":0,"maximum":9007199254740991,"type":"integer"} + }, + "type": "object" + }, + "name": "stop_mac_app", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.stop-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appName": {"type":"string"}, + "bundleId": {"type":"string"}, + "deviceId": {"type":"string"}, + "processId": {"minimum":1,"type":"integer"}, + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.stop-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/swift_package_build.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/swift_package_build.json new file mode 100644 index 000000000..d384e5ebe --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/swift_package_build.json @@ -0,0 +1,221 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Swift Package Build"}, + "description": "swift package target build.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "architectures": { + "items": {"type":"string"}, + "type": "array" + }, + "configuration": { + "enum": ["debug","release","Debug","Release"], + "type": "string" + }, + "packagePath": {"type":"string"}, + "parseAsLibrary": {"type":"boolean"}, + "targetName": {"type":"string"} + }, + "required": ["packagePath"], + "type": "object" + }, + "name": "swift_package_build", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "buildInvocationRequest": { + "additionalProperties": false, + "properties": { + "arch": {"type":"string"}, + "configuration": {"type":"string"}, + "derivedDataPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "executableName": {"type":"string"}, + "onlyTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulatorId": {"type":"string"}, + "simulatorName": {"type":"string"}, + "skipTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + }, + "targetName": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.build-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "anyOf": [ + { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appPath": {"type":"string"}, + "buildLogPath": {"type":"string"}, + "bundleId": {"type":"string"}, + "configuration": {"type":"string"}, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "scheme": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "request": {"$ref":"#/$defs/buildInvocationRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + {"type":"null"} + ] + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.build-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/swift_package_clean.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/swift_package_clean.json new file mode 100644 index 000000000..6fc670d33 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/swift_package_clean.json @@ -0,0 +1,211 @@ +{ + "annotations": {"destructiveHint":true,"openWorldHint":false,"readOnlyHint":false,"title":"Swift Package Clean"}, + "description": "swift package clean.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "packagePath": {"type":"string"} + }, + "required": ["packagePath"], + "type": "object" + }, + "name": "swift_package_clean", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "buildInvocationRequest": { + "additionalProperties": false, + "properties": { + "arch": {"type":"string"}, + "configuration": {"type":"string"}, + "derivedDataPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "executableName": {"type":"string"}, + "onlyTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulatorId": {"type":"string"}, + "simulatorName": {"type":"string"}, + "skipTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + }, + "targetName": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.build-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "anyOf": [ + { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appPath": {"type":"string"}, + "buildLogPath": {"type":"string"}, + "bundleId": {"type":"string"}, + "configuration": {"type":"string"}, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "scheme": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "request": {"$ref":"#/$defs/buildInvocationRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + {"type":"null"} + ] + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.build-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/swift_package_list.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/swift_package_list.json new file mode 100644 index 000000000..dc2d15949 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/swift_package_list.json @@ -0,0 +1,143 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Swift Package List"}, + "description": "List SwiftPM processes.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": {}, + "type": "object" + }, + "name": "swift_package_list", + "outputSchema": { + "$defs": { + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.process-list/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "processes": { + "items": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "packagePath": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "name": {"type":"string"}, + "processId": {"minimum":1,"type":"integer"}, + "uptimeSeconds": {"minimum":0,"type":"integer"} + }, + "required": ["name","processId","uptimeSeconds"], + "type": "object" + }, + "type": "array" + }, + "summary": { + "additionalProperties": false, + "properties": { + "runningProcessCount": {"minimum":0,"type":"integer"} + }, + "required": ["runningProcessCount"], + "type": "object" + } + }, + "required": ["summary","processes"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.process-list"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/swift_package_run.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/swift_package_run.json new file mode 100644 index 000000000..e41156a81 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/swift_package_run.json @@ -0,0 +1,235 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Swift Package Run"}, + "description": "swift package target run.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "arguments": { + "items": {"type":"string"}, + "type": "array" + }, + "background": {"type":"boolean"}, + "configuration": { + "enum": ["debug","release","Debug","Release"], + "type": "string" + }, + "executableName": {"type":"string"}, + "packagePath": {"type":"string"}, + "parseAsLibrary": {"type":"boolean"}, + "timeout": {"type":"number"} + }, + "required": ["packagePath"], + "type": "object" + }, + "name": "swift_package_run", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "buildInvocationRequest": { + "additionalProperties": false, + "properties": { + "arch": {"type":"string"}, + "configuration": {"type":"string"}, + "derivedDataPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "executableName": {"type":"string"}, + "onlyTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulatorId": {"type":"string"}, + "simulatorName": {"type":"string"}, + "skipTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + }, + "targetName": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.build-run-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appPath": {"type":"string"}, + "buildLogPath": {"type":"string"}, + "bundleId": {"type":"string"}, + "deviceId": {"type":"string"}, + "executablePath": {"type":"string"}, + "osLogPath": {"type":"string"}, + "packagePath": {"type":"string"}, + "processId": {"minimum":1,"type":"integer"}, + "runtimeLogPath": {"type":"string"}, + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "output": { + "additionalProperties": false, + "properties": { + "stderr": { + "items": {"type":"string"}, + "type": "array" + }, + "stdout": { + "items": {"type":"string"}, + "type": "array" + } + }, + "required": ["stdout","stderr"], + "type": "object" + }, + "request": {"$ref":"#/$defs/buildInvocationRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.build-run-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/swift_package_stop.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/swift_package_stop.json new file mode 100644 index 000000000..d77993d51 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/swift_package_stop.json @@ -0,0 +1,169 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Swift Package Stop"}, + "description": "Stop SwiftPM run.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "pid": {"type":"number"} + }, + "required": ["pid"], + "type": "object" + }, + "name": "swift_package_stop", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.stop-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appName": {"type":"string"}, + "bundleId": {"type":"string"}, + "deviceId": {"type":"string"}, + "processId": {"minimum":1,"type":"integer"}, + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.stop-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/swift_package_test.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/swift_package_test.json new file mode 100644 index 000000000..fbaf5a4b3 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/swift_package_test.json @@ -0,0 +1,276 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Swift Package Test"}, + "description": "Run swift package target tests.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "configuration": { + "enum": ["debug","release","Debug","Release"], + "type": "string" + }, + "filter": {"description":"regex: pattern","type":"string"}, + "packagePath": {"type":"string"}, + "parallel": {"type":"boolean"}, + "parseAsLibrary": {"type":"boolean"}, + "showCodecov": {"type":"boolean"}, + "testProduct": {"type":"string"} + }, + "required": ["packagePath"], + "type": "object" + }, + "name": "swift_package_test", + "outputSchema": { + "$defs": { + "buildInvocationRequest": { + "additionalProperties": false, + "properties": { + "arch": {"type":"string"}, + "configuration": {"type":"string"}, + "derivedDataPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "executableName": {"type":"string"}, + "onlyTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulatorId": {"type":"string"}, + "simulatorName": {"type":"string"}, + "skipTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + }, + "targetName": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "type": "object" + }, + "counts": { + "additionalProperties": false, + "properties": { + "failed": {"minimum":0,"type":"integer"}, + "passed": {"minimum":0,"type":"integer"}, + "skipped": {"minimum":0,"type":"integer"} + }, + "required": ["passed","failed","skipped"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "testDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "testFailures": { + "items": {"$ref":"#/$defs/testFailureEntry"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors","testFailures"], + "type": "object" + }, + "testFailureEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"}, + "suite": {"type":"string"}, + "test": {"type":"string"} + }, + "required": ["suite","test","message"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.test-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "buildLogPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "packagePath": {"type":"string"}, + "xcresultPath": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/testDiagnostics"}, + "request": {"$ref":"#/$defs/buildInvocationRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "counts": {"$ref":"#/$defs/counts"}, + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + }, + "testCases": { + "items": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["passed","failed","skipped"] + }, + "suite": {"type":"string"}, + "test": {"type":"string"} + }, + "required": ["test","status"], + "type": "object" + }, + "type": "array" + }, + "tests": { + "additionalProperties": false, + "properties": { + "discovered": { + "additionalProperties": false, + "properties": { + "items": { + "items": {"type":"string"}, + "type": "array" + }, + "total": {"minimum":0,"type":"integer"} + }, + "required": ["total","items"], + "type": "object" + }, + "selected": { + "items": {"type":"string"}, + "type": "array" + } + }, + "required": [], + "type": "object" + } + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.test-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/swipe.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/swipe.json new file mode 100644 index 000000000..a9160e3a8 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/swipe.json @@ -0,0 +1,479 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Swipe"}, + "description": "Swipe within a scrollable UI element using withinElementRef from a current rs/1 runtime snapshot. withinElementRef is required; do not use elementRef. Optional distance is a normalized stroke fraction greater than 0 and up to 1. Example input: {\"withinElementRef\":\"e7\",\"direction\":\"up\",\"distance\":0.7}.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "direction": { + "description": "up|down|left|right", + "enum": ["up","down","left","right"], + "type": "string" + }, + "distance": {"description":"Normalized stroke fraction greater than 0 and up to 1","exclusiveMinimum":0,"maximum":1,"type":"number"}, + "duration": {"description":"seconds","exclusiveMinimum":0,"type":"number"}, + "postDelay": {"description":"seconds","maximum":10,"minimum":0,"type":"number"}, + "preDelay": {"description":"seconds","maximum":10,"minimum":0,"type":"number"}, + "simulatorId": {"format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","type":"string"}, + "withinElementRef": {"minLength":1,"type":"string"} + }, + "required": ["simulatorId","withinElementRef","direction"], + "type": "object" + }, + "name": "swipe", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "compactRuntimeSnapshot": { + "additionalProperties": false, + "properties": { + "count": {"minimum":0,"type":"integer"}, + "evidence": { + "description": "Non-actionable semantic evidence rows in role|label|value|identifier format. These rows intentionally omit element refs.", + "items": {"type":"string"}, + "type": "array" + }, + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "scroll": { + "items": {"type":"string"}, + "type": "array" + }, + "seq": {"minimum":0,"type":"integer"}, + "targets": { + "items": {"type":"string"}, + "type": "array" + }, + "text": { + "items": {"type":"string"}, + "type": "array" + }, + "type": {"const":"runtime-snapshot"}, + "udid": {"type":"string"} + }, + "required": ["type","rs","screenHash","seq","count","targets","scroll","udid"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "direction": { + "enum": ["up","down","left","right"] + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "frame": { + "additionalProperties": false, + "properties": { + "height": {"type":"number"}, + "width": {"type":"number"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y","width","height"], + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "point": { + "additionalProperties": false, + "properties": { + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y"], + "type": "object" + }, + "recoverableUiError": { + "additionalProperties": false, + "properties": { + "candidates": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "code": { + "enum": ["SNAPSHOT_MISSING","SNAPSHOT_EXPIRED","SNAPSHOT_PARSE_FAILED","SNAPSHOT_CAPTURE_FAILED","ELEMENT_REF_NOT_FOUND","TARGET_NOT_FOUND","TARGET_AMBIGUOUS","TARGET_NOT_ACTIONABLE","WAIT_TIMEOUT","UI_STATE_CHANGED","ACTION_FAILED"] + }, + "elementRef": {"type":"string"}, + "message": {"type":"string"}, + "recoveryHint": {"type":"string"}, + "snapshotAgeMs": {"minimum":0,"type":"integer"}, + "timeoutMs": {"minimum":0,"type":"integer"} + }, + "required": ["code","message","recoveryHint"], + "type": "object" + }, + "runtimeActionName": { + "enum": ["tap","typeText","longPress","touch","swipeWithin"] + }, + "runtimeElement": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionName"}, + "type": "array" + }, + "frame": {"$ref":"#/$defs/frame"}, + "identifier": {"type":"string"}, + "label": {"type":"string"}, + "ref": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "role": {"$ref":"#/$defs/runtimeElementRole"}, + "state": {"$ref":"#/$defs/runtimeElementState"}, + "value": {"type":"string"} + }, + "required": ["ref","frame","actions"], + "type": "object" + }, + "runtimeElementRole": { + "enum": ["application","button","cell","image","keyboard-key","list","menu","other","scroll-view","slider","switch","tab","text","text-field","window"] + }, + "runtimeElementState": { + "additionalProperties": false, + "properties": { + "enabled": {"type":"boolean"}, + "focused": {"type":"boolean"}, + "selected": {"type":"boolean"}, + "visible": {"type":"boolean"} + }, + "type": "object" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.ui-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"}, + "withinElementRef": {"type":"string"} + }, + "required": ["type","withinElementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"} + }, + "required": ["type","from","to"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"swipe"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "elementRef": {"type":"string"}, + "from": {"$ref":"#/$defs/point"}, + "steps": {"minimum":1,"type":"integer"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"drag"} + }, + "required": ["type","elementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"touch"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "elementRef": {"type":"string"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "button": {"type":"string"}, + "type": {"const":"button"} + }, + "required": ["type","button"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "gesture": {"type":"string"}, + "type": {"const":"gesture"} + }, + "required": ["type","gesture"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCode": {"minimum":0,"type":"integer"}, + "type": {"const":"key-press"} + }, + "required": ["type","keyCode"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCodes": { + "items": {"minimum":0,"type":"integer"}, + "type": "array" + }, + "type": {"const":"key-sequence"} + }, + "required": ["type","keyCodes"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "stepCount": {"minimum":1,"type":"integer"}, + "type": {"const":"batch"} + }, + "required": ["type","stepCount"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "capture": {"$ref":"#/$defs/compactRuntimeSnapshot"}, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"}, + "uiError": {"$ref":"#/$defs/recoverableUiError"} + }, + "required": ["summary","action","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.ui-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/sync_xcode_defaults.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/sync_xcode_defaults.json new file mode 100644 index 000000000..500ab3f64 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/sync_xcode_defaults.json @@ -0,0 +1,258 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Sync Xcode Defaults"}, + "description": "Sync session defaults (scheme, simulator) from Xcode's current IDE selection.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": {}, + "type": "object" + }, + "name": "sync_xcode_defaults", + "outputSchema": { + "$defs": { + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "sessionDefaultsOperation": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "type": {"const":"show"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"sync-xcode"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "activatedProfile": {"type":"string"}, + "changedKeys": { + "items": {"type":"string"}, + "type": "array" + }, + "notices": { + "items": {"type":"string"}, + "type": "array" + }, + "persisted": {"type":"boolean"}, + "type": {"const":"set"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "clearedKeys": { + "items": {"type":"string"}, + "type": "array" + }, + "profile": {"type":"string"}, + "scope": { + "enum": ["all","profile","current"] + }, + "type": {"const":"clear"} + }, + "required": ["type","scope"], + "type": "object" + } + ] + }, + "sessionDefaultsProfile": { + "additionalProperties": false, + "properties": { + "arch": { + "anyOf": [ + {"const":null}, + { + "enum": ["arm64","x86_64"] + } + ] + }, + "bundleId": { + "type": ["string","null"] + }, + "configuration": { + "type": ["string","null"] + }, + "derivedDataPath": { + "type": ["string","null"] + }, + "deviceId": { + "type": ["string","null"] + }, + "env": { + "anyOf": [ + {"const":null}, + { + "additionalProperties": {"type":"string"}, + "propertyNames": {"minLength":1,"type":"string"}, + "type": "object" + } + ] + }, + "extraArgs": { + "anyOf": [ + {"const":null}, + { + "items": {"type":"string"}, + "type": "array" + } + ] + }, + "platform": { + "type": ["string","null"] + }, + "preferXcodebuild": { + "type": ["boolean","null"] + }, + "projectPath": { + "type": ["string","null"] + }, + "scheme": { + "type": ["string","null"] + }, + "simulatorId": { + "type": ["string","null"] + }, + "simulatorName": { + "type": ["string","null"] + }, + "simulatorPlatform": { + "anyOf": [ + {"const":null}, + { + "enum": ["iOS Simulator","watchOS Simulator","tvOS Simulator","visionOS Simulator"] + } + ] + }, + "suppressWarnings": { + "type": ["boolean","null"] + }, + "useLatestOS": { + "type": ["boolean","null"] + }, + "workspacePath": { + "type": ["string","null"] + } + }, + "required": ["projectPath","workspacePath","scheme","configuration","simulatorName","simulatorId","simulatorPlatform","deviceId","useLatestOS","arch","suppressWarnings","derivedDataPath","preferXcodebuild","platform","bundleId","env"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.session-defaults/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "currentProfile": {"type":"string"}, + "operation": {"$ref":"#/$defs/sessionDefaultsOperation"}, + "profiles": { + "additionalProperties": {"$ref":"#/$defs/sessionDefaultsProfile"}, + "properties": { + "(default)": {"$ref":"#/$defs/sessionDefaultsProfile"} + }, + "required": ["(default)"], + "type": "object" + } + }, + "required": ["currentProfile","profiles"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.session-defaults"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/tap.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/tap.json new file mode 100644 index 000000000..3c94e495d --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/tap.json @@ -0,0 +1,472 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Tap"}, + "description": "Tap one elementRef from the latest snapshot_ui or wait_for_ui output. The elementRef must list the tap action in the snapshot targets; do not use refs from text-only rows. For multiple same-screen taps or visible switch toggles with no intermediate assertion, use batch instead of repeated tap calls. Other same-screen refs may remain usable after success; refresh after navigation, scrolling, sheet changes, or obvious layout changes.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "elementRef": {"minLength":1,"type":"string"}, + "postDelay": {"description":"seconds","maximum":10,"minimum":0,"type":"number"}, + "preDelay": {"description":"seconds","maximum":10,"minimum":0,"type":"number"}, + "simulatorId": {"format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","type":"string"} + }, + "required": ["simulatorId","elementRef"], + "type": "object" + }, + "name": "tap", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "compactRuntimeSnapshot": { + "additionalProperties": false, + "properties": { + "count": {"minimum":0,"type":"integer"}, + "evidence": { + "description": "Non-actionable semantic evidence rows in role|label|value|identifier format. These rows intentionally omit element refs.", + "items": {"type":"string"}, + "type": "array" + }, + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "scroll": { + "items": {"type":"string"}, + "type": "array" + }, + "seq": {"minimum":0,"type":"integer"}, + "targets": { + "items": {"type":"string"}, + "type": "array" + }, + "text": { + "items": {"type":"string"}, + "type": "array" + }, + "type": {"const":"runtime-snapshot"}, + "udid": {"type":"string"} + }, + "required": ["type","rs","screenHash","seq","count","targets","scroll","udid"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "direction": { + "enum": ["up","down","left","right"] + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "frame": { + "additionalProperties": false, + "properties": { + "height": {"type":"number"}, + "width": {"type":"number"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y","width","height"], + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "point": { + "additionalProperties": false, + "properties": { + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y"], + "type": "object" + }, + "recoverableUiError": { + "additionalProperties": false, + "properties": { + "candidates": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "code": { + "enum": ["SNAPSHOT_MISSING","SNAPSHOT_EXPIRED","SNAPSHOT_PARSE_FAILED","SNAPSHOT_CAPTURE_FAILED","ELEMENT_REF_NOT_FOUND","TARGET_NOT_FOUND","TARGET_AMBIGUOUS","TARGET_NOT_ACTIONABLE","WAIT_TIMEOUT","UI_STATE_CHANGED","ACTION_FAILED"] + }, + "elementRef": {"type":"string"}, + "message": {"type":"string"}, + "recoveryHint": {"type":"string"}, + "snapshotAgeMs": {"minimum":0,"type":"integer"}, + "timeoutMs": {"minimum":0,"type":"integer"} + }, + "required": ["code","message","recoveryHint"], + "type": "object" + }, + "runtimeActionName": { + "enum": ["tap","typeText","longPress","touch","swipeWithin"] + }, + "runtimeElement": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionName"}, + "type": "array" + }, + "frame": {"$ref":"#/$defs/frame"}, + "identifier": {"type":"string"}, + "label": {"type":"string"}, + "ref": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "role": {"$ref":"#/$defs/runtimeElementRole"}, + "state": {"$ref":"#/$defs/runtimeElementState"}, + "value": {"type":"string"} + }, + "required": ["ref","frame","actions"], + "type": "object" + }, + "runtimeElementRole": { + "enum": ["application","button","cell","image","keyboard-key","list","menu","other","scroll-view","slider","switch","tab","text","text-field","window"] + }, + "runtimeElementState": { + "additionalProperties": false, + "properties": { + "enabled": {"type":"boolean"}, + "focused": {"type":"boolean"}, + "selected": {"type":"boolean"}, + "visible": {"type":"boolean"} + }, + "type": "object" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.ui-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"}, + "withinElementRef": {"type":"string"} + }, + "required": ["type","withinElementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"} + }, + "required": ["type","from","to"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"swipe"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "elementRef": {"type":"string"}, + "from": {"$ref":"#/$defs/point"}, + "steps": {"minimum":1,"type":"integer"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"drag"} + }, + "required": ["type","elementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"touch"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "elementRef": {"type":"string"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "button": {"type":"string"}, + "type": {"const":"button"} + }, + "required": ["type","button"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "gesture": {"type":"string"}, + "type": {"const":"gesture"} + }, + "required": ["type","gesture"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCode": {"minimum":0,"type":"integer"}, + "type": {"const":"key-press"} + }, + "required": ["type","keyCode"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCodes": { + "items": {"minimum":0,"type":"integer"}, + "type": "array" + }, + "type": {"const":"key-sequence"} + }, + "required": ["type","keyCodes"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "stepCount": {"minimum":1,"type":"integer"}, + "type": {"const":"batch"} + }, + "required": ["type","stepCount"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "capture": {"$ref":"#/$defs/compactRuntimeSnapshot"}, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"}, + "uiError": {"$ref":"#/$defs/recoverableUiError"} + }, + "required": ["summary","action","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.ui-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/test_device.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/test_device.json new file mode 100644 index 000000000..eaf1dfa58 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/test_device.json @@ -0,0 +1,303 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Test Device"}, + "description": "Test on device.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "configuration": {"description":"Build configuration (Debug, Release)","type":"string"}, + "derivedDataPath": {"type":"string"}, + "deviceId": {"description":"UDID of the device (obtained from list_devices)","type":"string"}, + "extraArgs": { + "items": {"type":"string"}, + "type": "array" + }, + "platform": { + "description": "Device platform: iOS, watchOS, tvOS, or visionOS. Defaults to iOS.", + "enum": ["iOS","watchOS","tvOS","visionOS"], + "type": "string" + }, + "preferXcodebuild": {"type":"boolean"}, + "progress": {"description":"Show detailed test progress output (MCP defaults to true, CLI defaults to false)","type":"boolean"}, + "projectPath": {"description":"Path to the .xcodeproj file","type":"string"}, + "scheme": {"description":"The scheme to test in source mode","type":"string"}, + "testProductsPath": {"description":"Path to a prepared .xctestproducts package. Cannot be combined with source inputs","type":"string"}, + "testRunnerEnv": { + "description": "Environment variables to pass to the test runner (TEST_RUNNER_ prefix added automatically)", + "items": { + "additionalProperties": false, + "properties": { + "key": {"minLength":1,"type":"string"}, + "value": {"type":"string"} + }, + "required": ["key","value"], + "type": "object" + }, + "type": "array" + }, + "workspacePath": {"description":"Path to the .xcworkspace file","type":"string"}, + "xctestrunPath": {"description":"Path to a prepared .xctestrun file. Cannot be combined with source inputs","type":"string"} + }, + "required": ["deviceId"], + "type": "object" + }, + "name": "test_device", + "outputSchema": { + "$defs": { + "buildInvocationRequest": { + "additionalProperties": false, + "properties": { + "arch": {"type":"string"}, + "buildForTesting": {"type":"boolean"}, + "configuration": {"type":"string"}, + "derivedDataPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "executableName": {"type":"string"}, + "onlyTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulatorId": {"type":"string"}, + "simulatorName": {"type":"string"}, + "skipTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + }, + "targetName": {"type":"string"}, + "testProductsPath": {"type":"string"}, + "workspacePath": {"type":"string"}, + "xctestrunPath": {"type":"string"} + }, + "type": "object" + }, + "counts": { + "additionalProperties": false, + "properties": { + "failed": {"minimum":0,"type":"integer"}, + "passed": {"minimum":0,"type":"integer"}, + "skipped": {"minimum":0,"type":"integer"} + }, + "required": ["passed","failed","skipped"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "testDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "testFailures": { + "items": {"$ref":"#/$defs/testFailureEntry"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors","testFailures"], + "type": "object" + }, + "testFailureEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"}, + "suite": {"type":"string"}, + "test": {"type":"string"} + }, + "required": ["suite","test","message"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.test-result/3.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "buildLogPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "packagePath": {"type":"string"}, + "testProductsPath": {"type":"string"}, + "xcresultPath": {"type":"string"}, + "xctestrunPath": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/testDiagnostics"}, + "request": {"$ref":"#/$defs/buildInvocationRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "counts": {"$ref":"#/$defs/counts"}, + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + }, + "testCases": { + "items": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["passed","failed","skipped"] + }, + "suite": {"type":"string"}, + "test": {"type":"string"} + }, + "required": ["test","status"], + "type": "object" + }, + "type": "array" + }, + "tests": { + "additionalProperties": false, + "properties": { + "discovered": { + "additionalProperties": false, + "properties": { + "items": { + "items": {"type":"string"}, + "type": "array" + }, + "total": {"minimum":0,"type":"integer"} + }, + "required": ["total","items"], + "type": "object" + }, + "selected": { + "items": {"type":"string"}, + "type": "array" + } + }, + "required": [], + "type": "object" + } + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.test-result"}, + "schemaVersion": {"const":"3"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/test_macos.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/test_macos.json new file mode 100644 index 000000000..8da1db0e7 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/test_macos.json @@ -0,0 +1,296 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Test macOS"}, + "description": "Test macOS target.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "configuration": {"description":"Build configuration (Debug, Release, etc.)","type":"string"}, + "derivedDataPath": {"type":"string"}, + "extraArgs": { + "items": {"type":"string"}, + "type": "array" + }, + "preferXcodebuild": {"type":"boolean"}, + "progress": {"description":"Show detailed test progress output (MCP defaults to true, CLI defaults to false)","type":"boolean"}, + "projectPath": {"description":"Path to the .xcodeproj file","type":"string"}, + "scheme": {"description":"The scheme to use in source mode","type":"string"}, + "testProductsPath": {"description":"Path to a prepared .xctestproducts package. Cannot be combined with source inputs","type":"string"}, + "testRunnerEnv": { + "description": "Environment variables to pass to the test runner (TEST_RUNNER_ prefix added automatically)", + "items": { + "additionalProperties": false, + "properties": { + "key": {"minLength":1,"type":"string"}, + "value": {"type":"string"} + }, + "required": ["key","value"], + "type": "object" + }, + "type": "array" + }, + "workspacePath": {"description":"Path to the .xcworkspace file","type":"string"}, + "xctestrunPath": {"description":"Path to a prepared .xctestrun file. Cannot be combined with source inputs","type":"string"} + }, + "type": "object" + }, + "name": "test_macos", + "outputSchema": { + "$defs": { + "buildInvocationRequest": { + "additionalProperties": false, + "properties": { + "arch": {"type":"string"}, + "buildForTesting": {"type":"boolean"}, + "configuration": {"type":"string"}, + "derivedDataPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "executableName": {"type":"string"}, + "onlyTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulatorId": {"type":"string"}, + "simulatorName": {"type":"string"}, + "skipTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + }, + "targetName": {"type":"string"}, + "testProductsPath": {"type":"string"}, + "workspacePath": {"type":"string"}, + "xctestrunPath": {"type":"string"} + }, + "type": "object" + }, + "counts": { + "additionalProperties": false, + "properties": { + "failed": {"minimum":0,"type":"integer"}, + "passed": {"minimum":0,"type":"integer"}, + "skipped": {"minimum":0,"type":"integer"} + }, + "required": ["passed","failed","skipped"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "testDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "testFailures": { + "items": {"$ref":"#/$defs/testFailureEntry"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors","testFailures"], + "type": "object" + }, + "testFailureEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"}, + "suite": {"type":"string"}, + "test": {"type":"string"} + }, + "required": ["suite","test","message"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.test-result/3.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "buildLogPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "packagePath": {"type":"string"}, + "testProductsPath": {"type":"string"}, + "xcresultPath": {"type":"string"}, + "xctestrunPath": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/testDiagnostics"}, + "request": {"$ref":"#/$defs/buildInvocationRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "counts": {"$ref":"#/$defs/counts"}, + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + }, + "testCases": { + "items": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["passed","failed","skipped"] + }, + "suite": {"type":"string"}, + "test": {"type":"string"} + }, + "required": ["test","status"], + "type": "object" + }, + "type": "array" + }, + "tests": { + "additionalProperties": false, + "properties": { + "discovered": { + "additionalProperties": false, + "properties": { + "items": { + "items": {"type":"string"}, + "type": "array" + }, + "total": {"minimum":0,"type":"integer"} + }, + "required": ["total","items"], + "type": "object" + }, + "selected": { + "items": {"type":"string"}, + "type": "array" + } + }, + "required": [], + "type": "object" + } + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.test-result"}, + "schemaVersion": {"const":"3"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/test_sim.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/test_sim.json new file mode 100644 index 000000000..a2ed4881f --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/test_sim.json @@ -0,0 +1,299 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Test Simulator"}, + "description": "Test on iOS sim.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "configuration": {"description":"Build configuration (Debug, Release, etc.)","type":"string"}, + "derivedDataPath": {"type":"string"}, + "extraArgs": { + "items": {"type":"string"}, + "type": "array" + }, + "preferXcodebuild": {"type":"boolean"}, + "progress": {"description":"Show detailed test progress output (MCP defaults to true, CLI defaults to false)","type":"boolean"}, + "projectPath": {"description":"Path to .xcodeproj file. Provide EITHER this OR workspacePath, not both","type":"string"}, + "scheme": {"description":"The scheme to use in source mode","type":"string"}, + "simulatorId": {"description":"UUID of the simulator (from list_sims). Provide EITHER this OR simulatorName, not both","type":"string"}, + "simulatorName": {"description":"Name of the simulator (e.g., 'iPhone 17'). Provide EITHER this OR simulatorId, not both","type":"string"}, + "testProductsPath": {"description":"Path to a prepared .xctestproducts package. Cannot be combined with source inputs","type":"string"}, + "testRunnerEnv": { + "description": "Environment variables to pass to the test runner (TEST_RUNNER_ prefix added automatically)", + "items": { + "additionalProperties": false, + "properties": { + "key": {"minLength":1,"type":"string"}, + "value": {"type":"string"} + }, + "required": ["key","value"], + "type": "object" + }, + "type": "array" + }, + "useLatestOS": {"description":"Whether to use the latest OS version for the named simulator","type":"boolean"}, + "workspacePath": {"description":"Path to .xcworkspace file. Provide EITHER this OR projectPath, not both","type":"string"}, + "xctestrunPath": {"description":"Path to a prepared .xctestrun file. Cannot be combined with source inputs","type":"string"} + }, + "type": "object" + }, + "name": "test_sim", + "outputSchema": { + "$defs": { + "buildInvocationRequest": { + "additionalProperties": false, + "properties": { + "arch": {"type":"string"}, + "buildForTesting": {"type":"boolean"}, + "configuration": {"type":"string"}, + "derivedDataPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "executableName": {"type":"string"}, + "onlyTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulatorId": {"type":"string"}, + "simulatorName": {"type":"string"}, + "skipTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + }, + "targetName": {"type":"string"}, + "testProductsPath": {"type":"string"}, + "workspacePath": {"type":"string"}, + "xctestrunPath": {"type":"string"} + }, + "type": "object" + }, + "counts": { + "additionalProperties": false, + "properties": { + "failed": {"minimum":0,"type":"integer"}, + "passed": {"minimum":0,"type":"integer"}, + "skipped": {"minimum":0,"type":"integer"} + }, + "required": ["passed","failed","skipped"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "testDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "testFailures": { + "items": {"$ref":"#/$defs/testFailureEntry"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors","testFailures"], + "type": "object" + }, + "testFailureEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"}, + "suite": {"type":"string"}, + "test": {"type":"string"} + }, + "required": ["suite","test","message"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.test-result/3.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "buildLogPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "packagePath": {"type":"string"}, + "testProductsPath": {"type":"string"}, + "xcresultPath": {"type":"string"}, + "xctestrunPath": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/testDiagnostics"}, + "request": {"$ref":"#/$defs/buildInvocationRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "counts": {"$ref":"#/$defs/counts"}, + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + }, + "testCases": { + "items": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["passed","failed","skipped"] + }, + "suite": {"type":"string"}, + "test": {"type":"string"} + }, + "required": ["test","status"], + "type": "object" + }, + "type": "array" + }, + "tests": { + "additionalProperties": false, + "properties": { + "discovered": { + "additionalProperties": false, + "properties": { + "items": { + "items": {"type":"string"}, + "type": "array" + }, + "total": {"minimum":0,"type":"integer"} + }, + "required": ["total","items"], + "type": "object" + }, + "selected": { + "items": {"type":"string"}, + "type": "array" + } + }, + "required": [], + "type": "object" + } + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.test-result"}, + "schemaVersion": {"const":"3"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/toggle_connect_hardware_keyboard.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/toggle_connect_hardware_keyboard.json new file mode 100644 index 000000000..b40b3469f --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/toggle_connect_hardware_keyboard.json @@ -0,0 +1,257 @@ +{ + "annotations": {"destructiveHint":false,"idempotentHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Toggle Connect Hardware Keyboard"}, + "description": "Toggle whether the iOS Simulator simulates a hardware keyboard connection. Disconnecting makes the on-screen keyboard appear for tap-based input. Requires the simulator to be booted and Accessibility permission for the MCP host.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "simulatorId": { + "description": "UUID of the simulator to use (obtained from list_simulators)", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + } + }, + "required": ["simulatorId"], + "type": "object" + }, + "name": "toggle_connect_hardware_keyboard", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.simulator-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "type": {"const":"boot"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"erase"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"open"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"reset-location"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "coordinates": { + "additionalProperties": false, + "properties": { + "latitude": {"maximum":90,"minimum":-90,"type":"number"}, + "longitude": {"maximum":180,"minimum":-180,"type":"number"} + }, + "required": ["latitude","longitude"], + "type": "object" + }, + "type": {"const":"set-location"} + }, + "required": ["type","coordinates"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "appearance": {"type":"string"}, + "type": {"const":"set-appearance"} + }, + "required": ["type","appearance"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "dataNetwork": {"type":"string"}, + "type": {"const":"statusbar"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-software-keyboard"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-connect-hardware-keyboard"} + }, + "required": ["type"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","action"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.simulator-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/toggle_software_keyboard.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/toggle_software_keyboard.json new file mode 100644 index 000000000..dc0af4412 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/toggle_software_keyboard.json @@ -0,0 +1,257 @@ +{ + "annotations": {"destructiveHint":false,"idempotentHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Toggle Software Keyboard"}, + "description": "Toggle the iOS Simulator software keyboard. Shows or hides the on-screen keyboard. Requires the simulator to be booted and Accessibility permission for the MCP host.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "simulatorId": { + "description": "UUID of the simulator to use (obtained from list_simulators)", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$", + "type": "string" + } + }, + "required": ["simulatorId"], + "type": "object" + }, + "name": "toggle_software_keyboard", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.simulator-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "type": {"const":"boot"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"erase"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"open"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"reset-location"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "coordinates": { + "additionalProperties": false, + "properties": { + "latitude": {"maximum":90,"minimum":-90,"type":"number"}, + "longitude": {"maximum":180,"minimum":-180,"type":"number"} + }, + "required": ["latitude","longitude"], + "type": "object" + }, + "type": {"const":"set-location"} + }, + "required": ["type","coordinates"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "appearance": {"type":"string"}, + "type": {"const":"set-appearance"} + }, + "required": ["type","appearance"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "dataNetwork": {"type":"string"}, + "type": {"const":"statusbar"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-software-keyboard"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-connect-hardware-keyboard"} + }, + "required": ["type"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","action"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.simulator-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/touch.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/touch.json new file mode 100644 index 000000000..6c2b811fa --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/touch.json @@ -0,0 +1,473 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Touch"}, + "description": "Send touch down/up events to a UI element by elementRef from a current rs/1 runtime snapshot.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "delay": {"description":"seconds","maximum":10,"minimum":0,"type":"number"}, + "down": {"type":"boolean"}, + "elementRef": {"minLength":1,"type":"string"}, + "simulatorId": {"format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","type":"string"}, + "up": {"type":"boolean"} + }, + "required": ["simulatorId","elementRef"], + "type": "object" + }, + "name": "touch", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "compactRuntimeSnapshot": { + "additionalProperties": false, + "properties": { + "count": {"minimum":0,"type":"integer"}, + "evidence": { + "description": "Non-actionable semantic evidence rows in role|label|value|identifier format. These rows intentionally omit element refs.", + "items": {"type":"string"}, + "type": "array" + }, + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "scroll": { + "items": {"type":"string"}, + "type": "array" + }, + "seq": {"minimum":0,"type":"integer"}, + "targets": { + "items": {"type":"string"}, + "type": "array" + }, + "text": { + "items": {"type":"string"}, + "type": "array" + }, + "type": {"const":"runtime-snapshot"}, + "udid": {"type":"string"} + }, + "required": ["type","rs","screenHash","seq","count","targets","scroll","udid"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "direction": { + "enum": ["up","down","left","right"] + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "frame": { + "additionalProperties": false, + "properties": { + "height": {"type":"number"}, + "width": {"type":"number"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y","width","height"], + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "point": { + "additionalProperties": false, + "properties": { + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y"], + "type": "object" + }, + "recoverableUiError": { + "additionalProperties": false, + "properties": { + "candidates": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "code": { + "enum": ["SNAPSHOT_MISSING","SNAPSHOT_EXPIRED","SNAPSHOT_PARSE_FAILED","SNAPSHOT_CAPTURE_FAILED","ELEMENT_REF_NOT_FOUND","TARGET_NOT_FOUND","TARGET_AMBIGUOUS","TARGET_NOT_ACTIONABLE","WAIT_TIMEOUT","UI_STATE_CHANGED","ACTION_FAILED"] + }, + "elementRef": {"type":"string"}, + "message": {"type":"string"}, + "recoveryHint": {"type":"string"}, + "snapshotAgeMs": {"minimum":0,"type":"integer"}, + "timeoutMs": {"minimum":0,"type":"integer"} + }, + "required": ["code","message","recoveryHint"], + "type": "object" + }, + "runtimeActionName": { + "enum": ["tap","typeText","longPress","touch","swipeWithin"] + }, + "runtimeElement": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionName"}, + "type": "array" + }, + "frame": {"$ref":"#/$defs/frame"}, + "identifier": {"type":"string"}, + "label": {"type":"string"}, + "ref": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "role": {"$ref":"#/$defs/runtimeElementRole"}, + "state": {"$ref":"#/$defs/runtimeElementState"}, + "value": {"type":"string"} + }, + "required": ["ref","frame","actions"], + "type": "object" + }, + "runtimeElementRole": { + "enum": ["application","button","cell","image","keyboard-key","list","menu","other","scroll-view","slider","switch","tab","text","text-field","window"] + }, + "runtimeElementState": { + "additionalProperties": false, + "properties": { + "enabled": {"type":"boolean"}, + "focused": {"type":"boolean"}, + "selected": {"type":"boolean"}, + "visible": {"type":"boolean"} + }, + "type": "object" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.ui-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"}, + "withinElementRef": {"type":"string"} + }, + "required": ["type","withinElementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"} + }, + "required": ["type","from","to"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"swipe"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "elementRef": {"type":"string"}, + "from": {"$ref":"#/$defs/point"}, + "steps": {"minimum":1,"type":"integer"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"drag"} + }, + "required": ["type","elementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"touch"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "elementRef": {"type":"string"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "button": {"type":"string"}, + "type": {"const":"button"} + }, + "required": ["type","button"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "gesture": {"type":"string"}, + "type": {"const":"gesture"} + }, + "required": ["type","gesture"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCode": {"minimum":0,"type":"integer"}, + "type": {"const":"key-press"} + }, + "required": ["type","keyCode"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCodes": { + "items": {"minimum":0,"type":"integer"}, + "type": "array" + }, + "type": {"const":"key-sequence"} + }, + "required": ["type","keyCodes"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "stepCount": {"minimum":1,"type":"integer"}, + "type": {"const":"batch"} + }, + "required": ["type","stepCount"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "capture": {"$ref":"#/$defs/compactRuntimeSnapshot"}, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"}, + "uiError": {"$ref":"#/$defs/recoverableUiError"} + }, + "required": ["summary","action","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.ui-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/type_text.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/type_text.json new file mode 100644 index 000000000..19bc18bc3 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/type_text.json @@ -0,0 +1,472 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Type Text"}, + "description": "Type text into a UI element by elementRef from a current rs/1 runtime snapshot, optionally replacing existing field contents. elementRef is required; do not call with only text. Example input: {\"elementRef\":\"e8\",\"text\":\"London\",\"replaceExisting\":true}.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "elementRef": {"description":"Required runtime text-field elementRef from the latest snapshot_ui or wait_for_ui output","minLength":1,"type":"string"}, + "replaceExisting": {"description":"Select and replace existing field contents before typing","type":"boolean"}, + "simulatorId": {"format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","type":"string"}, + "text": {"description":"Text to type","minLength":1,"type":"string"} + }, + "required": ["simulatorId","elementRef","text"], + "type": "object" + }, + "name": "type_text", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "compactRuntimeSnapshot": { + "additionalProperties": false, + "properties": { + "count": {"minimum":0,"type":"integer"}, + "evidence": { + "description": "Non-actionable semantic evidence rows in role|label|value|identifier format. These rows intentionally omit element refs.", + "items": {"type":"string"}, + "type": "array" + }, + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "scroll": { + "items": {"type":"string"}, + "type": "array" + }, + "seq": {"minimum":0,"type":"integer"}, + "targets": { + "items": {"type":"string"}, + "type": "array" + }, + "text": { + "items": {"type":"string"}, + "type": "array" + }, + "type": {"const":"runtime-snapshot"}, + "udid": {"type":"string"} + }, + "required": ["type","rs","screenHash","seq","count","targets","scroll","udid"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "direction": { + "enum": ["up","down","left","right"] + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "frame": { + "additionalProperties": false, + "properties": { + "height": {"type":"number"}, + "width": {"type":"number"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y","width","height"], + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "point": { + "additionalProperties": false, + "properties": { + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y"], + "type": "object" + }, + "recoverableUiError": { + "additionalProperties": false, + "properties": { + "candidates": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "code": { + "enum": ["SNAPSHOT_MISSING","SNAPSHOT_EXPIRED","SNAPSHOT_PARSE_FAILED","SNAPSHOT_CAPTURE_FAILED","ELEMENT_REF_NOT_FOUND","TARGET_NOT_FOUND","TARGET_AMBIGUOUS","TARGET_NOT_ACTIONABLE","WAIT_TIMEOUT","UI_STATE_CHANGED","ACTION_FAILED"] + }, + "elementRef": {"type":"string"}, + "message": {"type":"string"}, + "recoveryHint": {"type":"string"}, + "snapshotAgeMs": {"minimum":0,"type":"integer"}, + "timeoutMs": {"minimum":0,"type":"integer"} + }, + "required": ["code","message","recoveryHint"], + "type": "object" + }, + "runtimeActionName": { + "enum": ["tap","typeText","longPress","touch","swipeWithin"] + }, + "runtimeElement": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionName"}, + "type": "array" + }, + "frame": {"$ref":"#/$defs/frame"}, + "identifier": {"type":"string"}, + "label": {"type":"string"}, + "ref": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "role": {"$ref":"#/$defs/runtimeElementRole"}, + "state": {"$ref":"#/$defs/runtimeElementState"}, + "value": {"type":"string"} + }, + "required": ["ref","frame","actions"], + "type": "object" + }, + "runtimeElementRole": { + "enum": ["application","button","cell","image","keyboard-key","list","menu","other","scroll-view","slider","switch","tab","text","text-field","window"] + }, + "runtimeElementState": { + "additionalProperties": false, + "properties": { + "enabled": {"type":"boolean"}, + "focused": {"type":"boolean"}, + "selected": {"type":"boolean"}, + "visible": {"type":"boolean"} + }, + "type": "object" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.ui-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"}, + "withinElementRef": {"type":"string"} + }, + "required": ["type","withinElementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"} + }, + "required": ["type","from","to"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"swipe"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "elementRef": {"type":"string"}, + "from": {"$ref":"#/$defs/point"}, + "steps": {"minimum":1,"type":"integer"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"drag"} + }, + "required": ["type","elementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"touch"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "elementRef": {"type":"string"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "button": {"type":"string"}, + "type": {"const":"button"} + }, + "required": ["type","button"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "gesture": {"type":"string"}, + "type": {"const":"gesture"} + }, + "required": ["type","gesture"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCode": {"minimum":0,"type":"integer"}, + "type": {"const":"key-press"} + }, + "required": ["type","keyCode"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCodes": { + "items": {"minimum":0,"type":"integer"}, + "type": "array" + }, + "type": {"const":"key-sequence"} + }, + "required": ["type","keyCodes"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "stepCount": {"minimum":1,"type":"integer"}, + "type": {"const":"batch"} + }, + "required": ["type","stepCount"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "capture": {"$ref":"#/$defs/compactRuntimeSnapshot"}, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"}, + "uiError": {"$ref":"#/$defs/recoverableUiError"} + }, + "required": ["summary","action","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.ui-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/wait_for_ui.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/wait_for_ui.json new file mode 100644 index 000000000..209fec736 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/wait_for_ui.json @@ -0,0 +1,406 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Wait for UI"}, + "description": "Poll rs/1 runtime UI snapshots until a selector-based UI predicate, selector-free textContains/gone text predicate, or selector-free settled predicate is satisfied, then record the latest snapshot. Prefer this after navigation or layout changes. Select with elementRef, identifier, label, role, or value when a selector is needed.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "elementRef": {"minLength":1,"type":"string"}, + "identifier": {"minLength":1,"type":"string"}, + "label": {"minLength":1,"type":"string"}, + "pollIntervalMs": {"description":"milliseconds","maximum":9007199254740991,"minimum":1,"type":"integer"}, + "predicate": { + "enum": ["exists","gone","enabled","focused","textContains","settled"], + "type": "string" + }, + "role": { + "enum": ["application","button","cell","image","keyboard-key","list","menu","other","scroll-view","slider","switch","tab","text","text-field","window"], + "type": "string" + }, + "settledDurationMs": {"description":"milliseconds","maximum":9007199254740991,"minimum":0,"type":"integer"}, + "simulatorId": {"format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","type":"string"}, + "text": {"minLength":1,"type":"string"}, + "timeoutMs": {"description":"milliseconds","maximum":9007199254740991,"minimum":0,"type":"integer"}, + "value": {"minLength":1,"type":"string"} + }, + "required": ["simulatorId","predicate"], + "type": "object" + }, + "name": "wait_for_ui", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "compactRuntimeSnapshot": { + "additionalProperties": false, + "properties": { + "count": {"minimum":0,"type":"integer"}, + "evidence": { + "description": "Non-actionable semantic evidence rows in role|label|value|identifier format. These rows intentionally omit element refs.", + "items": {"type":"string"}, + "type": "array" + }, + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "scroll": { + "items": {"type":"string"}, + "type": "array" + }, + "seq": {"minimum":0,"type":"integer"}, + "targets": { + "items": {"type":"string"}, + "type": "array" + }, + "text": { + "items": {"type":"string"}, + "type": "array" + }, + "type": {"const":"runtime-snapshot"}, + "udid": {"type":"string"} + }, + "required": ["type","rs","screenHash","seq","count","targets","scroll","udid"], + "type": "object" + }, + "compactRuntimeSnapshotUnchanged": { + "additionalProperties": false, + "properties": { + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "seq": {"minimum":0,"type":"integer"}, + "type": {"const":"runtime-snapshot-unchanged"}, + "udid": {"type":"string"}, + "unchanged": {"const":true} + }, + "required": ["type","rs","screenHash","seq","unchanged","udid"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "frame": { + "additionalProperties": false, + "properties": { + "height": {"type":"number"}, + "width": {"type":"number"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y","width","height"], + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "recoverableUiError": { + "additionalProperties": false, + "properties": { + "candidates": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "code": { + "enum": ["SNAPSHOT_MISSING","SNAPSHOT_EXPIRED","SNAPSHOT_PARSE_FAILED","SNAPSHOT_CAPTURE_FAILED","ELEMENT_REF_NOT_FOUND","TARGET_NOT_FOUND","TARGET_AMBIGUOUS","TARGET_NOT_ACTIONABLE","WAIT_TIMEOUT","UI_STATE_CHANGED","ACTION_FAILED"] + }, + "elementRef": {"type":"string"}, + "message": {"type":"string"}, + "recoveryHint": {"type":"string"}, + "snapshotAgeMs": {"minimum":0,"type":"integer"}, + "timeoutMs": {"minimum":0,"type":"integer"} + }, + "required": ["code","message","recoveryHint"], + "type": "object" + }, + "runtimeActionHint": { + "additionalProperties": false, + "properties": { + "action": {"$ref":"#/$defs/runtimeActionName"}, + "elementRef": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "label": {"type":"string"} + }, + "required": ["action","elementRef"], + "type": "object" + }, + "runtimeActionName": { + "enum": ["tap","typeText","longPress","touch","swipeWithin"] + }, + "runtimeElement": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionName"}, + "type": "array" + }, + "frame": {"$ref":"#/$defs/frame"}, + "identifier": {"type":"string"}, + "label": {"type":"string"}, + "ref": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "role": {"$ref":"#/$defs/runtimeElementRole"}, + "state": {"$ref":"#/$defs/runtimeElementState"}, + "value": {"type":"string"} + }, + "required": ["ref","frame","actions"], + "type": "object" + }, + "runtimeElementRole": { + "enum": ["application","button","cell","image","keyboard-key","list","menu","other","scroll-view","slider","switch","tab","text","text-field","window"] + }, + "runtimeElementState": { + "additionalProperties": false, + "properties": { + "enabled": {"type":"boolean"}, + "focused": {"type":"boolean"}, + "selected": {"type":"boolean"}, + "visible": {"type":"boolean"} + }, + "type": "object" + }, + "runtimeSnapshot": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionHint"}, + "type": "array" + }, + "capturedAtMs": {"minimum":0,"type":"integer"}, + "elements": { + "items": {"$ref":"#/$defs/runtimeElement"}, + "type": "array" + }, + "expiresAtMs": {"minimum":0,"type":"integer"}, + "protocol": {"const":"rs/1"}, + "screenHash": {"minLength":1,"type":"string"}, + "seq": {"minimum":0,"type":"integer"}, + "simulatorId": {"type":"string"}, + "type": {"const":"runtime-snapshot"} + }, + "required": ["type","protocol","simulatorId","screenHash","seq","capturedAtMs","expiresAtMs","elements","actions"], + "type": "object" + }, + "runtimeSnapshotUnchanged": { + "additionalProperties": false, + "properties": { + "protocol": {"const":"rs/1"}, + "screenHash": {"minLength":1,"type":"string"}, + "seq": {"minimum":0,"type":"integer"}, + "simulatorId": {"type":"string"}, + "type": {"const":"runtime-snapshot-unchanged"} + }, + "required": ["type","protocol","simulatorId","screenHash","seq"], + "type": "object" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + }, + "uiHierarchyCapture": { + "additionalProperties": false, + "properties": { + "type": {"const":"ui-hierarchy"}, + "uiHierarchy": { + "items": {"$ref":"#/$defs/uiHierarchyNode"}, + "type": "array" + } + }, + "required": ["type","uiHierarchy"], + "type": "object" + }, + "uiHierarchyNode": {"type":"object"}, + "videoRecordingCapture": { + "additionalProperties": false, + "properties": { + "fps": {"minimum":1,"type":"integer"}, + "outputFile": {"type":"string"}, + "sessionId": {"type":"string"}, + "state": { + "enum": ["started","stopped"] + }, + "type": {"const":"video-recording"} + }, + "required": ["type","state"], + "type": "object" + }, + "waitMatch": { + "additionalProperties": false, + "properties": { + "matches": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "predicate": {"$ref":"#/$defs/waitPredicate"} + }, + "required": ["predicate","matches"], + "type": "object" + }, + "waitPredicate": { + "enum": ["exists","gone","enabled","focused","textContains","settled"] + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.capture-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "screenshotPath": {"type":"string"}, + "simulatorId": {"type":"string"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "capture": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "format": {"type":"string"}, + "height": {"minimum":0,"type":"integer"}, + "width": {"minimum":0,"type":"integer"} + }, + "required": ["format","width","height"], + "type": "object" + }, + {"$ref":"#/$defs/uiHierarchyCapture"}, + {"$ref":"#/$defs/runtimeSnapshot"}, + {"$ref":"#/$defs/compactRuntimeSnapshot"}, + {"$ref":"#/$defs/videoRecordingCapture"}, + {"$ref":"#/$defs/runtimeSnapshotUnchanged"}, + {"$ref":"#/$defs/compactRuntimeSnapshotUnchanged"} + ] + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"}, + "uiError": {"$ref":"#/$defs/recoverableUiError"}, + "waitMatch": {"$ref":"#/$defs/waitMatch"} + }, + "required": ["summary","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.capture-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/xcode_ide_call_tool.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/xcode_ide_call_tool.json new file mode 100644 index 000000000..26a36b897 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/xcode_ide_call_tool.json @@ -0,0 +1,141 @@ +{ + "annotations": {"destructiveHint":true,"openWorldHint":false,"readOnlyHint":false,"title":"Call Xcode IDE Tool"}, + "description": "Call a remote Xcode IDE MCP tool.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "arguments": {"default":"{}","description":"JSON object string containing arguments for the remote Xcode MCP tool.","type":"string"}, + "remoteTool": {"description":"Exact remote Xcode MCP tool name.","minLength":1,"type":"string"}, + "timeoutMs": {"description":"Optional timeout override in milliseconds for this single tool call.","maximum":120000,"minimum":100,"type":"integer"} + }, + "required": ["remoteTool"], + "type": "object" + }, + "name": "xcode_ide_call_tool", + "outputSchema": { + "$defs": { + "artifacts": { + "additionalProperties": false, + "properties": { + "rawResponseJsonPath": {"type":"string"} + }, + "required": ["rawResponseJsonPath"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "relayedContentItem": { + "additionalProperties": true, + "properties": { + "type": {"type":"string"} + }, + "required": ["type"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.xcode-bridge-call-result/3.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": {"$ref":"#/$defs/artifacts"}, + "content": { + "items": {"$ref":"#/$defs/relayedContentItem"}, + "type": "array" + }, + "remoteTool": {"type":"string"}, + "succeeded": {"type":"boolean"} + }, + "required": ["remoteTool","succeeded","content"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.xcode-bridge-call-result"}, + "schemaVersion": {"const":"3"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/xcode_ide_list_tools.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/xcode_ide_list_tools.json new file mode 100644 index 000000000..e33f490d9 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/xcode_ide_list_tools.json @@ -0,0 +1,125 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"List Xcode IDE Tools"}, + "description": "Lists Xcode-IDE-only MCP capabilities (Use for: SwiftUI previews image capture, code snippet execution, issue Navigator/build logs, and window/tab context).", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "refresh": {"description":"When true, forces a refresh from Xcode bridge. When omitted, uses cached tools if available and refreshes only when the cache is empty.","type":"boolean"} + }, + "type": "object" + }, + "name": "xcode_ide_list_tools", + "outputSchema": { + "$defs": { + "artifacts": { + "additionalProperties": false, + "properties": { + "rawResponseJsonPath": {"type":"string"} + }, + "required": ["rawResponseJsonPath"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.xcode-bridge-tool-list/3.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": {"$ref":"#/$defs/artifacts"}, + "toolCount": {"minimum":0,"type":"integer"} + }, + "required": ["toolCount"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.xcode-bridge-tool-list"}, + "schemaVersion": {"const":"3"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/xcode_tools_bridge_disconnect.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/xcode_tools_bridge_disconnect.json new file mode 100644 index 000000000..c71284dbc --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/xcode_tools_bridge_disconnect.json @@ -0,0 +1,147 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Disconnect Xcode Tools Bridge"}, + "description": "Disconnect bridge and unregister proxied `xcode_tools_*` tools.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": {}, + "type": "object" + }, + "name": "xcode_tools_bridge_disconnect", + "outputSchema": { + "$defs": { + "bridgeStatus": { + "additionalProperties": false, + "properties": { + "bridgeAvailable": {"type":"boolean"}, + "bridgePath": { + "type": ["string","null"] + }, + "bridgePid": { + "type": ["integer","null"] + }, + "connected": {"type":"boolean"}, + "lastError": { + "type": ["string","null"] + }, + "proxiedToolCount": {"minimum":0,"type":"integer"}, + "workflowEnabled": {"type":"boolean"}, + "xcodePid": { + "type": ["string","null"] + }, + "xcodeRunning": { + "type": ["boolean","null"] + }, + "xcodeSessionId": { + "type": ["string","null"] + } + }, + "required": ["workflowEnabled","bridgeAvailable","bridgePath","xcodeRunning","connected","bridgePid","proxiedToolCount","lastError","xcodePid","xcodeSessionId"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.xcode-bridge-status/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "enum": ["status","disconnect"], + "type": "string" + }, + "status": {"$ref":"#/$defs/bridgeStatus"} + }, + "required": ["action","status"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.xcode-bridge-status"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/xcode_tools_bridge_status.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/xcode_tools_bridge_status.json new file mode 100644 index 000000000..2e22e8a18 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/xcode_tools_bridge_status.json @@ -0,0 +1,147 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Xcode Tools Bridge Status"}, + "description": "Show xcrun mcpbridge availability and proxy tool sync status.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": {}, + "type": "object" + }, + "name": "xcode_tools_bridge_status", + "outputSchema": { + "$defs": { + "bridgeStatus": { + "additionalProperties": false, + "properties": { + "bridgeAvailable": {"type":"boolean"}, + "bridgePath": { + "type": ["string","null"] + }, + "bridgePid": { + "type": ["integer","null"] + }, + "connected": {"type":"boolean"}, + "lastError": { + "type": ["string","null"] + }, + "proxiedToolCount": {"minimum":0,"type":"integer"}, + "workflowEnabled": {"type":"boolean"}, + "xcodePid": { + "type": ["string","null"] + }, + "xcodeRunning": { + "type": ["boolean","null"] + }, + "xcodeSessionId": { + "type": ["string","null"] + } + }, + "required": ["workflowEnabled","bridgeAvailable","bridgePath","xcodeRunning","connected","bridgePid","proxiedToolCount","lastError","xcodePid","xcodeSessionId"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.xcode-bridge-status/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "enum": ["status","disconnect"], + "type": "string" + }, + "status": {"$ref":"#/$defs/bridgeStatus"} + }, + "required": ["action","status"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.xcode-bridge-status"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/xcode_tools_bridge_sync.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/xcode_tools_bridge_sync.json new file mode 100644 index 000000000..6c2e6189e --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-disabled/xcode_tools_bridge_sync.json @@ -0,0 +1,154 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Sync Xcode Tools Bridge"}, + "description": "One-shot connect + tools/list sync (manual retry; avoids background prompt spam).", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": {}, + "type": "object" + }, + "name": "xcode_tools_bridge_sync", + "outputSchema": { + "$defs": { + "bridgeStatus": { + "additionalProperties": false, + "properties": { + "bridgeAvailable": {"type":"boolean"}, + "bridgePath": { + "type": ["string","null"] + }, + "bridgePid": { + "type": ["integer","null"] + }, + "connected": {"type":"boolean"}, + "lastError": { + "type": ["string","null"] + }, + "proxiedToolCount": {"minimum":0,"type":"integer"}, + "workflowEnabled": {"type":"boolean"}, + "xcodePid": { + "type": ["string","null"] + }, + "xcodeRunning": { + "type": ["boolean","null"] + }, + "xcodeSessionId": { + "type": ["string","null"] + } + }, + "required": ["workflowEnabled","bridgeAvailable","bridgePath","xcodeRunning","connected","bridgePid","proxiedToolCount","lastError","xcodePid","xcodeSessionId"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.xcode-bridge-sync/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "status": {"$ref":"#/$defs/bridgeStatus"}, + "sync": { + "additionalProperties": false, + "properties": { + "added": {"minimum":0,"type":"integer"}, + "removed": {"minimum":0,"type":"integer"}, + "total": {"minimum":0,"type":"integer"}, + "updated": {"minimum":0,"type":"integer"} + }, + "required": ["added","updated","removed","total"], + "type": "object" + } + }, + "required": ["sync","status"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.xcode-bridge-sync"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/batch.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/batch.json new file mode 100644 index 000000000..9873988e5 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/batch.json @@ -0,0 +1,491 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Batch UI Actions"}, + "description": "UI automation batch for multiple same-screen elementRef taps, especially visible settings switches that can be toggled without intermediate assertions. The input key is steps, never commands, and each step is an object such as {\"action\":\"tap\",\"elementRef\":\"e1\"}; do not pass raw command strings. Use refs from the latest snapshot_ui or wait_for_ui output, for example {\"steps\":[{\"action\":\"tap\",\"elementRef\":\"e1\"},{\"action\":\"tap\",\"elementRef\":\"e2\"}]}. Omit preDelay/postDelay for switch elementRefs; switches execute as touch down/up steps and reject delays.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "axCache": { + "enum": ["perBatch","perStep","none"], + "type": "string" + }, + "pollInterval": {"exclusiveMinimum":0,"type":"number"}, + "steps": { + "description": "Required array of step objects, for example [{\"action\":\"tap\",\"elementRef\":\"e1\"}]. Do not use commands or raw command strings.", + "items": { + "additionalProperties": false, + "properties": { + "action": {"const":"tap","type":"string"}, + "elementRef": {"description":"Runtime elementRef from the latest snapshot_ui or wait_for_ui output","minLength":1,"type":"string"}, + "postDelay": {"description":"Seconds after this step. Omit for switch elementRefs.","maximum":10,"minimum":0,"type":"number"}, + "preDelay": {"description":"Seconds before this step. Omit for switch elementRefs.","maximum":10,"minimum":0,"type":"number"} + }, + "required": ["action","elementRef"], + "type": "object" + }, + "maxItems": 100, + "minItems": 1, + "type": "array" + }, + "waitTimeout": {"minimum":0,"type":"number"} + }, + "required": ["steps"], + "type": "object" + }, + "name": "batch", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "compactRuntimeSnapshot": { + "additionalProperties": false, + "properties": { + "count": {"minimum":0,"type":"integer"}, + "evidence": { + "description": "Non-actionable semantic evidence rows in role|label|value|identifier format. These rows intentionally omit element refs.", + "items": {"type":"string"}, + "type": "array" + }, + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "scroll": { + "items": {"type":"string"}, + "type": "array" + }, + "seq": {"minimum":0,"type":"integer"}, + "targets": { + "items": {"type":"string"}, + "type": "array" + }, + "text": { + "items": {"type":"string"}, + "type": "array" + }, + "type": {"const":"runtime-snapshot"}, + "udid": {"type":"string"} + }, + "required": ["type","rs","screenHash","seq","count","targets","scroll","udid"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "direction": { + "enum": ["up","down","left","right"] + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "frame": { + "additionalProperties": false, + "properties": { + "height": {"type":"number"}, + "width": {"type":"number"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y","width","height"], + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "point": { + "additionalProperties": false, + "properties": { + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y"], + "type": "object" + }, + "recoverableUiError": { + "additionalProperties": false, + "properties": { + "candidates": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "code": { + "enum": ["SNAPSHOT_MISSING","SNAPSHOT_EXPIRED","SNAPSHOT_PARSE_FAILED","SNAPSHOT_CAPTURE_FAILED","ELEMENT_REF_NOT_FOUND","TARGET_NOT_FOUND","TARGET_AMBIGUOUS","TARGET_NOT_ACTIONABLE","WAIT_TIMEOUT","UI_STATE_CHANGED","ACTION_FAILED"] + }, + "elementRef": {"type":"string"}, + "message": {"type":"string"}, + "recoveryHint": {"type":"string"}, + "snapshotAgeMs": {"minimum":0,"type":"integer"}, + "timeoutMs": {"minimum":0,"type":"integer"} + }, + "required": ["code","message","recoveryHint"], + "type": "object" + }, + "runtimeActionName": { + "enum": ["tap","typeText","longPress","touch","swipeWithin"] + }, + "runtimeElement": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionName"}, + "type": "array" + }, + "frame": {"$ref":"#/$defs/frame"}, + "identifier": {"type":"string"}, + "label": {"type":"string"}, + "ref": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "role": {"$ref":"#/$defs/runtimeElementRole"}, + "state": {"$ref":"#/$defs/runtimeElementState"}, + "value": {"type":"string"} + }, + "required": ["ref","frame","actions"], + "type": "object" + }, + "runtimeElementRole": { + "enum": ["application","button","cell","image","keyboard-key","list","menu","other","scroll-view","slider","switch","tab","text","text-field","window"] + }, + "runtimeElementState": { + "additionalProperties": false, + "properties": { + "enabled": {"type":"boolean"}, + "focused": {"type":"boolean"}, + "selected": {"type":"boolean"}, + "visible": {"type":"boolean"} + }, + "type": "object" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.ui-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"}, + "withinElementRef": {"type":"string"} + }, + "required": ["type","withinElementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"} + }, + "required": ["type","from","to"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"swipe"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "elementRef": {"type":"string"}, + "from": {"$ref":"#/$defs/point"}, + "steps": {"minimum":1,"type":"integer"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"drag"} + }, + "required": ["type","elementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"touch"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "elementRef": {"type":"string"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "button": {"type":"string"}, + "type": {"const":"button"} + }, + "required": ["type","button"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "gesture": {"type":"string"}, + "type": {"const":"gesture"} + }, + "required": ["type","gesture"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCode": {"minimum":0,"type":"integer"}, + "type": {"const":"key-press"} + }, + "required": ["type","keyCode"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCodes": { + "items": {"minimum":0,"type":"integer"}, + "type": "array" + }, + "type": {"const":"key-sequence"} + }, + "required": ["type","keyCodes"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "stepCount": {"minimum":1,"type":"integer"}, + "type": {"const":"batch"} + }, + "required": ["type","stepCount"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "capture": {"$ref":"#/$defs/compactRuntimeSnapshot"}, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"}, + "uiError": {"$ref":"#/$defs/recoverableUiError"} + }, + "required": ["summary","action","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.ui-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/boot_sim.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/boot_sim.json new file mode 100644 index 000000000..97241b432 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/boot_sim.json @@ -0,0 +1,249 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Boot Simulator"}, + "description": "Boot iOS simulator for manual/non-build flows. Not required before simulator build-and-run (build_run_sim).", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": {}, + "type": "object" + }, + "name": "boot_sim", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.simulator-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "type": {"const":"boot"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"erase"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"open"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"reset-location"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "coordinates": { + "additionalProperties": false, + "properties": { + "latitude": {"maximum":90,"minimum":-90,"type":"number"}, + "longitude": {"maximum":180,"minimum":-180,"type":"number"} + }, + "required": ["latitude","longitude"], + "type": "object" + }, + "type": {"const":"set-location"} + }, + "required": ["type","coordinates"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "appearance": {"type":"string"}, + "type": {"const":"set-appearance"} + }, + "required": ["type","appearance"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "dataNetwork": {"type":"string"}, + "type": {"const":"statusbar"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-software-keyboard"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-connect-hardware-keyboard"} + }, + "required": ["type"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","action"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.simulator-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/build_device.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/build_device.json new file mode 100644 index 000000000..52a7e2f03 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/build_device.json @@ -0,0 +1,229 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Build Device"}, + "description": "Build for device.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "buildForTesting": {"description":"Build reusable test products without running tests (default: false)","type":"boolean"}, + "deviceId": {"description":"UDID of the destination device","type":"string"}, + "extraArgs": { + "items": {"type":"string"}, + "type": "array" + }, + "platform": { + "description": "Device platform: iOS, watchOS, tvOS, or visionOS. Defaults to iOS.", + "enum": ["iOS","watchOS","tvOS","visionOS"], + "type": "string" + }, + "testProductsPath": {"description":"Output path for the .xctestproducts bundle when buildForTesting is true","type":"string"} + }, + "type": "object" + }, + "name": "build_device", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "buildInvocationRequest": { + "additionalProperties": false, + "properties": { + "arch": {"type":"string"}, + "buildForTesting": {"type":"boolean"}, + "configuration": {"type":"string"}, + "derivedDataPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "executableName": {"type":"string"}, + "onlyTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulatorId": {"type":"string"}, + "simulatorName": {"type":"string"}, + "skipTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + }, + "targetName": {"type":"string"}, + "testProductsPath": {"type":"string"}, + "workspacePath": {"type":"string"}, + "xctestrunPath": {"type":"string"} + }, + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.build-result/3.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "anyOf": [ + { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appPath": {"type":"string"}, + "buildLogPath": {"type":"string"}, + "bundleId": {"type":"string"}, + "configuration": {"type":"string"}, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "scheme": {"type":"string"}, + "testProductsPath": {"type":"string"}, + "workspacePath": {"type":"string"}, + "xctestrunPaths": { + "items": {"type":"string"}, + "type": "array" + } + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "request": {"$ref":"#/$defs/buildInvocationRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + {"type":"null"} + ] + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.build-result"}, + "schemaVersion": {"const":"3"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/build_macos.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/build_macos.json new file mode 100644 index 000000000..455d02161 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/build_macos.json @@ -0,0 +1,223 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Build macOS"}, + "description": "Build macOS app.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "buildForTesting": {"description":"Build reusable test products without running tests (default: false)","type":"boolean"}, + "extraArgs": { + "items": {"type":"string"}, + "type": "array" + }, + "testProductsPath": {"description":"Output path for the .xctestproducts bundle when buildForTesting is true","type":"string"} + }, + "type": "object" + }, + "name": "build_macos", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "buildInvocationRequest": { + "additionalProperties": false, + "properties": { + "arch": {"type":"string"}, + "buildForTesting": {"type":"boolean"}, + "configuration": {"type":"string"}, + "derivedDataPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "executableName": {"type":"string"}, + "onlyTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulatorId": {"type":"string"}, + "simulatorName": {"type":"string"}, + "skipTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + }, + "targetName": {"type":"string"}, + "testProductsPath": {"type":"string"}, + "workspacePath": {"type":"string"}, + "xctestrunPath": {"type":"string"} + }, + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.build-result/3.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "anyOf": [ + { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appPath": {"type":"string"}, + "buildLogPath": {"type":"string"}, + "bundleId": {"type":"string"}, + "configuration": {"type":"string"}, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "scheme": {"type":"string"}, + "testProductsPath": {"type":"string"}, + "workspacePath": {"type":"string"}, + "xctestrunPaths": { + "items": {"type":"string"}, + "type": "array" + } + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "request": {"$ref":"#/$defs/buildInvocationRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + {"type":"null"} + ] + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.build-result"}, + "schemaVersion": {"const":"3"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/build_run_device.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/build_run_device.json new file mode 100644 index 000000000..97f8aada8 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/build_run_device.json @@ -0,0 +1,249 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Build Run Device"}, + "description": "Build, install, and launch on physical device. Preferred single-step run tool when defaults are set.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "env": { + "description": "Environment variables to pass to the launched app as key-value entries", + "items": { + "additionalProperties": false, + "properties": { + "key": {"minLength":1,"type":"string"}, + "value": {"type":"string"} + }, + "required": ["key","value"], + "type": "object" + }, + "type": "array" + }, + "extraArgs": { + "description": "Additional xcodebuild/build-settings arguments (not app launch arguments)", + "items": {"type":"string"}, + "type": "array" + }, + "launchArgs": { + "description": "Arguments passed to the launched app process on physical device runtime", + "items": {"type":"string"}, + "type": "array" + }, + "platform": { + "description": "Device platform: iOS, watchOS, tvOS, or visionOS. Defaults to iOS.", + "enum": ["iOS","watchOS","tvOS","visionOS"], + "type": "string" + } + }, + "type": "object" + }, + "name": "build_run_device", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "buildInvocationRequest": { + "additionalProperties": false, + "properties": { + "arch": {"type":"string"}, + "configuration": {"type":"string"}, + "derivedDataPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "executableName": {"type":"string"}, + "onlyTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulatorId": {"type":"string"}, + "simulatorName": {"type":"string"}, + "skipTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + }, + "targetName": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.build-run-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appPath": {"type":"string"}, + "buildLogPath": {"type":"string"}, + "bundleId": {"type":"string"}, + "deviceId": {"type":"string"}, + "executablePath": {"type":"string"}, + "osLogPath": {"type":"string"}, + "packagePath": {"type":"string"}, + "processId": {"minimum":1,"type":"integer"}, + "runtimeLogPath": {"type":"string"}, + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "output": { + "additionalProperties": false, + "properties": { + "stderr": { + "items": {"type":"string"}, + "type": "array" + }, + "stdout": { + "items": {"type":"string"}, + "type": "array" + } + }, + "required": ["stdout","stderr"], + "type": "object" + }, + "request": {"$ref":"#/$defs/buildInvocationRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.build-run-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/build_run_macos.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/build_run_macos.json new file mode 100644 index 000000000..35c28a928 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/build_run_macos.json @@ -0,0 +1,231 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Build Run macOS"}, + "description": "Build and run macOS app.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "extraArgs": { + "description": "Additional xcodebuild/build-settings arguments (not app launch arguments)", + "items": {"type":"string"}, + "type": "array" + }, + "launchArgs": { + "description": "Arguments passed to the launched app process on macOS runtime", + "items": {"type":"string"}, + "type": "array" + } + }, + "type": "object" + }, + "name": "build_run_macos", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "buildInvocationRequest": { + "additionalProperties": false, + "properties": { + "arch": {"type":"string"}, + "configuration": {"type":"string"}, + "derivedDataPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "executableName": {"type":"string"}, + "onlyTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulatorId": {"type":"string"}, + "simulatorName": {"type":"string"}, + "skipTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + }, + "targetName": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.build-run-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appPath": {"type":"string"}, + "buildLogPath": {"type":"string"}, + "bundleId": {"type":"string"}, + "deviceId": {"type":"string"}, + "executablePath": {"type":"string"}, + "osLogPath": {"type":"string"}, + "packagePath": {"type":"string"}, + "processId": {"minimum":1,"type":"integer"}, + "runtimeLogPath": {"type":"string"}, + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "output": { + "additionalProperties": false, + "properties": { + "stderr": { + "items": {"type":"string"}, + "type": "array" + }, + "stdout": { + "items": {"type":"string"}, + "type": "array" + } + }, + "required": ["stdout","stderr"], + "type": "object" + }, + "request": {"$ref":"#/$defs/buildInvocationRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.build-run-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/build_run_sim.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/build_run_sim.json new file mode 100644 index 000000000..aea99909c --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/build_run_sim.json @@ -0,0 +1,231 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Build Run Simulator"}, + "description": "Build, install, and launch on iOS Simulator, booting it when needed. Runtime logs are captured automatically and the log file path is included in the response. Preferred single-step run tool when defaults are set.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "extraArgs": { + "description": "Additional xcodebuild/build-settings arguments (not app launch arguments)", + "items": {"type":"string"}, + "type": "array" + }, + "launchArgs": { + "description": "Arguments passed to the launched app process on simulator runtime", + "items": {"type":"string"}, + "type": "array" + } + }, + "type": "object" + }, + "name": "build_run_sim", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "buildInvocationRequest": { + "additionalProperties": false, + "properties": { + "arch": {"type":"string"}, + "configuration": {"type":"string"}, + "derivedDataPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "executableName": {"type":"string"}, + "onlyTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulatorId": {"type":"string"}, + "simulatorName": {"type":"string"}, + "skipTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + }, + "targetName": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.build-run-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appPath": {"type":"string"}, + "buildLogPath": {"type":"string"}, + "bundleId": {"type":"string"}, + "deviceId": {"type":"string"}, + "executablePath": {"type":"string"}, + "osLogPath": {"type":"string"}, + "packagePath": {"type":"string"}, + "processId": {"minimum":1,"type":"integer"}, + "runtimeLogPath": {"type":"string"}, + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "output": { + "additionalProperties": false, + "properties": { + "stderr": { + "items": {"type":"string"}, + "type": "array" + }, + "stdout": { + "items": {"type":"string"}, + "type": "array" + } + }, + "required": ["stdout","stderr"], + "type": "object" + }, + "request": {"$ref":"#/$defs/buildInvocationRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.build-run-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/build_sim.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/build_sim.json new file mode 100644 index 000000000..0e7aa8f76 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/build_sim.json @@ -0,0 +1,223 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Build Simulator"}, + "description": "Build for iOS sim (compile-only, no launch).", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "buildForTesting": {"description":"Build reusable test products without running tests (default: false)","type":"boolean"}, + "extraArgs": { + "items": {"type":"string"}, + "type": "array" + }, + "testProductsPath": {"description":"Output path for the .xctestproducts bundle when buildForTesting is true","type":"string"} + }, + "type": "object" + }, + "name": "build_sim", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "buildInvocationRequest": { + "additionalProperties": false, + "properties": { + "arch": {"type":"string"}, + "buildForTesting": {"type":"boolean"}, + "configuration": {"type":"string"}, + "derivedDataPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "executableName": {"type":"string"}, + "onlyTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulatorId": {"type":"string"}, + "simulatorName": {"type":"string"}, + "skipTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + }, + "targetName": {"type":"string"}, + "testProductsPath": {"type":"string"}, + "workspacePath": {"type":"string"}, + "xctestrunPath": {"type":"string"} + }, + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.build-result/3.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "anyOf": [ + { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appPath": {"type":"string"}, + "buildLogPath": {"type":"string"}, + "bundleId": {"type":"string"}, + "configuration": {"type":"string"}, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "scheme": {"type":"string"}, + "testProductsPath": {"type":"string"}, + "workspacePath": {"type":"string"}, + "xctestrunPaths": { + "items": {"type":"string"}, + "type": "array" + } + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "request": {"$ref":"#/$defs/buildInvocationRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + {"type":"null"} + ] + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.build-result"}, + "schemaVersion": {"const":"3"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/button.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/button.json new file mode 100644 index 000000000..a2f4aba8a --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/button.json @@ -0,0 +1,474 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Hardware Button"}, + "description": "Press simulator hardware button.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "buttonType": { + "description": "apple-pay|home|lock|side-button|siri", + "enum": ["apple-pay","home","lock","side-button","siri"], + "type": "string" + }, + "duration": {"description":"seconds","maximum":10,"minimum":0,"type":"number"} + }, + "required": ["buttonType"], + "type": "object" + }, + "name": "button", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "compactRuntimeSnapshot": { + "additionalProperties": false, + "properties": { + "count": {"minimum":0,"type":"integer"}, + "evidence": { + "description": "Non-actionable semantic evidence rows in role|label|value|identifier format. These rows intentionally omit element refs.", + "items": {"type":"string"}, + "type": "array" + }, + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "scroll": { + "items": {"type":"string"}, + "type": "array" + }, + "seq": {"minimum":0,"type":"integer"}, + "targets": { + "items": {"type":"string"}, + "type": "array" + }, + "text": { + "items": {"type":"string"}, + "type": "array" + }, + "type": {"const":"runtime-snapshot"}, + "udid": {"type":"string"} + }, + "required": ["type","rs","screenHash","seq","count","targets","scroll","udid"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "direction": { + "enum": ["up","down","left","right"] + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "frame": { + "additionalProperties": false, + "properties": { + "height": {"type":"number"}, + "width": {"type":"number"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y","width","height"], + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "point": { + "additionalProperties": false, + "properties": { + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y"], + "type": "object" + }, + "recoverableUiError": { + "additionalProperties": false, + "properties": { + "candidates": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "code": { + "enum": ["SNAPSHOT_MISSING","SNAPSHOT_EXPIRED","SNAPSHOT_PARSE_FAILED","SNAPSHOT_CAPTURE_FAILED","ELEMENT_REF_NOT_FOUND","TARGET_NOT_FOUND","TARGET_AMBIGUOUS","TARGET_NOT_ACTIONABLE","WAIT_TIMEOUT","UI_STATE_CHANGED","ACTION_FAILED"] + }, + "elementRef": {"type":"string"}, + "message": {"type":"string"}, + "recoveryHint": {"type":"string"}, + "snapshotAgeMs": {"minimum":0,"type":"integer"}, + "timeoutMs": {"minimum":0,"type":"integer"} + }, + "required": ["code","message","recoveryHint"], + "type": "object" + }, + "runtimeActionName": { + "enum": ["tap","typeText","longPress","touch","swipeWithin"] + }, + "runtimeElement": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionName"}, + "type": "array" + }, + "frame": {"$ref":"#/$defs/frame"}, + "identifier": {"type":"string"}, + "label": {"type":"string"}, + "ref": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "role": {"$ref":"#/$defs/runtimeElementRole"}, + "state": {"$ref":"#/$defs/runtimeElementState"}, + "value": {"type":"string"} + }, + "required": ["ref","frame","actions"], + "type": "object" + }, + "runtimeElementRole": { + "enum": ["application","button","cell","image","keyboard-key","list","menu","other","scroll-view","slider","switch","tab","text","text-field","window"] + }, + "runtimeElementState": { + "additionalProperties": false, + "properties": { + "enabled": {"type":"boolean"}, + "focused": {"type":"boolean"}, + "selected": {"type":"boolean"}, + "visible": {"type":"boolean"} + }, + "type": "object" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.ui-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"}, + "withinElementRef": {"type":"string"} + }, + "required": ["type","withinElementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"} + }, + "required": ["type","from","to"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"swipe"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "elementRef": {"type":"string"}, + "from": {"$ref":"#/$defs/point"}, + "steps": {"minimum":1,"type":"integer"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"drag"} + }, + "required": ["type","elementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"touch"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "elementRef": {"type":"string"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "button": {"type":"string"}, + "type": {"const":"button"} + }, + "required": ["type","button"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "gesture": {"type":"string"}, + "type": {"const":"gesture"} + }, + "required": ["type","gesture"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCode": {"minimum":0,"type":"integer"}, + "type": {"const":"key-press"} + }, + "required": ["type","keyCode"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCodes": { + "items": {"minimum":0,"type":"integer"}, + "type": "array" + }, + "type": {"const":"key-sequence"} + }, + "required": ["type","keyCodes"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "stepCount": {"minimum":1,"type":"integer"}, + "type": {"const":"batch"} + }, + "required": ["type","stepCount"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "capture": {"$ref":"#/$defs/compactRuntimeSnapshot"}, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"}, + "uiError": {"$ref":"#/$defs/recoverableUiError"} + }, + "required": ["summary","action","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.ui-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/clean.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/clean.json new file mode 100644 index 000000000..7cc5f0439 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/clean.json @@ -0,0 +1,217 @@ +{ + "annotations": {"destructiveHint":true,"openWorldHint":false,"readOnlyHint":false,"title":"Clean"}, + "description": "Clean build products.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "extraArgs": { + "items": {"type":"string"}, + "type": "array" + }, + "platform": { + "enum": ["macOS","iOS","iOS Simulator","watchOS","watchOS Simulator","tvOS","tvOS Simulator","visionOS","visionOS Simulator"], + "type": "string" + } + }, + "type": "object" + }, + "name": "clean", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "buildInvocationRequest": { + "additionalProperties": false, + "properties": { + "arch": {"type":"string"}, + "configuration": {"type":"string"}, + "derivedDataPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "executableName": {"type":"string"}, + "onlyTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulatorId": {"type":"string"}, + "simulatorName": {"type":"string"}, + "skipTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + }, + "targetName": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.build-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "anyOf": [ + { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appPath": {"type":"string"}, + "buildLogPath": {"type":"string"}, + "bundleId": {"type":"string"}, + "configuration": {"type":"string"}, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "scheme": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "request": {"$ref":"#/$defs/buildInvocationRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + {"type":"null"} + ] + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.build-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/debug_attach_sim.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/debug_attach_sim.json new file mode 100644 index 000000000..5d0af8b1a --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/debug_attach_sim.json @@ -0,0 +1,175 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Debug Attach Sim"}, + "description": "Attach LLDB to sim app.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "bundleId": {"description":"Attach by bundle identifier. Provide bundleId without pid; waitFor may be used with this mode.","type":"string"}, + "continueOnAttach": {"default":true,"description":"default: true","type":"boolean"}, + "makeCurrent": {"default":true,"description":"Set debug session as current (default: true)","type":"boolean"}, + "pid": {"description":"Attach to an already-running process by PID. Provide pid without bundleId and without waitFor.","exclusiveMinimum":0,"maximum":9007199254740991,"type":"integer"}, + "waitFor": {"description":"Only valid when attaching by bundleId. For PID attach, omit waitFor or set it to false.","type":"boolean"} + }, + "type": "object" + }, + "name": "debug_attach_sim", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.debug-session-action/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "enum": ["attach","continue","detach"] + }, + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "processId": {"minimum":1,"type":"integer"}, + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "session": { + "additionalProperties": false, + "properties": { + "connectionState": { + "enum": ["attached","detached"] + }, + "debugSessionId": {"type":"string"}, + "executionState": { + "enum": ["paused","running"] + } + }, + "required": ["debugSessionId","connectionState"], + "type": "object" + } + }, + "required": ["action"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.debug-session-action"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/debug_breakpoint_add.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/debug_breakpoint_add.json new file mode 100644 index 000000000..7f1141650 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/debug_breakpoint_add.json @@ -0,0 +1,220 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Debug Breakpoint Add"}, + "description": "Add breakpoint.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "condition": {"description":"Expression for breakpoint condition","type":"string"}, + "debugSessionId": {"description":"default: current session","type":"string"}, + "file": {"type":"string"}, + "function": {"type":"string"}, + "line": {"exclusiveMinimum":0,"maximum":9007199254740991,"type":"integer"} + }, + "type": "object" + }, + "name": "debug_breakpoint_add", + "outputSchema": { + "$defs": { + "addFileLineBreakpoint": { + "additionalProperties": false, + "properties": { + "breakpointId": {"minimum":1,"type":"integer"}, + "file": {"type":"string"}, + "kind": {"const":"file-line"}, + "line": {"minimum":1,"type":"integer"} + }, + "required": ["kind","file","line"], + "type": "object" + }, + "addFunctionBreakpoint": { + "additionalProperties": false, + "properties": { + "breakpointId": {"minimum":1,"type":"integer"}, + "kind": {"const":"function"}, + "name": {"type":"string"} + }, + "required": ["kind","name"], + "type": "object" + }, + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "removeBreakpoint": { + "additionalProperties": false, + "properties": { + "breakpointId": {"minimum":1,"type":"integer"} + }, + "required": ["breakpointId"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.debug-breakpoint-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "allOf": [ + { + "if": { + "properties": { + "action": {"const":"add"} + }, + "required": ["action"] + }, + "then": { + "properties": { + "breakpoint": { + "oneOf": [ + {"$ref":"#/$defs/addFileLineBreakpoint"}, + {"$ref":"#/$defs/addFunctionBreakpoint"} + ] + } + } + } + }, + { + "if": { + "properties": { + "action": {"const":"remove"} + }, + "required": ["action"] + }, + "then": { + "properties": { + "breakpoint": {"$ref":"#/$defs/removeBreakpoint"} + } + } + } + ], + "properties": { + "action": { + "enum": ["add","remove"] + }, + "breakpoint": { + "oneOf": [ + {"$ref":"#/$defs/addFileLineBreakpoint"}, + {"$ref":"#/$defs/addFunctionBreakpoint"}, + {"$ref":"#/$defs/removeBreakpoint"} + ] + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"} + }, + "required": ["action","breakpoint"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.debug-breakpoint-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/debug_breakpoint_remove.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/debug_breakpoint_remove.json new file mode 100644 index 000000000..c5dfc6df0 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/debug_breakpoint_remove.json @@ -0,0 +1,218 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Debug Breakpoint Remove"}, + "description": "Remove breakpoint.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "breakpointId": {"exclusiveMinimum":0,"maximum":9007199254740991,"type":"integer"}, + "debugSessionId": {"description":"default: current session","type":"string"} + }, + "required": ["breakpointId"], + "type": "object" + }, + "name": "debug_breakpoint_remove", + "outputSchema": { + "$defs": { + "addFileLineBreakpoint": { + "additionalProperties": false, + "properties": { + "breakpointId": {"minimum":1,"type":"integer"}, + "file": {"type":"string"}, + "kind": {"const":"file-line"}, + "line": {"minimum":1,"type":"integer"} + }, + "required": ["kind","file","line"], + "type": "object" + }, + "addFunctionBreakpoint": { + "additionalProperties": false, + "properties": { + "breakpointId": {"minimum":1,"type":"integer"}, + "kind": {"const":"function"}, + "name": {"type":"string"} + }, + "required": ["kind","name"], + "type": "object" + }, + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "removeBreakpoint": { + "additionalProperties": false, + "properties": { + "breakpointId": {"minimum":1,"type":"integer"} + }, + "required": ["breakpointId"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.debug-breakpoint-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "allOf": [ + { + "if": { + "properties": { + "action": {"const":"add"} + }, + "required": ["action"] + }, + "then": { + "properties": { + "breakpoint": { + "oneOf": [ + {"$ref":"#/$defs/addFileLineBreakpoint"}, + {"$ref":"#/$defs/addFunctionBreakpoint"} + ] + } + } + } + }, + { + "if": { + "properties": { + "action": {"const":"remove"} + }, + "required": ["action"] + }, + "then": { + "properties": { + "breakpoint": {"$ref":"#/$defs/removeBreakpoint"} + } + } + } + ], + "properties": { + "action": { + "enum": ["add","remove"] + }, + "breakpoint": { + "oneOf": [ + {"$ref":"#/$defs/addFileLineBreakpoint"}, + {"$ref":"#/$defs/addFunctionBreakpoint"}, + {"$ref":"#/$defs/removeBreakpoint"} + ] + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"} + }, + "required": ["action","breakpoint"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.debug-breakpoint-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/debug_continue.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/debug_continue.json new file mode 100644 index 000000000..0e891f749 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/debug_continue.json @@ -0,0 +1,171 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Debug Continue"}, + "description": "Continue debug session.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "debugSessionId": {"description":"default: current session","type":"string"} + }, + "type": "object" + }, + "name": "debug_continue", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.debug-session-action/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "enum": ["attach","continue","detach"] + }, + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "processId": {"minimum":1,"type":"integer"}, + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "session": { + "additionalProperties": false, + "properties": { + "connectionState": { + "enum": ["attached","detached"] + }, + "debugSessionId": {"type":"string"}, + "executionState": { + "enum": ["paused","running"] + } + }, + "required": ["debugSessionId","connectionState"], + "type": "object" + } + }, + "required": ["action"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.debug-session-action"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/debug_detach.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/debug_detach.json new file mode 100644 index 000000000..d0755f380 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/debug_detach.json @@ -0,0 +1,171 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Debug Detach"}, + "description": "Detach debugger.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "debugSessionId": {"description":"default: current session","type":"string"} + }, + "type": "object" + }, + "name": "debug_detach", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.debug-session-action/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "enum": ["attach","continue","detach"] + }, + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "processId": {"minimum":1,"type":"integer"}, + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "session": { + "additionalProperties": false, + "properties": { + "connectionState": { + "enum": ["attached","detached"] + }, + "debugSessionId": {"type":"string"}, + "executionState": { + "enum": ["paused","running"] + } + }, + "required": ["debugSessionId","connectionState"], + "type": "object" + } + }, + "required": ["action"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.debug-session-action"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/debug_lldb_command.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/debug_lldb_command.json new file mode 100644 index 000000000..daae7d690 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/debug_lldb_command.json @@ -0,0 +1,152 @@ +{ + "annotations": {"destructiveHint":true,"openWorldHint":false,"readOnlyHint":false,"title":"Debug LLDB Command"}, + "description": "Run LLDB command.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "command": {"type":"string"}, + "debugSessionId": {"description":"default: current session","type":"string"}, + "timeoutMs": {"exclusiveMinimum":0,"maximum":9007199254740991,"type":"integer"} + }, + "required": ["command"], + "type": "object" + }, + "name": "debug_lldb_command", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.debug-command-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "command": {"type":"string"}, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "outputLines": { + "items": {"type":"string"}, + "type": "array" + } + }, + "required": ["command","outputLines"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.debug-command-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/debug_stack.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/debug_stack.json new file mode 100644 index 000000000..806dae5b3 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/debug_stack.json @@ -0,0 +1,184 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Debug Stack"}, + "description": "Get backtrace.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "debugSessionId": {"description":"default: current session","type":"string"}, + "maxFrames": {"exclusiveMinimum":0,"maximum":9007199254740991,"type":"integer"}, + "threadIndex": {"maximum":9007199254740991,"minimum":0,"type":"integer"} + }, + "type": "object" + }, + "name": "debug_stack", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.debug-stack-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "anyOf": [ + { + "additionalProperties": false, + "properties": { + "threads": { + "items": { + "additionalProperties": false, + "properties": { + "frames": { + "items": { + "additionalProperties": false, + "properties": { + "displayLocation": {"type":"string"}, + "index": {"minimum":0,"type":"integer"}, + "symbol": {"type":"string"} + }, + "required": ["index","symbol","displayLocation"], + "type": "object" + }, + "type": "array" + }, + "name": {"type":"string"}, + "threadId": {"minimum":1,"type":"integer"}, + "truncated": {"type":"boolean"} + }, + "required": ["threadId","name","truncated","frames"], + "type": "object" + }, + "type": "array" + } + }, + "required": ["threads"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"} + }, + "required": ["diagnostics"], + "type": "object" + }, + {"type":"null"} + ] + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.debug-stack-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/debug_variables.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/debug_variables.json new file mode 100644 index 000000000..1f3675346 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/debug_variables.json @@ -0,0 +1,208 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Debug Variables"}, + "description": "Get frame variables.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "debugSessionId": {"description":"default: current session","type":"string"}, + "frameIndex": {"maximum":9007199254740991,"minimum":0,"type":"integer"} + }, + "type": "object" + }, + "name": "debug_variables", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.debug-variables-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "anyOf": [ + { + "additionalProperties": false, + "properties": { + "scopes": { + "additionalProperties": false, + "properties": { + "globals": { + "additionalProperties": false, + "properties": { + "variables": { + "items": {"additionalProperties":true,"type":"object"}, + "type": "array" + } + }, + "required": ["variables"], + "type": "object" + }, + "locals": { + "additionalProperties": false, + "properties": { + "variables": { + "items": {"additionalProperties":true,"type":"object"}, + "type": "array" + } + }, + "required": ["variables"], + "type": "object" + }, + "registers": { + "additionalProperties": false, + "properties": { + "groups": { + "items": { + "additionalProperties": false, + "properties": { + "name": {"type":"string"}, + "variables": { + "items": {"additionalProperties":true,"type":"object"}, + "type": "array" + } + }, + "required": ["name","variables"], + "type": "object" + }, + "type": "array" + } + }, + "required": ["groups"], + "type": "object" + } + }, + "required": ["locals","globals","registers"], + "type": "object" + } + }, + "required": ["scopes"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"} + }, + "required": ["diagnostics"], + "type": "object" + }, + {"type":"null"} + ] + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.debug-variables-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/discover_projs.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/discover_projs.json new file mode 100644 index 000000000..101b6707b --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/discover_projs.json @@ -0,0 +1,185 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Discover Projects"}, + "description": "Scans a directory (defaults to workspace root) to find Xcode project (.xcodeproj) and workspace (.xcworkspace) files. Use when project/workspace path is unknown.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "maxDepth": {"maximum":9007199254740991,"minimum":0,"type":"integer"}, + "scanPath": {"type":"string"}, + "workspaceRoot": {"type":"string"} + }, + "required": ["workspaceRoot"], + "type": "object" + }, + "name": "discover_projs", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "pathItem": { + "additionalProperties": false, + "properties": { + "path": {"type":"string"} + }, + "required": ["path"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.project-list/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "scanPath": {"type":"string"}, + "workspaceRoot": {"type":"string"} + }, + "required": ["workspaceRoot","scanPath"], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "projects": { + "items": {"$ref":"#/$defs/pathItem"}, + "type": "array" + }, + "summary": { + "additionalProperties": false, + "properties": { + "maxDepth": {"minimum":0,"type":"integer"}, + "projectCount": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "workspaceCount": {"minimum":0,"type":"integer"} + }, + "required": ["status","maxDepth"], + "type": "object" + }, + "workspaces": { + "items": {"$ref":"#/$defs/pathItem"}, + "type": "array" + } + }, + "required": ["summary","artifacts","projects","workspaces"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.project-list"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/doctor.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/doctor.json new file mode 100644 index 000000000..3133f2a19 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/doctor.json @@ -0,0 +1,167 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Doctor"}, + "description": "MCP environment info.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "nonRedacted": {"description":"Opt-in: when true, disable redaction and include full raw doctor output.","type":"boolean"} + }, + "type": "object" + }, + "name": "doctor", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.doctor-report/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "description": "Structured output envelope for environment and dependency diagnostics.", + "properties": { + "data": { + "anyOf": [ + { + "additionalProperties": false, + "properties": { + "checks": { + "items": { + "additionalProperties": false, + "properties": { + "message": {"type":"string"}, + "name": {"type":"string"}, + "status": { + "enum": ["ok","warning","error"] + } + }, + "required": ["name","status","message"], + "type": "object" + }, + "type": "array" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "serverVersion": {"type":"string"} + }, + "required": ["serverVersion","checks"], + "type": "object" + }, + {"type":"null"} + ] + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.doctor-report"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "title": "Doctor Report", + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/drag.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/drag.json new file mode 100644 index 000000000..331b8c3ee --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/drag.json @@ -0,0 +1,479 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Drag"}, + "description": "Drag from a visible runtime elementRef in a direction, then return a refreshed runtime UI snapshot. Use this for exposed sheet grabbers or real scroll/list content refs when nextSteps suggests dragging; do not use raw screen coordinates.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "direction": { + "description": "Drag direction: up, down, left, or right", + "enum": ["up","down","left","right"], + "type": "string" + }, + "distance": {"description":"Normalized drag distance greater than 0 and up to 1 within the resolved element or viewport","exclusiveMinimum":0,"maximum":1,"type":"number"}, + "duration": {"description":"seconds","exclusiveMinimum":0,"type":"number"}, + "elementRef": {"description":"Runtime elementRef from the latest snapshot_ui or wait_for_ui output","minLength":1,"type":"string"}, + "postDelay": {"description":"seconds","maximum":10,"minimum":0,"type":"number"}, + "preDelay": {"description":"seconds","maximum":10,"minimum":0,"type":"number"}, + "steps": {"maximum":1000,"minimum":1,"type":"integer"} + }, + "required": ["elementRef","direction"], + "type": "object" + }, + "name": "drag", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "compactRuntimeSnapshot": { + "additionalProperties": false, + "properties": { + "count": {"minimum":0,"type":"integer"}, + "evidence": { + "description": "Non-actionable semantic evidence rows in role|label|value|identifier format. These rows intentionally omit element refs.", + "items": {"type":"string"}, + "type": "array" + }, + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "scroll": { + "items": {"type":"string"}, + "type": "array" + }, + "seq": {"minimum":0,"type":"integer"}, + "targets": { + "items": {"type":"string"}, + "type": "array" + }, + "text": { + "items": {"type":"string"}, + "type": "array" + }, + "type": {"const":"runtime-snapshot"}, + "udid": {"type":"string"} + }, + "required": ["type","rs","screenHash","seq","count","targets","scroll","udid"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "direction": { + "enum": ["up","down","left","right"] + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "frame": { + "additionalProperties": false, + "properties": { + "height": {"type":"number"}, + "width": {"type":"number"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y","width","height"], + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "point": { + "additionalProperties": false, + "properties": { + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y"], + "type": "object" + }, + "recoverableUiError": { + "additionalProperties": false, + "properties": { + "candidates": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "code": { + "enum": ["SNAPSHOT_MISSING","SNAPSHOT_EXPIRED","SNAPSHOT_PARSE_FAILED","SNAPSHOT_CAPTURE_FAILED","ELEMENT_REF_NOT_FOUND","TARGET_NOT_FOUND","TARGET_AMBIGUOUS","TARGET_NOT_ACTIONABLE","WAIT_TIMEOUT","UI_STATE_CHANGED","ACTION_FAILED"] + }, + "elementRef": {"type":"string"}, + "message": {"type":"string"}, + "recoveryHint": {"type":"string"}, + "snapshotAgeMs": {"minimum":0,"type":"integer"}, + "timeoutMs": {"minimum":0,"type":"integer"} + }, + "required": ["code","message","recoveryHint"], + "type": "object" + }, + "runtimeActionName": { + "enum": ["tap","typeText","longPress","touch","swipeWithin"] + }, + "runtimeElement": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionName"}, + "type": "array" + }, + "frame": {"$ref":"#/$defs/frame"}, + "identifier": {"type":"string"}, + "label": {"type":"string"}, + "ref": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "role": {"$ref":"#/$defs/runtimeElementRole"}, + "state": {"$ref":"#/$defs/runtimeElementState"}, + "value": {"type":"string"} + }, + "required": ["ref","frame","actions"], + "type": "object" + }, + "runtimeElementRole": { + "enum": ["application","button","cell","image","keyboard-key","list","menu","other","scroll-view","slider","switch","tab","text","text-field","window"] + }, + "runtimeElementState": { + "additionalProperties": false, + "properties": { + "enabled": {"type":"boolean"}, + "focused": {"type":"boolean"}, + "selected": {"type":"boolean"}, + "visible": {"type":"boolean"} + }, + "type": "object" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.ui-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"}, + "withinElementRef": {"type":"string"} + }, + "required": ["type","withinElementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"} + }, + "required": ["type","from","to"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"swipe"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "elementRef": {"type":"string"}, + "from": {"$ref":"#/$defs/point"}, + "steps": {"minimum":1,"type":"integer"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"drag"} + }, + "required": ["type","elementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"touch"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "elementRef": {"type":"string"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "button": {"type":"string"}, + "type": {"const":"button"} + }, + "required": ["type","button"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "gesture": {"type":"string"}, + "type": {"const":"gesture"} + }, + "required": ["type","gesture"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCode": {"minimum":0,"type":"integer"}, + "type": {"const":"key-press"} + }, + "required": ["type","keyCode"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCodes": { + "items": {"minimum":0,"type":"integer"}, + "type": "array" + }, + "type": {"const":"key-sequence"} + }, + "required": ["type","keyCodes"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "stepCount": {"minimum":1,"type":"integer"}, + "type": {"const":"batch"} + }, + "required": ["type","stepCount"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "capture": {"$ref":"#/$defs/compactRuntimeSnapshot"}, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"}, + "uiError": {"$ref":"#/$defs/recoverableUiError"} + }, + "required": ["summary","action","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.ui-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/erase_sims.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/erase_sims.json new file mode 100644 index 000000000..c98f191aa --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/erase_sims.json @@ -0,0 +1,251 @@ +{ + "annotations": {"destructiveHint":true,"openWorldHint":false,"readOnlyHint":false,"title":"Erase Simulators"}, + "description": "Erase simulator.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "shutdownFirst": {"type":"boolean"} + }, + "type": "object" + }, + "name": "erase_sims", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.simulator-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "type": {"const":"boot"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"erase"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"open"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"reset-location"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "coordinates": { + "additionalProperties": false, + "properties": { + "latitude": {"maximum":90,"minimum":-90,"type":"number"}, + "longitude": {"maximum":180,"minimum":-180,"type":"number"} + }, + "required": ["latitude","longitude"], + "type": "object" + }, + "type": {"const":"set-location"} + }, + "required": ["type","coordinates"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "appearance": {"type":"string"}, + "type": {"const":"set-appearance"} + }, + "required": ["type","appearance"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "dataNetwork": {"type":"string"}, + "type": {"const":"statusbar"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-software-keyboard"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-connect-hardware-keyboard"} + }, + "required": ["type"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","action"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.simulator-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/gesture.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/gesture.json new file mode 100644 index 000000000..32af71073 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/gesture.json @@ -0,0 +1,479 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Gesture"}, + "description": "Simulator gesture preset.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "delta": {"description":"Distance to move in pixels.","maximum":200,"minimum":0,"type":"number"}, + "duration": {"description":"Duration of the gesture in seconds.","maximum":10,"minimum":0,"type":"number"}, + "postDelay": {"description":"Delay after completing the gesture in seconds.","maximum":10,"minimum":0,"type":"number"}, + "preDelay": {"description":"Delay before starting the gesture in seconds.","maximum":10,"minimum":0,"type":"number"}, + "preset": { + "description": "scroll-up|scroll-down|scroll-left|scroll-right|swipe-from-left-edge|swipe-from-right-edge|swipe-from-top-edge|swipe-from-bottom-edge", + "enum": ["scroll-up","scroll-down","scroll-left","scroll-right","swipe-from-left-edge","swipe-from-right-edge","swipe-from-top-edge","swipe-from-bottom-edge"], + "type": "string" + }, + "screenHeight": {"description":"Screen height in pixels. Used for gesture calculations. Auto-detected if not provided.","maximum":3000,"minimum":1,"type":"integer"}, + "screenWidth": {"description":"Screen width in pixels. Used for gesture calculations. Auto-detected if not provided.","maximum":2000,"minimum":1,"type":"integer"} + }, + "required": ["preset"], + "type": "object" + }, + "name": "gesture", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "compactRuntimeSnapshot": { + "additionalProperties": false, + "properties": { + "count": {"minimum":0,"type":"integer"}, + "evidence": { + "description": "Non-actionable semantic evidence rows in role|label|value|identifier format. These rows intentionally omit element refs.", + "items": {"type":"string"}, + "type": "array" + }, + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "scroll": { + "items": {"type":"string"}, + "type": "array" + }, + "seq": {"minimum":0,"type":"integer"}, + "targets": { + "items": {"type":"string"}, + "type": "array" + }, + "text": { + "items": {"type":"string"}, + "type": "array" + }, + "type": {"const":"runtime-snapshot"}, + "udid": {"type":"string"} + }, + "required": ["type","rs","screenHash","seq","count","targets","scroll","udid"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "direction": { + "enum": ["up","down","left","right"] + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "frame": { + "additionalProperties": false, + "properties": { + "height": {"type":"number"}, + "width": {"type":"number"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y","width","height"], + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "point": { + "additionalProperties": false, + "properties": { + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y"], + "type": "object" + }, + "recoverableUiError": { + "additionalProperties": false, + "properties": { + "candidates": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "code": { + "enum": ["SNAPSHOT_MISSING","SNAPSHOT_EXPIRED","SNAPSHOT_PARSE_FAILED","SNAPSHOT_CAPTURE_FAILED","ELEMENT_REF_NOT_FOUND","TARGET_NOT_FOUND","TARGET_AMBIGUOUS","TARGET_NOT_ACTIONABLE","WAIT_TIMEOUT","UI_STATE_CHANGED","ACTION_FAILED"] + }, + "elementRef": {"type":"string"}, + "message": {"type":"string"}, + "recoveryHint": {"type":"string"}, + "snapshotAgeMs": {"minimum":0,"type":"integer"}, + "timeoutMs": {"minimum":0,"type":"integer"} + }, + "required": ["code","message","recoveryHint"], + "type": "object" + }, + "runtimeActionName": { + "enum": ["tap","typeText","longPress","touch","swipeWithin"] + }, + "runtimeElement": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionName"}, + "type": "array" + }, + "frame": {"$ref":"#/$defs/frame"}, + "identifier": {"type":"string"}, + "label": {"type":"string"}, + "ref": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "role": {"$ref":"#/$defs/runtimeElementRole"}, + "state": {"$ref":"#/$defs/runtimeElementState"}, + "value": {"type":"string"} + }, + "required": ["ref","frame","actions"], + "type": "object" + }, + "runtimeElementRole": { + "enum": ["application","button","cell","image","keyboard-key","list","menu","other","scroll-view","slider","switch","tab","text","text-field","window"] + }, + "runtimeElementState": { + "additionalProperties": false, + "properties": { + "enabled": {"type":"boolean"}, + "focused": {"type":"boolean"}, + "selected": {"type":"boolean"}, + "visible": {"type":"boolean"} + }, + "type": "object" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.ui-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"}, + "withinElementRef": {"type":"string"} + }, + "required": ["type","withinElementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"} + }, + "required": ["type","from","to"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"swipe"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "elementRef": {"type":"string"}, + "from": {"$ref":"#/$defs/point"}, + "steps": {"minimum":1,"type":"integer"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"drag"} + }, + "required": ["type","elementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"touch"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "elementRef": {"type":"string"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "button": {"type":"string"}, + "type": {"const":"button"} + }, + "required": ["type","button"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "gesture": {"type":"string"}, + "type": {"const":"gesture"} + }, + "required": ["type","gesture"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCode": {"minimum":0,"type":"integer"}, + "type": {"const":"key-press"} + }, + "required": ["type","keyCode"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCodes": { + "items": {"minimum":0,"type":"integer"}, + "type": "array" + }, + "type": {"const":"key-sequence"} + }, + "required": ["type","keyCodes"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "stepCount": {"minimum":1,"type":"integer"}, + "type": {"const":"batch"} + }, + "required": ["type","stepCount"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "capture": {"$ref":"#/$defs/compactRuntimeSnapshot"}, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"}, + "uiError": {"$ref":"#/$defs/recoverableUiError"} + }, + "required": ["summary","action","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.ui-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/get_app_bundle_id.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/get_app_bundle_id.json new file mode 100644 index 000000000..a572f2ce6 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/get_app_bundle_id.json @@ -0,0 +1,154 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Get App Bundle ID"}, + "description": "Extract bundle id from .app.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "appPath": {"description":"Path to the .app bundle","type":"string"} + }, + "required": ["appPath"], + "type": "object" + }, + "name": "get_app_bundle_id", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.bundle-id/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "appPath": {"type":"string"}, + "bundleId": {"type":"string"} + }, + "required": ["appPath"], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"} + }, + "required": ["artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.bundle-id"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/get_coverage_report.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/get_coverage_report.json new file mode 100644 index 000000000..910b56372 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/get_coverage_report.json @@ -0,0 +1,228 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Get Coverage Report"}, + "description": "Show per-target code coverage from an xcresult bundle.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "showFiles": {"default":false,"description":"When true, include per-file coverage breakdown under each target","type":"boolean"}, + "target": {"description":"Filter results to a specific target name","type":"string"}, + "xcresultPath": {"description":"Path to the .xcresult bundle","type":"string"} + }, + "required": ["xcresultPath"], + "type": "object" + }, + "name": "get_coverage_report", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.coverage-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "file": {"type":"string"}, + "sourceFilePath": {"type":"string"}, + "target": {"type":"string"}, + "xcresultPath": {"type":"string"} + }, + "required": ["xcresultPath"], + "type": "object" + }, + "coverageScope": { + "enum": ["report","file"] + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "functions": { + "additionalProperties": false, + "properties": { + "fullCoverageCount": {"minimum":0,"type":"integer"}, + "notCovered": { + "items": { + "additionalProperties": false, + "properties": { + "coveredLines": {"minimum":0,"type":"integer"}, + "executableLines": {"minimum":0,"type":"integer"}, + "line": {"minimum":1,"type":"integer"}, + "name": {"type":"string"} + }, + "required": ["line","name","coveredLines","executableLines"], + "type": "object" + }, + "type": "array" + }, + "notCoveredFunctionCount": {"minimum":0,"type":"integer"}, + "notCoveredLineCount": {"minimum":0,"type":"integer"}, + "partialCoverage": { + "items": { + "additionalProperties": false, + "properties": { + "coveragePct": {"maximum":100,"minimum":0,"type":"number"}, + "coveredLines": {"minimum":0,"type":"integer"}, + "executableLines": {"minimum":0,"type":"integer"}, + "line": {"minimum":1,"type":"integer"}, + "name": {"type":"string"} + }, + "required": ["line","name","coveragePct","coveredLines","executableLines"], + "type": "object" + }, + "type": "array" + }, + "partialCoverageFunctionCount": {"minimum":0,"type":"integer"} + }, + "required": ["fullCoverageCount","notCoveredFunctionCount","notCoveredLineCount","partialCoverageFunctionCount"], + "type": "object" + }, + "summary": { + "additionalProperties": false, + "properties": { + "coveragePct": {"maximum":100,"minimum":0,"type":"number"}, + "coveredLines": {"minimum":0,"type":"integer"}, + "executableLines": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + }, + "targets": { + "items": { + "additionalProperties": false, + "properties": { + "coveragePct": {"maximum":100,"minimum":0,"type":"number"}, + "coveredLines": {"minimum":0,"type":"integer"}, + "executableLines": {"minimum":0,"type":"integer"}, + "name": {"type":"string"} + }, + "required": ["name","coveragePct","coveredLines","executableLines"], + "type": "object" + }, + "type": "array" + } + }, + "required": ["summary","coverageScope","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.coverage-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/get_device_app_path.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/get_device_app_path.json new file mode 100644 index 000000000..decd2d41f --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/get_device_app_path.json @@ -0,0 +1,193 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Get Device App Path"}, + "description": "Get device built app path.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "platform": { + "description": "Device platform: iOS, watchOS, tvOS, or visionOS. Defaults to iOS.", + "enum": ["iOS","watchOS","tvOS","visionOS"], + "type": "string" + } + }, + "type": "object" + }, + "name": "get_device_app_path", + "outputSchema": { + "$defs": { + "appPathRequest": { + "additionalProperties": false, + "properties": { + "configuration": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulator": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "type": "object" + }, + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.app-path/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "anyOf": [ + { + "properties": {"artifacts":true}, + "required": ["artifacts"] + }, + { + "properties": {"diagnostics":true}, + "required": ["diagnostics"] + } + ], + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "appPath": {"type":"string"} + }, + "required": ["appPath"], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "request": {"$ref":"#/$defs/appPathRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "required": [], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.app-path"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/get_file_coverage.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/get_file_coverage.json new file mode 100644 index 000000000..940ddf6f7 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/get_file_coverage.json @@ -0,0 +1,228 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Get File Coverage"}, + "description": "Show function-level coverage and uncovered line ranges for a specific file.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "file": {"description":"Source file name or path to inspect","type":"string"}, + "showLines": {"default":false,"description":"When true, include uncovered line ranges from the archive","type":"boolean"}, + "xcresultPath": {"description":"Path to the .xcresult bundle","type":"string"} + }, + "required": ["xcresultPath","file"], + "type": "object" + }, + "name": "get_file_coverage", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.coverage-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "file": {"type":"string"}, + "sourceFilePath": {"type":"string"}, + "target": {"type":"string"}, + "xcresultPath": {"type":"string"} + }, + "required": ["xcresultPath"], + "type": "object" + }, + "coverageScope": { + "enum": ["report","file"] + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "functions": { + "additionalProperties": false, + "properties": { + "fullCoverageCount": {"minimum":0,"type":"integer"}, + "notCovered": { + "items": { + "additionalProperties": false, + "properties": { + "coveredLines": {"minimum":0,"type":"integer"}, + "executableLines": {"minimum":0,"type":"integer"}, + "line": {"minimum":1,"type":"integer"}, + "name": {"type":"string"} + }, + "required": ["line","name","coveredLines","executableLines"], + "type": "object" + }, + "type": "array" + }, + "notCoveredFunctionCount": {"minimum":0,"type":"integer"}, + "notCoveredLineCount": {"minimum":0,"type":"integer"}, + "partialCoverage": { + "items": { + "additionalProperties": false, + "properties": { + "coveragePct": {"maximum":100,"minimum":0,"type":"number"}, + "coveredLines": {"minimum":0,"type":"integer"}, + "executableLines": {"minimum":0,"type":"integer"}, + "line": {"minimum":1,"type":"integer"}, + "name": {"type":"string"} + }, + "required": ["line","name","coveragePct","coveredLines","executableLines"], + "type": "object" + }, + "type": "array" + }, + "partialCoverageFunctionCount": {"minimum":0,"type":"integer"} + }, + "required": ["fullCoverageCount","notCoveredFunctionCount","notCoveredLineCount","partialCoverageFunctionCount"], + "type": "object" + }, + "summary": { + "additionalProperties": false, + "properties": { + "coveragePct": {"maximum":100,"minimum":0,"type":"number"}, + "coveredLines": {"minimum":0,"type":"integer"}, + "executableLines": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + }, + "targets": { + "items": { + "additionalProperties": false, + "properties": { + "coveragePct": {"maximum":100,"minimum":0,"type":"number"}, + "coveredLines": {"minimum":0,"type":"integer"}, + "executableLines": {"minimum":0,"type":"integer"}, + "name": {"type":"string"} + }, + "required": ["name","coveragePct","coveredLines","executableLines"], + "type": "object" + }, + "type": "array" + } + }, + "required": ["summary","coverageScope","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.coverage-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/get_mac_app_path.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/get_mac_app_path.json new file mode 100644 index 000000000..226a9c535 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/get_mac_app_path.json @@ -0,0 +1,193 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Get macOS App Path"}, + "description": "Get macOS built app path.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "derivedDataPath": {"type":"string"}, + "extraArgs": { + "items": {"type":"string"}, + "type": "array" + } + }, + "type": "object" + }, + "name": "get_mac_app_path", + "outputSchema": { + "$defs": { + "appPathRequest": { + "additionalProperties": false, + "properties": { + "configuration": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulator": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "type": "object" + }, + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.app-path/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "anyOf": [ + { + "properties": {"artifacts":true}, + "required": ["artifacts"] + }, + { + "properties": {"diagnostics":true}, + "required": ["diagnostics"] + } + ], + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "appPath": {"type":"string"} + }, + "required": ["appPath"], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "request": {"$ref":"#/$defs/appPathRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "required": [], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.app-path"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/get_mac_bundle_id.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/get_mac_bundle_id.json new file mode 100644 index 000000000..0092db45b --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/get_mac_bundle_id.json @@ -0,0 +1,154 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Get Mac Bundle ID"}, + "description": "Extract bundle id from macOS .app.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "appPath": {"description":"Path to the .app bundle","type":"string"} + }, + "required": ["appPath"], + "type": "object" + }, + "name": "get_mac_bundle_id", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.bundle-id/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "appPath": {"type":"string"}, + "bundleId": {"type":"string"} + }, + "required": ["appPath"], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"} + }, + "required": ["artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.bundle-id"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/get_sim_app_path.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/get_sim_app_path.json new file mode 100644 index 000000000..2201e10ec --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/get_sim_app_path.json @@ -0,0 +1,193 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Get Simulator App Path"}, + "description": "Get sim built app path.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "platform": { + "enum": ["iOS Simulator","watchOS Simulator","tvOS Simulator","visionOS Simulator"], + "type": "string" + } + }, + "required": ["platform"], + "type": "object" + }, + "name": "get_sim_app_path", + "outputSchema": { + "$defs": { + "appPathRequest": { + "additionalProperties": false, + "properties": { + "configuration": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulator": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "type": "object" + }, + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.app-path/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "anyOf": [ + { + "properties": {"artifacts":true}, + "required": ["artifacts"] + }, + { + "properties": {"diagnostics":true}, + "required": ["diagnostics"] + } + ], + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "appPath": {"type":"string"} + }, + "required": ["appPath"], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "request": {"$ref":"#/$defs/appPathRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "required": [], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.app-path"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/install_app_device.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/install_app_device.json new file mode 100644 index 000000000..47640cc49 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/install_app_device.json @@ -0,0 +1,166 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Install App Device"}, + "description": "Install app on device.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "appPath": {"type":"string"} + }, + "required": ["appPath"], + "type": "object" + }, + "name": "install_app_device", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.install-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "appPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "simulatorId": {"type":"string"} + }, + "required": ["appPath"], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.install-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/install_app_sim.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/install_app_sim.json new file mode 100644 index 000000000..468874bb9 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/install_app_sim.json @@ -0,0 +1,166 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Install App Simulator"}, + "description": "Install app on sim.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "appPath": {"description":"Path to the .app bundle to install","type":"string"} + }, + "required": ["appPath"], + "type": "object" + }, + "name": "install_app_sim", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.install-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "appPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "simulatorId": {"type":"string"} + }, + "required": ["appPath"], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.install-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/key_press.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/key_press.json new file mode 100644 index 000000000..34cce1b78 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/key_press.json @@ -0,0 +1,470 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Key Press"}, + "description": "Press one hardware key using an AXe HID key code. Prefer type_text for text entry. Common values include 40 Return/Enter, 42 Backspace, 43 Tab, and 44 Space.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "duration": {"description":"seconds","maximum":10,"minimum":0,"type":"number"}, + "keyCode": {"description":"HID keycode. Common values: 40 Return/Enter, 42 Backspace, 43 Tab, 44 Space.","maximum":255,"minimum":0,"type":"integer"} + }, + "required": ["keyCode"], + "type": "object" + }, + "name": "key_press", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "compactRuntimeSnapshot": { + "additionalProperties": false, + "properties": { + "count": {"minimum":0,"type":"integer"}, + "evidence": { + "description": "Non-actionable semantic evidence rows in role|label|value|identifier format. These rows intentionally omit element refs.", + "items": {"type":"string"}, + "type": "array" + }, + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "scroll": { + "items": {"type":"string"}, + "type": "array" + }, + "seq": {"minimum":0,"type":"integer"}, + "targets": { + "items": {"type":"string"}, + "type": "array" + }, + "text": { + "items": {"type":"string"}, + "type": "array" + }, + "type": {"const":"runtime-snapshot"}, + "udid": {"type":"string"} + }, + "required": ["type","rs","screenHash","seq","count","targets","scroll","udid"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "direction": { + "enum": ["up","down","left","right"] + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "frame": { + "additionalProperties": false, + "properties": { + "height": {"type":"number"}, + "width": {"type":"number"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y","width","height"], + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "point": { + "additionalProperties": false, + "properties": { + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y"], + "type": "object" + }, + "recoverableUiError": { + "additionalProperties": false, + "properties": { + "candidates": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "code": { + "enum": ["SNAPSHOT_MISSING","SNAPSHOT_EXPIRED","SNAPSHOT_PARSE_FAILED","SNAPSHOT_CAPTURE_FAILED","ELEMENT_REF_NOT_FOUND","TARGET_NOT_FOUND","TARGET_AMBIGUOUS","TARGET_NOT_ACTIONABLE","WAIT_TIMEOUT","UI_STATE_CHANGED","ACTION_FAILED"] + }, + "elementRef": {"type":"string"}, + "message": {"type":"string"}, + "recoveryHint": {"type":"string"}, + "snapshotAgeMs": {"minimum":0,"type":"integer"}, + "timeoutMs": {"minimum":0,"type":"integer"} + }, + "required": ["code","message","recoveryHint"], + "type": "object" + }, + "runtimeActionName": { + "enum": ["tap","typeText","longPress","touch","swipeWithin"] + }, + "runtimeElement": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionName"}, + "type": "array" + }, + "frame": {"$ref":"#/$defs/frame"}, + "identifier": {"type":"string"}, + "label": {"type":"string"}, + "ref": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "role": {"$ref":"#/$defs/runtimeElementRole"}, + "state": {"$ref":"#/$defs/runtimeElementState"}, + "value": {"type":"string"} + }, + "required": ["ref","frame","actions"], + "type": "object" + }, + "runtimeElementRole": { + "enum": ["application","button","cell","image","keyboard-key","list","menu","other","scroll-view","slider","switch","tab","text","text-field","window"] + }, + "runtimeElementState": { + "additionalProperties": false, + "properties": { + "enabled": {"type":"boolean"}, + "focused": {"type":"boolean"}, + "selected": {"type":"boolean"}, + "visible": {"type":"boolean"} + }, + "type": "object" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.ui-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"}, + "withinElementRef": {"type":"string"} + }, + "required": ["type","withinElementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"} + }, + "required": ["type","from","to"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"swipe"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "elementRef": {"type":"string"}, + "from": {"$ref":"#/$defs/point"}, + "steps": {"minimum":1,"type":"integer"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"drag"} + }, + "required": ["type","elementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"touch"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "elementRef": {"type":"string"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "button": {"type":"string"}, + "type": {"const":"button"} + }, + "required": ["type","button"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "gesture": {"type":"string"}, + "type": {"const":"gesture"} + }, + "required": ["type","gesture"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCode": {"minimum":0,"type":"integer"}, + "type": {"const":"key-press"} + }, + "required": ["type","keyCode"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCodes": { + "items": {"minimum":0,"type":"integer"}, + "type": "array" + }, + "type": {"const":"key-sequence"} + }, + "required": ["type","keyCodes"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "stepCount": {"minimum":1,"type":"integer"}, + "type": {"const":"batch"} + }, + "required": ["type","stepCount"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "capture": {"$ref":"#/$defs/compactRuntimeSnapshot"}, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"}, + "uiError": {"$ref":"#/$defs/recoverableUiError"} + }, + "required": ["summary","action","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.ui-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/key_sequence.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/key_sequence.json new file mode 100644 index 000000000..38816ac0a --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/key_sequence.json @@ -0,0 +1,476 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Key Sequence"}, + "description": "Press hardware keys using AXe HID key codes. Prefer type_text for text entry. Common values include 40 Return/Enter, 42 Backspace, 43 Tab, and 44 Space.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "delay": {"maximum":5,"minimum":0,"type":"number"}, + "keyCodes": { + "description": "HID keycodes. Common values: 40 Return/Enter, 42 Backspace, 43 Tab, 44 Space.", + "items": {"maximum":255,"minimum":0,"type":"integer"}, + "maxItems": 100, + "minItems": 1, + "type": "array" + } + }, + "required": ["keyCodes"], + "type": "object" + }, + "name": "key_sequence", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "compactRuntimeSnapshot": { + "additionalProperties": false, + "properties": { + "count": {"minimum":0,"type":"integer"}, + "evidence": { + "description": "Non-actionable semantic evidence rows in role|label|value|identifier format. These rows intentionally omit element refs.", + "items": {"type":"string"}, + "type": "array" + }, + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "scroll": { + "items": {"type":"string"}, + "type": "array" + }, + "seq": {"minimum":0,"type":"integer"}, + "targets": { + "items": {"type":"string"}, + "type": "array" + }, + "text": { + "items": {"type":"string"}, + "type": "array" + }, + "type": {"const":"runtime-snapshot"}, + "udid": {"type":"string"} + }, + "required": ["type","rs","screenHash","seq","count","targets","scroll","udid"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "direction": { + "enum": ["up","down","left","right"] + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "frame": { + "additionalProperties": false, + "properties": { + "height": {"type":"number"}, + "width": {"type":"number"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y","width","height"], + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "point": { + "additionalProperties": false, + "properties": { + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y"], + "type": "object" + }, + "recoverableUiError": { + "additionalProperties": false, + "properties": { + "candidates": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "code": { + "enum": ["SNAPSHOT_MISSING","SNAPSHOT_EXPIRED","SNAPSHOT_PARSE_FAILED","SNAPSHOT_CAPTURE_FAILED","ELEMENT_REF_NOT_FOUND","TARGET_NOT_FOUND","TARGET_AMBIGUOUS","TARGET_NOT_ACTIONABLE","WAIT_TIMEOUT","UI_STATE_CHANGED","ACTION_FAILED"] + }, + "elementRef": {"type":"string"}, + "message": {"type":"string"}, + "recoveryHint": {"type":"string"}, + "snapshotAgeMs": {"minimum":0,"type":"integer"}, + "timeoutMs": {"minimum":0,"type":"integer"} + }, + "required": ["code","message","recoveryHint"], + "type": "object" + }, + "runtimeActionName": { + "enum": ["tap","typeText","longPress","touch","swipeWithin"] + }, + "runtimeElement": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionName"}, + "type": "array" + }, + "frame": {"$ref":"#/$defs/frame"}, + "identifier": {"type":"string"}, + "label": {"type":"string"}, + "ref": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "role": {"$ref":"#/$defs/runtimeElementRole"}, + "state": {"$ref":"#/$defs/runtimeElementState"}, + "value": {"type":"string"} + }, + "required": ["ref","frame","actions"], + "type": "object" + }, + "runtimeElementRole": { + "enum": ["application","button","cell","image","keyboard-key","list","menu","other","scroll-view","slider","switch","tab","text","text-field","window"] + }, + "runtimeElementState": { + "additionalProperties": false, + "properties": { + "enabled": {"type":"boolean"}, + "focused": {"type":"boolean"}, + "selected": {"type":"boolean"}, + "visible": {"type":"boolean"} + }, + "type": "object" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.ui-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"}, + "withinElementRef": {"type":"string"} + }, + "required": ["type","withinElementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"} + }, + "required": ["type","from","to"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"swipe"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "elementRef": {"type":"string"}, + "from": {"$ref":"#/$defs/point"}, + "steps": {"minimum":1,"type":"integer"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"drag"} + }, + "required": ["type","elementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"touch"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "elementRef": {"type":"string"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "button": {"type":"string"}, + "type": {"const":"button"} + }, + "required": ["type","button"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "gesture": {"type":"string"}, + "type": {"const":"gesture"} + }, + "required": ["type","gesture"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCode": {"minimum":0,"type":"integer"}, + "type": {"const":"key-press"} + }, + "required": ["type","keyCode"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCodes": { + "items": {"minimum":0,"type":"integer"}, + "type": "array" + }, + "type": {"const":"key-sequence"} + }, + "required": ["type","keyCodes"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "stepCount": {"minimum":1,"type":"integer"}, + "type": {"const":"batch"} + }, + "required": ["type","stepCount"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "capture": {"$ref":"#/$defs/compactRuntimeSnapshot"}, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"}, + "uiError": {"$ref":"#/$defs/recoverableUiError"} + }, + "required": ["summary","action","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.ui-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/launch_app_device.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/launch_app_device.json new file mode 100644 index 000000000..5e42674e4 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/launch_app_device.json @@ -0,0 +1,187 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Launch App Device"}, + "description": "Launch app on device.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "env": { + "description": "Environment variables to pass to the launched app as key-value entries", + "items": { + "additionalProperties": false, + "properties": { + "key": {"minLength":1,"type":"string"}, + "value": {"type":"string"} + }, + "required": ["key","value"], + "type": "object" + }, + "type": "array" + }, + "launchArgs": { + "description": "Arguments passed to the launched app process on physical device runtime", + "items": {"type":"string"}, + "type": "array" + } + }, + "type": "object" + }, + "name": "launch_app_device", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.launch-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appPath": {"type":"string"}, + "bundleId": {"type":"string"}, + "deviceId": {"type":"string"}, + "osLogPath": {"type":"string"}, + "processId": {"minimum":1,"type":"integer"}, + "runtimeLogPath": {"type":"string"}, + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.launch-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/launch_app_sim.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/launch_app_sim.json new file mode 100644 index 000000000..7f6690f3e --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/launch_app_sim.json @@ -0,0 +1,187 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Launch App Simulator"}, + "description": "Launch app on simulator. Runtime logs are captured automatically and the log file path is included in the response.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "env": { + "description": "Environment variables to pass to the launched app as key-value entries (SIMCTL_CHILD_ prefix added automatically)", + "items": { + "additionalProperties": false, + "properties": { + "key": {"minLength":1,"type":"string"}, + "value": {"type":"string"} + }, + "required": ["key","value"], + "type": "object" + }, + "type": "array" + }, + "launchArgs": { + "description": "Arguments passed to the launched app process on simulator runtime", + "items": {"type":"string"}, + "type": "array" + } + }, + "type": "object" + }, + "name": "launch_app_sim", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.launch-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appPath": {"type":"string"}, + "bundleId": {"type":"string"}, + "deviceId": {"type":"string"}, + "osLogPath": {"type":"string"}, + "processId": {"minimum":1,"type":"integer"}, + "runtimeLogPath": {"type":"string"}, + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.launch-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/launch_mac_app.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/launch_mac_app.json new file mode 100644 index 000000000..fe55e7fda --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/launch_mac_app.json @@ -0,0 +1,176 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Launch macOS App"}, + "description": "Launch macOS app.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "appPath": {"type":"string"}, + "launchArgs": { + "description": "Arguments passed to the launched app process on macOS runtime", + "items": {"type":"string"}, + "type": "array" + } + }, + "required": ["appPath"], + "type": "object" + }, + "name": "launch_mac_app", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.launch-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appPath": {"type":"string"}, + "bundleId": {"type":"string"}, + "deviceId": {"type":"string"}, + "osLogPath": {"type":"string"}, + "processId": {"minimum":1,"type":"integer"}, + "runtimeLogPath": {"type":"string"}, + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.launch-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/list_devices.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/list_devices.json new file mode 100644 index 000000000..c0e63a1b8 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/list_devices.json @@ -0,0 +1,158 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"List Devices"}, + "description": "List connected devices.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": {}, + "type": "object" + }, + "name": "list_devices", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.device-list/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "devices": { + "items": { + "additionalProperties": false, + "properties": { + "deviceId": {"type":"string"}, + "isAvailable": {"type":"boolean"}, + "name": {"type":"string"}, + "osVersion": {"type":"string"}, + "platform": {"type":"string"}, + "state": {"type":"string"} + }, + "required": ["name","deviceId","platform","state","isAvailable","osVersion"], + "type": "object" + }, + "type": "array" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"} + }, + "required": ["devices"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.device-list"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/list_schemes.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/list_schemes.json new file mode 100644 index 000000000..3b51170a6 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/list_schemes.json @@ -0,0 +1,169 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"List Schemes"}, + "description": "List Xcode schemes.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "projectPath": {"description":"Path to the .xcodeproj file","type":"string"}, + "workspacePath": {"description":"Path to the .xcworkspace file","type":"string"} + }, + "type": "object" + }, + "name": "list_schemes", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.scheme-list/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "workspacePath": {"type":"string"} + }, + "required": ["workspacePath"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "projectPath": {"type":"string"} + }, + "required": ["projectPath"], + "type": "object" + } + ] + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "schemes": { + "items": {"type":"string"}, + "type": "array" + } + }, + "required": ["artifacts","schemes"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.scheme-list"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/list_sims.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/list_sims.json new file mode 100644 index 000000000..6ec62e1c3 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/list_sims.json @@ -0,0 +1,130 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"List Simulators"}, + "description": "List iOS simulators.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "enabled": {"type":"boolean"} + }, + "type": "object" + }, + "name": "list_sims", + "outputSchema": { + "$defs": { + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.simulator-list/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "simulators": { + "items": { + "additionalProperties": false, + "properties": { + "isAvailable": {"type":"boolean"}, + "name": {"type":"string"}, + "runtime": {"type":"string"}, + "simulatorId": {"type":"string"}, + "state": {"type":"string"} + }, + "required": ["name","simulatorId","state","isAvailable","runtime"], + "type": "object" + }, + "type": "array" + } + }, + "required": ["simulators"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.simulator-list"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/long_press.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/long_press.json new file mode 100644 index 000000000..5d4a6625a --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/long_press.json @@ -0,0 +1,470 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Long Press"}, + "description": "Long press a UI element by elementRef from a current rs/1 runtime snapshot.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "duration": {"description":"milliseconds","exclusiveMinimum":0,"maximum":10000,"type":"integer"}, + "elementRef": {"minLength":1,"type":"string"} + }, + "required": ["elementRef","duration"], + "type": "object" + }, + "name": "long_press", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "compactRuntimeSnapshot": { + "additionalProperties": false, + "properties": { + "count": {"minimum":0,"type":"integer"}, + "evidence": { + "description": "Non-actionable semantic evidence rows in role|label|value|identifier format. These rows intentionally omit element refs.", + "items": {"type":"string"}, + "type": "array" + }, + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "scroll": { + "items": {"type":"string"}, + "type": "array" + }, + "seq": {"minimum":0,"type":"integer"}, + "targets": { + "items": {"type":"string"}, + "type": "array" + }, + "text": { + "items": {"type":"string"}, + "type": "array" + }, + "type": {"const":"runtime-snapshot"}, + "udid": {"type":"string"} + }, + "required": ["type","rs","screenHash","seq","count","targets","scroll","udid"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "direction": { + "enum": ["up","down","left","right"] + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "frame": { + "additionalProperties": false, + "properties": { + "height": {"type":"number"}, + "width": {"type":"number"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y","width","height"], + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "point": { + "additionalProperties": false, + "properties": { + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y"], + "type": "object" + }, + "recoverableUiError": { + "additionalProperties": false, + "properties": { + "candidates": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "code": { + "enum": ["SNAPSHOT_MISSING","SNAPSHOT_EXPIRED","SNAPSHOT_PARSE_FAILED","SNAPSHOT_CAPTURE_FAILED","ELEMENT_REF_NOT_FOUND","TARGET_NOT_FOUND","TARGET_AMBIGUOUS","TARGET_NOT_ACTIONABLE","WAIT_TIMEOUT","UI_STATE_CHANGED","ACTION_FAILED"] + }, + "elementRef": {"type":"string"}, + "message": {"type":"string"}, + "recoveryHint": {"type":"string"}, + "snapshotAgeMs": {"minimum":0,"type":"integer"}, + "timeoutMs": {"minimum":0,"type":"integer"} + }, + "required": ["code","message","recoveryHint"], + "type": "object" + }, + "runtimeActionName": { + "enum": ["tap","typeText","longPress","touch","swipeWithin"] + }, + "runtimeElement": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionName"}, + "type": "array" + }, + "frame": {"$ref":"#/$defs/frame"}, + "identifier": {"type":"string"}, + "label": {"type":"string"}, + "ref": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "role": {"$ref":"#/$defs/runtimeElementRole"}, + "state": {"$ref":"#/$defs/runtimeElementState"}, + "value": {"type":"string"} + }, + "required": ["ref","frame","actions"], + "type": "object" + }, + "runtimeElementRole": { + "enum": ["application","button","cell","image","keyboard-key","list","menu","other","scroll-view","slider","switch","tab","text","text-field","window"] + }, + "runtimeElementState": { + "additionalProperties": false, + "properties": { + "enabled": {"type":"boolean"}, + "focused": {"type":"boolean"}, + "selected": {"type":"boolean"}, + "visible": {"type":"boolean"} + }, + "type": "object" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.ui-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"}, + "withinElementRef": {"type":"string"} + }, + "required": ["type","withinElementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"} + }, + "required": ["type","from","to"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"swipe"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "elementRef": {"type":"string"}, + "from": {"$ref":"#/$defs/point"}, + "steps": {"minimum":1,"type":"integer"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"drag"} + }, + "required": ["type","elementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"touch"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "elementRef": {"type":"string"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "button": {"type":"string"}, + "type": {"const":"button"} + }, + "required": ["type","button"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "gesture": {"type":"string"}, + "type": {"const":"gesture"} + }, + "required": ["type","gesture"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCode": {"minimum":0,"type":"integer"}, + "type": {"const":"key-press"} + }, + "required": ["type","keyCode"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCodes": { + "items": {"minimum":0,"type":"integer"}, + "type": "array" + }, + "type": {"const":"key-sequence"} + }, + "required": ["type","keyCodes"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "stepCount": {"minimum":1,"type":"integer"}, + "type": {"const":"batch"} + }, + "required": ["type","stepCount"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "capture": {"$ref":"#/$defs/compactRuntimeSnapshot"}, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"}, + "uiError": {"$ref":"#/$defs/recoverableUiError"} + }, + "required": ["summary","action","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.ui-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/manage-workflows.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/manage-workflows.json new file mode 100644 index 000000000..010a81f54 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/manage-workflows.json @@ -0,0 +1,133 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Manage Workflows"}, + "description": "Workflows are groups of tools exposed by XcodeBuildMCP. By default, not all workflows (and therefore tools) are enabled; only simulator tools are enabled by default. Some workflows are mandatory and can't be disabled.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "enable": {"description":"Enable or disable the selected workflows.","type":"boolean"}, + "workflowNames": { + "description": "Workflow directory name(s).", + "items": {"type":"string"}, + "type": "array" + } + }, + "required": ["workflowNames","enable"], + "type": "object" + }, + "name": "manage-workflows", + "outputSchema": { + "$defs": { + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.workflow-selection/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "description": "Structured output envelope for enabling and disabling MCP workflows.", + "properties": { + "data": { + "anyOf": [ + { + "additionalProperties": false, + "properties": { + "enabledWorkflows": { + "items": {"type":"string"}, + "type": "array" + }, + "registeredToolCount": {"minimum":0,"type":"integer"} + }, + "required": ["enabledWorkflows","registeredToolCount"], + "type": "object" + }, + {"type":"null"} + ] + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.workflow-selection"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "title": "Workflow Selection", + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/open_sim.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/open_sim.json new file mode 100644 index 000000000..0842ef367 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/open_sim.json @@ -0,0 +1,249 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Open Simulator"}, + "description": "Open the simulator frontend for visibility and manual workflows. Not required before simulator build-and-run (build_run_sim).", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": {}, + "type": "object" + }, + "name": "open_sim", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.simulator-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "type": {"const":"boot"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"erase"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"open"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"reset-location"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "coordinates": { + "additionalProperties": false, + "properties": { + "latitude": {"maximum":90,"minimum":-90,"type":"number"}, + "longitude": {"maximum":180,"minimum":-180,"type":"number"} + }, + "required": ["latitude","longitude"], + "type": "object" + }, + "type": {"const":"set-location"} + }, + "required": ["type","coordinates"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "appearance": {"type":"string"}, + "type": {"const":"set-appearance"} + }, + "required": ["type","appearance"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "dataNetwork": {"type":"string"}, + "type": {"const":"statusbar"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-software-keyboard"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-connect-hardware-keyboard"} + }, + "required": ["type"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","action"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.simulator-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/record_sim_video.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/record_sim_video.json new file mode 100644 index 000000000..118cbfab1 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/record_sim_video.json @@ -0,0 +1,392 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Record Simulator Video"}, + "description": "Record sim video.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "fps": {"description":"default: 30","maximum":120,"minimum":1,"type":"integer"}, + "outputFile": {"description":"Path to write MP4 file","type":"string"}, + "start": {"type":"boolean"}, + "stop": {"type":"boolean"} + }, + "type": "object" + }, + "name": "record_sim_video", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "compactRuntimeSnapshot": { + "additionalProperties": false, + "properties": { + "count": {"minimum":0,"type":"integer"}, + "evidence": { + "description": "Non-actionable semantic evidence rows in role|label|value|identifier format. These rows intentionally omit element refs.", + "items": {"type":"string"}, + "type": "array" + }, + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "scroll": { + "items": {"type":"string"}, + "type": "array" + }, + "seq": {"minimum":0,"type":"integer"}, + "targets": { + "items": {"type":"string"}, + "type": "array" + }, + "text": { + "items": {"type":"string"}, + "type": "array" + }, + "type": {"const":"runtime-snapshot"}, + "udid": {"type":"string"} + }, + "required": ["type","rs","screenHash","seq","count","targets","scroll","udid"], + "type": "object" + }, + "compactRuntimeSnapshotUnchanged": { + "additionalProperties": false, + "properties": { + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "seq": {"minimum":0,"type":"integer"}, + "type": {"const":"runtime-snapshot-unchanged"}, + "udid": {"type":"string"}, + "unchanged": {"const":true} + }, + "required": ["type","rs","screenHash","seq","unchanged","udid"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "frame": { + "additionalProperties": false, + "properties": { + "height": {"type":"number"}, + "width": {"type":"number"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y","width","height"], + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "recoverableUiError": { + "additionalProperties": false, + "properties": { + "candidates": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "code": { + "enum": ["SNAPSHOT_MISSING","SNAPSHOT_EXPIRED","SNAPSHOT_PARSE_FAILED","SNAPSHOT_CAPTURE_FAILED","ELEMENT_REF_NOT_FOUND","TARGET_NOT_FOUND","TARGET_AMBIGUOUS","TARGET_NOT_ACTIONABLE","WAIT_TIMEOUT","UI_STATE_CHANGED","ACTION_FAILED"] + }, + "elementRef": {"type":"string"}, + "message": {"type":"string"}, + "recoveryHint": {"type":"string"}, + "snapshotAgeMs": {"minimum":0,"type":"integer"}, + "timeoutMs": {"minimum":0,"type":"integer"} + }, + "required": ["code","message","recoveryHint"], + "type": "object" + }, + "runtimeActionHint": { + "additionalProperties": false, + "properties": { + "action": {"$ref":"#/$defs/runtimeActionName"}, + "elementRef": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "label": {"type":"string"} + }, + "required": ["action","elementRef"], + "type": "object" + }, + "runtimeActionName": { + "enum": ["tap","typeText","longPress","touch","swipeWithin"] + }, + "runtimeElement": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionName"}, + "type": "array" + }, + "frame": {"$ref":"#/$defs/frame"}, + "identifier": {"type":"string"}, + "label": {"type":"string"}, + "ref": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "role": {"$ref":"#/$defs/runtimeElementRole"}, + "state": {"$ref":"#/$defs/runtimeElementState"}, + "value": {"type":"string"} + }, + "required": ["ref","frame","actions"], + "type": "object" + }, + "runtimeElementRole": { + "enum": ["application","button","cell","image","keyboard-key","list","menu","other","scroll-view","slider","switch","tab","text","text-field","window"] + }, + "runtimeElementState": { + "additionalProperties": false, + "properties": { + "enabled": {"type":"boolean"}, + "focused": {"type":"boolean"}, + "selected": {"type":"boolean"}, + "visible": {"type":"boolean"} + }, + "type": "object" + }, + "runtimeSnapshot": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionHint"}, + "type": "array" + }, + "capturedAtMs": {"minimum":0,"type":"integer"}, + "elements": { + "items": {"$ref":"#/$defs/runtimeElement"}, + "type": "array" + }, + "expiresAtMs": {"minimum":0,"type":"integer"}, + "protocol": {"const":"rs/1"}, + "screenHash": {"minLength":1,"type":"string"}, + "seq": {"minimum":0,"type":"integer"}, + "simulatorId": {"type":"string"}, + "type": {"const":"runtime-snapshot"} + }, + "required": ["type","protocol","simulatorId","screenHash","seq","capturedAtMs","expiresAtMs","elements","actions"], + "type": "object" + }, + "runtimeSnapshotUnchanged": { + "additionalProperties": false, + "properties": { + "protocol": {"const":"rs/1"}, + "screenHash": {"minLength":1,"type":"string"}, + "seq": {"minimum":0,"type":"integer"}, + "simulatorId": {"type":"string"}, + "type": {"const":"runtime-snapshot-unchanged"} + }, + "required": ["type","protocol","simulatorId","screenHash","seq"], + "type": "object" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + }, + "uiHierarchyCapture": { + "additionalProperties": false, + "properties": { + "type": {"const":"ui-hierarchy"}, + "uiHierarchy": { + "items": {"$ref":"#/$defs/uiHierarchyNode"}, + "type": "array" + } + }, + "required": ["type","uiHierarchy"], + "type": "object" + }, + "uiHierarchyNode": {"type":"object"}, + "videoRecordingCapture": { + "additionalProperties": false, + "properties": { + "fps": {"minimum":1,"type":"integer"}, + "outputFile": {"type":"string"}, + "sessionId": {"type":"string"}, + "state": { + "enum": ["started","stopped"] + }, + "type": {"const":"video-recording"} + }, + "required": ["type","state"], + "type": "object" + }, + "waitMatch": { + "additionalProperties": false, + "properties": { + "matches": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "predicate": {"$ref":"#/$defs/waitPredicate"} + }, + "required": ["predicate","matches"], + "type": "object" + }, + "waitPredicate": { + "enum": ["exists","gone","enabled","focused","textContains","settled"] + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.capture-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "screenshotPath": {"type":"string"}, + "simulatorId": {"type":"string"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "capture": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "format": {"type":"string"}, + "height": {"minimum":0,"type":"integer"}, + "width": {"minimum":0,"type":"integer"} + }, + "required": ["format","width","height"], + "type": "object" + }, + {"$ref":"#/$defs/uiHierarchyCapture"}, + {"$ref":"#/$defs/runtimeSnapshot"}, + {"$ref":"#/$defs/compactRuntimeSnapshot"}, + {"$ref":"#/$defs/videoRecordingCapture"}, + {"$ref":"#/$defs/runtimeSnapshotUnchanged"}, + {"$ref":"#/$defs/compactRuntimeSnapshotUnchanged"} + ] + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"}, + "uiError": {"$ref":"#/$defs/recoverableUiError"}, + "waitMatch": {"$ref":"#/$defs/waitMatch"} + }, + "required": ["summary","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.capture-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/reset_sim_location.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/reset_sim_location.json new file mode 100644 index 000000000..c753e01e3 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/reset_sim_location.json @@ -0,0 +1,249 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Reset Simulator Location"}, + "description": "Reset sim location.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": {}, + "type": "object" + }, + "name": "reset_sim_location", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.simulator-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "type": {"const":"boot"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"erase"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"open"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"reset-location"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "coordinates": { + "additionalProperties": false, + "properties": { + "latitude": {"maximum":90,"minimum":-90,"type":"number"}, + "longitude": {"maximum":180,"minimum":-180,"type":"number"} + }, + "required": ["latitude","longitude"], + "type": "object" + }, + "type": {"const":"set-location"} + }, + "required": ["type","coordinates"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "appearance": {"type":"string"}, + "type": {"const":"set-appearance"} + }, + "required": ["type","appearance"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "dataNetwork": {"type":"string"}, + "type": {"const":"statusbar"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-software-keyboard"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-connect-hardware-keyboard"} + }, + "required": ["type"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","action"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.simulator-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/scaffold_ios_project.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/scaffold_ios_project.json new file mode 100644 index 000000000..90a106f8d --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/scaffold_ios_project.json @@ -0,0 +1,196 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Scaffold iOS Project"}, + "description": "Scaffold iOS project.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "bundleIdentifier": {"type":"string"}, + "currentProjectVersion": {"type":"string"}, + "customizeNames": {"default":true,"type":"boolean"}, + "deploymentTarget": {"type":"string"}, + "displayName": {"type":"string"}, + "marketingVersion": {"type":"string"}, + "outputPath": {"type":"string"}, + "projectName": {"minLength":1,"type":"string"}, + "supportedOrientations": { + "items": { + "enum": ["portrait","landscape-left","landscape-right","portrait-upside-down"], + "type": "string" + }, + "type": "array" + }, + "supportedOrientationsIpad": { + "items": { + "enum": ["portrait","landscape-left","landscape-right","portrait-upside-down"], + "type": "string" + }, + "type": "array" + }, + "targetedDeviceFamily": { + "items": { + "enum": ["iphone","ipad","universal"], + "type": "string" + }, + "type": "array" + } + }, + "required": ["projectName","outputPath"], + "type": "object" + }, + "name": "scaffold_ios_project", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.scaffold-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "outputPath": {"type":"string"}, + "projectName": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "required": ["projectName","outputPath"], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": { + "additionalProperties": false, + "properties": { + "platform": { + "enum": ["iOS","macOS"] + }, + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status","platform"], + "type": "object" + } + }, + "required": ["summary","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.scaffold-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/scaffold_macos_project.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/scaffold_macos_project.json new file mode 100644 index 000000000..7d5754dc3 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/scaffold_macos_project.json @@ -0,0 +1,175 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Scaffold macOS Project"}, + "description": "Scaffold macOS project.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "bundleIdentifier": {"type":"string"}, + "currentProjectVersion": {"type":"string"}, + "customizeNames": {"default":true,"type":"boolean"}, + "deploymentTarget": {"type":"string"}, + "displayName": {"type":"string"}, + "marketingVersion": {"type":"string"}, + "outputPath": {"type":"string"}, + "projectName": {"minLength":1,"type":"string"} + }, + "required": ["projectName","outputPath"], + "type": "object" + }, + "name": "scaffold_macos_project", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.scaffold-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "outputPath": {"type":"string"}, + "projectName": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "required": ["projectName","outputPath"], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": { + "additionalProperties": false, + "properties": { + "platform": { + "enum": ["iOS","macOS"] + }, + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status","platform"], + "type": "object" + } + }, + "required": ["summary","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.scaffold-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/screenshot.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/screenshot.json new file mode 100644 index 000000000..3c8af8a70 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/screenshot.json @@ -0,0 +1,393 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Screenshot"}, + "description": "Capture screenshot.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "returnFormat": { + "description": "Return image path or base64 data (path|base64)", + "enum": ["path","base64"], + "type": "string" + } + }, + "type": "object" + }, + "name": "screenshot", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "compactRuntimeSnapshot": { + "additionalProperties": false, + "properties": { + "count": {"minimum":0,"type":"integer"}, + "evidence": { + "description": "Non-actionable semantic evidence rows in role|label|value|identifier format. These rows intentionally omit element refs.", + "items": {"type":"string"}, + "type": "array" + }, + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "scroll": { + "items": {"type":"string"}, + "type": "array" + }, + "seq": {"minimum":0,"type":"integer"}, + "targets": { + "items": {"type":"string"}, + "type": "array" + }, + "text": { + "items": {"type":"string"}, + "type": "array" + }, + "type": {"const":"runtime-snapshot"}, + "udid": {"type":"string"} + }, + "required": ["type","rs","screenHash","seq","count","targets","scroll","udid"], + "type": "object" + }, + "compactRuntimeSnapshotUnchanged": { + "additionalProperties": false, + "properties": { + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "seq": {"minimum":0,"type":"integer"}, + "type": {"const":"runtime-snapshot-unchanged"}, + "udid": {"type":"string"}, + "unchanged": {"const":true} + }, + "required": ["type","rs","screenHash","seq","unchanged","udid"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "frame": { + "additionalProperties": false, + "properties": { + "height": {"type":"number"}, + "width": {"type":"number"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y","width","height"], + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "recoverableUiError": { + "additionalProperties": false, + "properties": { + "candidates": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "code": { + "enum": ["SNAPSHOT_MISSING","SNAPSHOT_EXPIRED","SNAPSHOT_PARSE_FAILED","SNAPSHOT_CAPTURE_FAILED","ELEMENT_REF_NOT_FOUND","TARGET_NOT_FOUND","TARGET_AMBIGUOUS","TARGET_NOT_ACTIONABLE","WAIT_TIMEOUT","UI_STATE_CHANGED","ACTION_FAILED"] + }, + "elementRef": {"type":"string"}, + "message": {"type":"string"}, + "recoveryHint": {"type":"string"}, + "snapshotAgeMs": {"minimum":0,"type":"integer"}, + "timeoutMs": {"minimum":0,"type":"integer"} + }, + "required": ["code","message","recoveryHint"], + "type": "object" + }, + "runtimeActionHint": { + "additionalProperties": false, + "properties": { + "action": {"$ref":"#/$defs/runtimeActionName"}, + "elementRef": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "label": {"type":"string"} + }, + "required": ["action","elementRef"], + "type": "object" + }, + "runtimeActionName": { + "enum": ["tap","typeText","longPress","touch","swipeWithin"] + }, + "runtimeElement": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionName"}, + "type": "array" + }, + "frame": {"$ref":"#/$defs/frame"}, + "identifier": {"type":"string"}, + "label": {"type":"string"}, + "ref": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "role": {"$ref":"#/$defs/runtimeElementRole"}, + "state": {"$ref":"#/$defs/runtimeElementState"}, + "value": {"type":"string"} + }, + "required": ["ref","frame","actions"], + "type": "object" + }, + "runtimeElementRole": { + "enum": ["application","button","cell","image","keyboard-key","list","menu","other","scroll-view","slider","switch","tab","text","text-field","window"] + }, + "runtimeElementState": { + "additionalProperties": false, + "properties": { + "enabled": {"type":"boolean"}, + "focused": {"type":"boolean"}, + "selected": {"type":"boolean"}, + "visible": {"type":"boolean"} + }, + "type": "object" + }, + "runtimeSnapshot": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionHint"}, + "type": "array" + }, + "capturedAtMs": {"minimum":0,"type":"integer"}, + "elements": { + "items": {"$ref":"#/$defs/runtimeElement"}, + "type": "array" + }, + "expiresAtMs": {"minimum":0,"type":"integer"}, + "protocol": {"const":"rs/1"}, + "screenHash": {"minLength":1,"type":"string"}, + "seq": {"minimum":0,"type":"integer"}, + "simulatorId": {"type":"string"}, + "type": {"const":"runtime-snapshot"} + }, + "required": ["type","protocol","simulatorId","screenHash","seq","capturedAtMs","expiresAtMs","elements","actions"], + "type": "object" + }, + "runtimeSnapshotUnchanged": { + "additionalProperties": false, + "properties": { + "protocol": {"const":"rs/1"}, + "screenHash": {"minLength":1,"type":"string"}, + "seq": {"minimum":0,"type":"integer"}, + "simulatorId": {"type":"string"}, + "type": {"const":"runtime-snapshot-unchanged"} + }, + "required": ["type","protocol","simulatorId","screenHash","seq"], + "type": "object" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + }, + "uiHierarchyCapture": { + "additionalProperties": false, + "properties": { + "type": {"const":"ui-hierarchy"}, + "uiHierarchy": { + "items": {"$ref":"#/$defs/uiHierarchyNode"}, + "type": "array" + } + }, + "required": ["type","uiHierarchy"], + "type": "object" + }, + "uiHierarchyNode": {"type":"object"}, + "videoRecordingCapture": { + "additionalProperties": false, + "properties": { + "fps": {"minimum":1,"type":"integer"}, + "outputFile": {"type":"string"}, + "sessionId": {"type":"string"}, + "state": { + "enum": ["started","stopped"] + }, + "type": {"const":"video-recording"} + }, + "required": ["type","state"], + "type": "object" + }, + "waitMatch": { + "additionalProperties": false, + "properties": { + "matches": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "predicate": {"$ref":"#/$defs/waitPredicate"} + }, + "required": ["predicate","matches"], + "type": "object" + }, + "waitPredicate": { + "enum": ["exists","gone","enabled","focused","textContains","settled"] + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.capture-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "screenshotPath": {"type":"string"}, + "simulatorId": {"type":"string"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "capture": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "format": {"type":"string"}, + "height": {"minimum":0,"type":"integer"}, + "width": {"minimum":0,"type":"integer"} + }, + "required": ["format","width","height"], + "type": "object" + }, + {"$ref":"#/$defs/uiHierarchyCapture"}, + {"$ref":"#/$defs/runtimeSnapshot"}, + {"$ref":"#/$defs/compactRuntimeSnapshot"}, + {"$ref":"#/$defs/videoRecordingCapture"}, + {"$ref":"#/$defs/runtimeSnapshotUnchanged"}, + {"$ref":"#/$defs/compactRuntimeSnapshotUnchanged"} + ] + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"}, + "uiError": {"$ref":"#/$defs/recoverableUiError"}, + "waitMatch": {"$ref":"#/$defs/waitMatch"} + }, + "required": ["summary","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.capture-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/session_clear_defaults.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/session_clear_defaults.json new file mode 100644 index 000000000..11a55da8b --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/session_clear_defaults.json @@ -0,0 +1,268 @@ +{ + "annotations": {"destructiveHint":true,"openWorldHint":false,"readOnlyHint":false,"title":"Clear Session Defaults"}, + "description": "Clear session defaults for the active profile or a specified profile.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "all": {"description":"Clear all defaults across global and named profiles. Cannot be combined with keys/profile.","type":"boolean"}, + "keys": { + "items": { + "enum": ["projectPath","workspacePath","scheme","configuration","simulatorName","simulatorId","simulatorPlatform","deviceId","useLatestOS","arch","suppressWarnings","derivedDataPath","preferXcodebuild","platform","bundleId","env","extraArgs"], + "type": "string" + }, + "type": "array" + }, + "profile": {"description":"Clear defaults for this named profile instead of the active profile.","minLength":1,"type":"string"} + }, + "type": "object" + }, + "name": "session_clear_defaults", + "outputSchema": { + "$defs": { + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "sessionDefaultsOperation": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "type": {"const":"show"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"sync-xcode"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "activatedProfile": {"type":"string"}, + "changedKeys": { + "items": {"type":"string"}, + "type": "array" + }, + "notices": { + "items": {"type":"string"}, + "type": "array" + }, + "persisted": {"type":"boolean"}, + "type": {"const":"set"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "clearedKeys": { + "items": {"type":"string"}, + "type": "array" + }, + "profile": {"type":"string"}, + "scope": { + "enum": ["all","profile","current"] + }, + "type": {"const":"clear"} + }, + "required": ["type","scope"], + "type": "object" + } + ] + }, + "sessionDefaultsProfile": { + "additionalProperties": false, + "properties": { + "arch": { + "anyOf": [ + {"const":null}, + { + "enum": ["arm64","x86_64"] + } + ] + }, + "bundleId": { + "type": ["string","null"] + }, + "configuration": { + "type": ["string","null"] + }, + "derivedDataPath": { + "type": ["string","null"] + }, + "deviceId": { + "type": ["string","null"] + }, + "env": { + "anyOf": [ + {"const":null}, + { + "additionalProperties": {"type":"string"}, + "propertyNames": {"minLength":1,"type":"string"}, + "type": "object" + } + ] + }, + "extraArgs": { + "anyOf": [ + {"const":null}, + { + "items": {"type":"string"}, + "type": "array" + } + ] + }, + "platform": { + "type": ["string","null"] + }, + "preferXcodebuild": { + "type": ["boolean","null"] + }, + "projectPath": { + "type": ["string","null"] + }, + "scheme": { + "type": ["string","null"] + }, + "simulatorId": { + "type": ["string","null"] + }, + "simulatorName": { + "type": ["string","null"] + }, + "simulatorPlatform": { + "anyOf": [ + {"const":null}, + { + "enum": ["iOS Simulator","watchOS Simulator","tvOS Simulator","visionOS Simulator"] + } + ] + }, + "suppressWarnings": { + "type": ["boolean","null"] + }, + "useLatestOS": { + "type": ["boolean","null"] + }, + "workspacePath": { + "type": ["string","null"] + } + }, + "required": ["projectPath","workspacePath","scheme","configuration","simulatorName","simulatorId","simulatorPlatform","deviceId","useLatestOS","arch","suppressWarnings","derivedDataPath","preferXcodebuild","platform","bundleId","env"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.session-defaults/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "currentProfile": {"type":"string"}, + "operation": {"$ref":"#/$defs/sessionDefaultsOperation"}, + "profiles": { + "additionalProperties": {"$ref":"#/$defs/sessionDefaultsProfile"}, + "properties": { + "(default)": {"$ref":"#/$defs/sessionDefaultsProfile"} + }, + "required": ["(default)"], + "type": "object" + } + }, + "required": ["currentProfile","profiles"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.session-defaults"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/session_set_defaults.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/session_set_defaults.json new file mode 100644 index 000000000..e658e9e43 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/session_set_defaults.json @@ -0,0 +1,302 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Set Session Defaults"}, + "description": "Set session defaults for the active profile, or for a specified profile and make it active.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "arch": { + "enum": ["arm64","x86_64"], + "type": "string" + }, + "bundleId": {"description":"Default bundle ID for launch/stop/log tools when working on a single app.","minLength":1,"type":"string"}, + "configuration": {"description":"Build configuration for Xcode and SwiftPM tools (e.g. 'Debug' or 'Release').","minLength":1,"type":"string"}, + "createIfNotExists": {"default":false,"description":"Create the named profile if it does not exist. Defaults to false.","type":"boolean"}, + "derivedDataPath": {"description":"Default DerivedData path for Xcode build/test/clean tools.","minLength":1,"type":"string"}, + "deviceId": {"minLength":1,"type":"string"}, + "env": { + "description": "Default environment variables to pass to launched apps as key-value entries", + "items": { + "additionalProperties": false, + "properties": { + "key": {"minLength":1,"type":"string"}, + "value": {"type":"string"} + }, + "required": ["key","value"], + "type": "object" + }, + "type": "array" + }, + "extraArgs": { + "description": "Default extra xcodebuild arguments for tools that accept extraArgs.", + "items": {"type":"string"}, + "type": "array" + }, + "persist": {"description":"Persist provided defaults to .xcodebuildmcp/config.yaml","type":"boolean"}, + "platform": {"description":"Default device platform for device tools (e.g. iOS, watchOS).","minLength":1,"type":"string"}, + "preferXcodebuild": {"description":"Prefer xcodebuild over incremental builds for Xcode build/test/clean tools.","type":"boolean"}, + "profile": {"description":"Set defaults for this named profile and make it active for the current session.","minLength":1,"type":"string"}, + "projectPath": {"description":"xcodeproj path (xor workspacePath)","minLength":1,"type":"string"}, + "scheme": {"minLength":1,"type":"string"}, + "simulatorId": {"description":"Machine-local simulator UDID, materialized from simulatorName when one is set; UDIDs are not portable across machines.","minLength":1,"type":"string"}, + "simulatorName": {"description":"Canonical, machine-portable simulator selector (safe to share via SCM); the background refresh re-resolves it to this machine’s UDID.","minLength":1,"type":"string"}, + "simulatorPlatform": { + "description": "Cached platform derived from the selected simulator’s runtime; must be cleared/recomputed whenever the simulator selector changes.", + "enum": ["iOS Simulator","watchOS Simulator","tvOS Simulator","visionOS Simulator"], + "type": "string" + }, + "suppressWarnings": {"type":"boolean"}, + "useLatestOS": {"type":"boolean"}, + "workspacePath": {"description":"xcworkspace path (xor projectPath)","minLength":1,"type":"string"} + }, + "type": "object" + }, + "name": "session_set_defaults", + "outputSchema": { + "$defs": { + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "sessionDefaultsOperation": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "type": {"const":"show"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"sync-xcode"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "activatedProfile": {"type":"string"}, + "changedKeys": { + "items": {"type":"string"}, + "type": "array" + }, + "notices": { + "items": {"type":"string"}, + "type": "array" + }, + "persisted": {"type":"boolean"}, + "type": {"const":"set"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "clearedKeys": { + "items": {"type":"string"}, + "type": "array" + }, + "profile": {"type":"string"}, + "scope": { + "enum": ["all","profile","current"] + }, + "type": {"const":"clear"} + }, + "required": ["type","scope"], + "type": "object" + } + ] + }, + "sessionDefaultsProfile": { + "additionalProperties": false, + "properties": { + "arch": { + "anyOf": [ + {"const":null}, + { + "enum": ["arm64","x86_64"] + } + ] + }, + "bundleId": { + "type": ["string","null"] + }, + "configuration": { + "type": ["string","null"] + }, + "derivedDataPath": { + "type": ["string","null"] + }, + "deviceId": { + "type": ["string","null"] + }, + "env": { + "anyOf": [ + {"const":null}, + { + "additionalProperties": {"type":"string"}, + "propertyNames": {"minLength":1,"type":"string"}, + "type": "object" + } + ] + }, + "extraArgs": { + "anyOf": [ + {"const":null}, + { + "items": {"type":"string"}, + "type": "array" + } + ] + }, + "platform": { + "type": ["string","null"] + }, + "preferXcodebuild": { + "type": ["boolean","null"] + }, + "projectPath": { + "type": ["string","null"] + }, + "scheme": { + "type": ["string","null"] + }, + "simulatorId": { + "type": ["string","null"] + }, + "simulatorName": { + "type": ["string","null"] + }, + "simulatorPlatform": { + "anyOf": [ + {"const":null}, + { + "enum": ["iOS Simulator","watchOS Simulator","tvOS Simulator","visionOS Simulator"] + } + ] + }, + "suppressWarnings": { + "type": ["boolean","null"] + }, + "useLatestOS": { + "type": ["boolean","null"] + }, + "workspacePath": { + "type": ["string","null"] + } + }, + "required": ["projectPath","workspacePath","scheme","configuration","simulatorName","simulatorId","simulatorPlatform","deviceId","useLatestOS","arch","suppressWarnings","derivedDataPath","preferXcodebuild","platform","bundleId","env"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.session-defaults/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "currentProfile": {"type":"string"}, + "operation": {"$ref":"#/$defs/sessionDefaultsOperation"}, + "profiles": { + "additionalProperties": {"$ref":"#/$defs/sessionDefaultsProfile"}, + "properties": { + "(default)": {"$ref":"#/$defs/sessionDefaultsProfile"} + }, + "required": ["(default)"], + "type": "object" + } + }, + "required": ["currentProfile","profiles"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.session-defaults"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/session_show_defaults.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/session_show_defaults.json new file mode 100644 index 000000000..dad883fd2 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/session_show_defaults.json @@ -0,0 +1,258 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Show Session Defaults"}, + "description": "Show current active defaults. Required before your first build/run/test call in a session — do not assume defaults are configured.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": {}, + "type": "object" + }, + "name": "session_show_defaults", + "outputSchema": { + "$defs": { + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "sessionDefaultsOperation": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "type": {"const":"show"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"sync-xcode"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "activatedProfile": {"type":"string"}, + "changedKeys": { + "items": {"type":"string"}, + "type": "array" + }, + "notices": { + "items": {"type":"string"}, + "type": "array" + }, + "persisted": {"type":"boolean"}, + "type": {"const":"set"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "clearedKeys": { + "items": {"type":"string"}, + "type": "array" + }, + "profile": {"type":"string"}, + "scope": { + "enum": ["all","profile","current"] + }, + "type": {"const":"clear"} + }, + "required": ["type","scope"], + "type": "object" + } + ] + }, + "sessionDefaultsProfile": { + "additionalProperties": false, + "properties": { + "arch": { + "anyOf": [ + {"const":null}, + { + "enum": ["arm64","x86_64"] + } + ] + }, + "bundleId": { + "type": ["string","null"] + }, + "configuration": { + "type": ["string","null"] + }, + "derivedDataPath": { + "type": ["string","null"] + }, + "deviceId": { + "type": ["string","null"] + }, + "env": { + "anyOf": [ + {"const":null}, + { + "additionalProperties": {"type":"string"}, + "propertyNames": {"minLength":1,"type":"string"}, + "type": "object" + } + ] + }, + "extraArgs": { + "anyOf": [ + {"const":null}, + { + "items": {"type":"string"}, + "type": "array" + } + ] + }, + "platform": { + "type": ["string","null"] + }, + "preferXcodebuild": { + "type": ["boolean","null"] + }, + "projectPath": { + "type": ["string","null"] + }, + "scheme": { + "type": ["string","null"] + }, + "simulatorId": { + "type": ["string","null"] + }, + "simulatorName": { + "type": ["string","null"] + }, + "simulatorPlatform": { + "anyOf": [ + {"const":null}, + { + "enum": ["iOS Simulator","watchOS Simulator","tvOS Simulator","visionOS Simulator"] + } + ] + }, + "suppressWarnings": { + "type": ["boolean","null"] + }, + "useLatestOS": { + "type": ["boolean","null"] + }, + "workspacePath": { + "type": ["string","null"] + } + }, + "required": ["projectPath","workspacePath","scheme","configuration","simulatorName","simulatorId","simulatorPlatform","deviceId","useLatestOS","arch","suppressWarnings","derivedDataPath","preferXcodebuild","platform","bundleId","env"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.session-defaults/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "currentProfile": {"type":"string"}, + "operation": {"$ref":"#/$defs/sessionDefaultsOperation"}, + "profiles": { + "additionalProperties": {"$ref":"#/$defs/sessionDefaultsProfile"}, + "properties": { + "(default)": {"$ref":"#/$defs/sessionDefaultsProfile"} + }, + "required": ["(default)"], + "type": "object" + } + }, + "required": ["currentProfile","profiles"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.session-defaults"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/session_use_defaults_profile.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/session_use_defaults_profile.json new file mode 100644 index 000000000..79bb51f4e --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/session_use_defaults_profile.json @@ -0,0 +1,120 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Use Session Defaults Profile"}, + "description": "Switch the active session defaults profile.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "global": {"description":"Activate the global unnamed defaults profile.","type":"boolean"}, + "persist": {"description":"Persist activeSessionDefaultsProfile to .xcodebuildmcp/config.yaml.","type":"boolean"}, + "profile": {"description":"Activate a named session defaults profile (example: ios or watch).","minLength":1,"type":"string"} + }, + "type": "object" + }, + "name": "session_use_defaults_profile", + "outputSchema": { + "$defs": { + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.session-profile/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "currentProfile": {"type":"string"}, + "persisted": {"type":"boolean"}, + "previousProfile": {"type":"string"} + }, + "required": ["previousProfile","currentProfile"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.session-profile"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/set_sim_appearance.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/set_sim_appearance.json new file mode 100644 index 000000000..eeab5d251 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/set_sim_appearance.json @@ -0,0 +1,256 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Set Simulator Appearance"}, + "description": "Set sim appearance.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "mode": { + "description": "dark|light", + "enum": ["dark","light"], + "type": "string" + } + }, + "required": ["mode"], + "type": "object" + }, + "name": "set_sim_appearance", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.simulator-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "type": {"const":"boot"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"erase"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"open"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"reset-location"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "coordinates": { + "additionalProperties": false, + "properties": { + "latitude": {"maximum":90,"minimum":-90,"type":"number"}, + "longitude": {"maximum":180,"minimum":-180,"type":"number"} + }, + "required": ["latitude","longitude"], + "type": "object" + }, + "type": {"const":"set-location"} + }, + "required": ["type","coordinates"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "appearance": {"type":"string"}, + "type": {"const":"set-appearance"} + }, + "required": ["type","appearance"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "dataNetwork": {"type":"string"}, + "type": {"const":"statusbar"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-software-keyboard"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-connect-hardware-keyboard"} + }, + "required": ["type"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","action"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.simulator-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/set_sim_location.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/set_sim_location.json new file mode 100644 index 000000000..83abe328d --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/set_sim_location.json @@ -0,0 +1,253 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Set Simulator Location"}, + "description": "Set sim location.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "latitude": {"type":"number"}, + "longitude": {"type":"number"} + }, + "required": ["latitude","longitude"], + "type": "object" + }, + "name": "set_sim_location", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.simulator-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "type": {"const":"boot"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"erase"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"open"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"reset-location"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "coordinates": { + "additionalProperties": false, + "properties": { + "latitude": {"maximum":90,"minimum":-90,"type":"number"}, + "longitude": {"maximum":180,"minimum":-180,"type":"number"} + }, + "required": ["latitude","longitude"], + "type": "object" + }, + "type": {"const":"set-location"} + }, + "required": ["type","coordinates"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "appearance": {"type":"string"}, + "type": {"const":"set-appearance"} + }, + "required": ["type","appearance"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "dataNetwork": {"type":"string"}, + "type": {"const":"statusbar"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-software-keyboard"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-connect-hardware-keyboard"} + }, + "required": ["type"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","action"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.simulator-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/show_build_settings.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/show_build_settings.json new file mode 100644 index 000000000..9e0c15083 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/show_build_settings.json @@ -0,0 +1,164 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Show Build Settings"}, + "description": "Show build settings.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": {}, + "type": "object" + }, + "name": "show_build_settings", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "orderedEntry": { + "additionalProperties": false, + "properties": { + "key": {"type":"string"}, + "value": {"type":"string"} + }, + "required": ["key","value"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.build-settings/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "scheme": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "required": ["workspacePath","scheme"], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "entries": { + "items": {"$ref":"#/$defs/orderedEntry"}, + "type": "array" + } + }, + "required": ["artifacts","entries"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.build-settings"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/sim_statusbar.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/sim_statusbar.json new file mode 100644 index 000000000..d8e9a5864 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/sim_statusbar.json @@ -0,0 +1,256 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Simulator Statusbar"}, + "description": "Set sim status bar network.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "dataNetwork": { + "description": "clear|hide|wifi|3g|4g|lte|lte-a|lte+|5g|5g+|5g-uwb|5g-uc", + "enum": ["clear","hide","wifi","3g","4g","lte","lte-a","lte+","5g","5g+","5g-uwb","5g-uc"], + "type": "string" + } + }, + "required": ["dataNetwork"], + "type": "object" + }, + "name": "sim_statusbar", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.simulator-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "type": {"const":"boot"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"erase"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"open"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"reset-location"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "coordinates": { + "additionalProperties": false, + "properties": { + "latitude": {"maximum":90,"minimum":-90,"type":"number"}, + "longitude": {"maximum":180,"minimum":-180,"type":"number"} + }, + "required": ["latitude","longitude"], + "type": "object" + }, + "type": {"const":"set-location"} + }, + "required": ["type","coordinates"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "appearance": {"type":"string"}, + "type": {"const":"set-appearance"} + }, + "required": ["type","appearance"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "dataNetwork": {"type":"string"}, + "type": {"const":"statusbar"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-software-keyboard"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-connect-hardware-keyboard"} + }, + "required": ["type"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","action"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.simulator-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/snapshot_ui.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/snapshot_ui.json new file mode 100644 index 000000000..1f57986c3 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/snapshot_ui.json @@ -0,0 +1,389 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Snapshot UI"}, + "description": "Capture a semantic rs/1 runtime UI snapshot with elementRef targets. Observe once, use tap for one target or batch for multiple same-screen targets, and refresh after navigation, scrolling, sheet changes, or obvious layout changes.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "sinceScreenHash": {"description":"Return an unchanged response when the current screen hash matches this value","minLength":1,"type":"string"} + }, + "type": "object" + }, + "name": "snapshot_ui", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "compactRuntimeSnapshot": { + "additionalProperties": false, + "properties": { + "count": {"minimum":0,"type":"integer"}, + "evidence": { + "description": "Non-actionable semantic evidence rows in role|label|value|identifier format. These rows intentionally omit element refs.", + "items": {"type":"string"}, + "type": "array" + }, + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "scroll": { + "items": {"type":"string"}, + "type": "array" + }, + "seq": {"minimum":0,"type":"integer"}, + "targets": { + "items": {"type":"string"}, + "type": "array" + }, + "text": { + "items": {"type":"string"}, + "type": "array" + }, + "type": {"const":"runtime-snapshot"}, + "udid": {"type":"string"} + }, + "required": ["type","rs","screenHash","seq","count","targets","scroll","udid"], + "type": "object" + }, + "compactRuntimeSnapshotUnchanged": { + "additionalProperties": false, + "properties": { + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "seq": {"minimum":0,"type":"integer"}, + "type": {"const":"runtime-snapshot-unchanged"}, + "udid": {"type":"string"}, + "unchanged": {"const":true} + }, + "required": ["type","rs","screenHash","seq","unchanged","udid"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "frame": { + "additionalProperties": false, + "properties": { + "height": {"type":"number"}, + "width": {"type":"number"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y","width","height"], + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "recoverableUiError": { + "additionalProperties": false, + "properties": { + "candidates": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "code": { + "enum": ["SNAPSHOT_MISSING","SNAPSHOT_EXPIRED","SNAPSHOT_PARSE_FAILED","SNAPSHOT_CAPTURE_FAILED","ELEMENT_REF_NOT_FOUND","TARGET_NOT_FOUND","TARGET_AMBIGUOUS","TARGET_NOT_ACTIONABLE","WAIT_TIMEOUT","UI_STATE_CHANGED","ACTION_FAILED"] + }, + "elementRef": {"type":"string"}, + "message": {"type":"string"}, + "recoveryHint": {"type":"string"}, + "snapshotAgeMs": {"minimum":0,"type":"integer"}, + "timeoutMs": {"minimum":0,"type":"integer"} + }, + "required": ["code","message","recoveryHint"], + "type": "object" + }, + "runtimeActionHint": { + "additionalProperties": false, + "properties": { + "action": {"$ref":"#/$defs/runtimeActionName"}, + "elementRef": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "label": {"type":"string"} + }, + "required": ["action","elementRef"], + "type": "object" + }, + "runtimeActionName": { + "enum": ["tap","typeText","longPress","touch","swipeWithin"] + }, + "runtimeElement": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionName"}, + "type": "array" + }, + "frame": {"$ref":"#/$defs/frame"}, + "identifier": {"type":"string"}, + "label": {"type":"string"}, + "ref": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "role": {"$ref":"#/$defs/runtimeElementRole"}, + "state": {"$ref":"#/$defs/runtimeElementState"}, + "value": {"type":"string"} + }, + "required": ["ref","frame","actions"], + "type": "object" + }, + "runtimeElementRole": { + "enum": ["application","button","cell","image","keyboard-key","list","menu","other","scroll-view","slider","switch","tab","text","text-field","window"] + }, + "runtimeElementState": { + "additionalProperties": false, + "properties": { + "enabled": {"type":"boolean"}, + "focused": {"type":"boolean"}, + "selected": {"type":"boolean"}, + "visible": {"type":"boolean"} + }, + "type": "object" + }, + "runtimeSnapshot": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionHint"}, + "type": "array" + }, + "capturedAtMs": {"minimum":0,"type":"integer"}, + "elements": { + "items": {"$ref":"#/$defs/runtimeElement"}, + "type": "array" + }, + "expiresAtMs": {"minimum":0,"type":"integer"}, + "protocol": {"const":"rs/1"}, + "screenHash": {"minLength":1,"type":"string"}, + "seq": {"minimum":0,"type":"integer"}, + "simulatorId": {"type":"string"}, + "type": {"const":"runtime-snapshot"} + }, + "required": ["type","protocol","simulatorId","screenHash","seq","capturedAtMs","expiresAtMs","elements","actions"], + "type": "object" + }, + "runtimeSnapshotUnchanged": { + "additionalProperties": false, + "properties": { + "protocol": {"const":"rs/1"}, + "screenHash": {"minLength":1,"type":"string"}, + "seq": {"minimum":0,"type":"integer"}, + "simulatorId": {"type":"string"}, + "type": {"const":"runtime-snapshot-unchanged"} + }, + "required": ["type","protocol","simulatorId","screenHash","seq"], + "type": "object" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + }, + "uiHierarchyCapture": { + "additionalProperties": false, + "properties": { + "type": {"const":"ui-hierarchy"}, + "uiHierarchy": { + "items": {"$ref":"#/$defs/uiHierarchyNode"}, + "type": "array" + } + }, + "required": ["type","uiHierarchy"], + "type": "object" + }, + "uiHierarchyNode": {"type":"object"}, + "videoRecordingCapture": { + "additionalProperties": false, + "properties": { + "fps": {"minimum":1,"type":"integer"}, + "outputFile": {"type":"string"}, + "sessionId": {"type":"string"}, + "state": { + "enum": ["started","stopped"] + }, + "type": {"const":"video-recording"} + }, + "required": ["type","state"], + "type": "object" + }, + "waitMatch": { + "additionalProperties": false, + "properties": { + "matches": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "predicate": {"$ref":"#/$defs/waitPredicate"} + }, + "required": ["predicate","matches"], + "type": "object" + }, + "waitPredicate": { + "enum": ["exists","gone","enabled","focused","textContains","settled"] + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.capture-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "screenshotPath": {"type":"string"}, + "simulatorId": {"type":"string"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "capture": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "format": {"type":"string"}, + "height": {"minimum":0,"type":"integer"}, + "width": {"minimum":0,"type":"integer"} + }, + "required": ["format","width","height"], + "type": "object" + }, + {"$ref":"#/$defs/uiHierarchyCapture"}, + {"$ref":"#/$defs/runtimeSnapshot"}, + {"$ref":"#/$defs/compactRuntimeSnapshot"}, + {"$ref":"#/$defs/videoRecordingCapture"}, + {"$ref":"#/$defs/runtimeSnapshotUnchanged"}, + {"$ref":"#/$defs/compactRuntimeSnapshotUnchanged"} + ] + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"}, + "uiError": {"$ref":"#/$defs/recoverableUiError"}, + "waitMatch": {"$ref":"#/$defs/waitMatch"} + }, + "required": ["summary","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.capture-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/stop_app_device.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/stop_app_device.json new file mode 100644 index 000000000..fad7cd2b1 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/stop_app_device.json @@ -0,0 +1,169 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Stop App Device"}, + "description": "Stop device app.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "processId": {"type":"number"} + }, + "required": ["processId"], + "type": "object" + }, + "name": "stop_app_device", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.stop-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appName": {"type":"string"}, + "bundleId": {"type":"string"}, + "deviceId": {"type":"string"}, + "processId": {"minimum":1,"type":"integer"}, + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.stop-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/stop_app_sim.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/stop_app_sim.json new file mode 100644 index 000000000..61a1b4bf8 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/stop_app_sim.json @@ -0,0 +1,166 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Stop App Simulator"}, + "description": "Stop sim app.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": {}, + "type": "object" + }, + "name": "stop_app_sim", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.stop-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appName": {"type":"string"}, + "bundleId": {"type":"string"}, + "deviceId": {"type":"string"}, + "processId": {"minimum":1,"type":"integer"}, + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.stop-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/stop_mac_app.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/stop_mac_app.json new file mode 100644 index 000000000..009a782e5 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/stop_mac_app.json @@ -0,0 +1,169 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Stop macOS App"}, + "description": "Stop macOS app.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "appName": {"minLength":1,"type":"string"}, + "processId": {"exclusiveMinimum":0,"maximum":9007199254740991,"type":"integer"} + }, + "type": "object" + }, + "name": "stop_mac_app", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.stop-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appName": {"type":"string"}, + "bundleId": {"type":"string"}, + "deviceId": {"type":"string"}, + "processId": {"minimum":1,"type":"integer"}, + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.stop-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/swift_package_build.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/swift_package_build.json new file mode 100644 index 000000000..b5c95388a --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/swift_package_build.json @@ -0,0 +1,217 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Swift Package Build"}, + "description": "swift package target build.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "architectures": { + "items": {"type":"string"}, + "type": "array" + }, + "packagePath": {"type":"string"}, + "parseAsLibrary": {"type":"boolean"}, + "targetName": {"type":"string"} + }, + "required": ["packagePath"], + "type": "object" + }, + "name": "swift_package_build", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "buildInvocationRequest": { + "additionalProperties": false, + "properties": { + "arch": {"type":"string"}, + "configuration": {"type":"string"}, + "derivedDataPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "executableName": {"type":"string"}, + "onlyTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulatorId": {"type":"string"}, + "simulatorName": {"type":"string"}, + "skipTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + }, + "targetName": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.build-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "anyOf": [ + { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appPath": {"type":"string"}, + "buildLogPath": {"type":"string"}, + "bundleId": {"type":"string"}, + "configuration": {"type":"string"}, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "scheme": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "request": {"$ref":"#/$defs/buildInvocationRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + {"type":"null"} + ] + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.build-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/swift_package_clean.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/swift_package_clean.json new file mode 100644 index 000000000..6fc670d33 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/swift_package_clean.json @@ -0,0 +1,211 @@ +{ + "annotations": {"destructiveHint":true,"openWorldHint":false,"readOnlyHint":false,"title":"Swift Package Clean"}, + "description": "swift package clean.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "packagePath": {"type":"string"} + }, + "required": ["packagePath"], + "type": "object" + }, + "name": "swift_package_clean", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "buildInvocationRequest": { + "additionalProperties": false, + "properties": { + "arch": {"type":"string"}, + "configuration": {"type":"string"}, + "derivedDataPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "executableName": {"type":"string"}, + "onlyTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulatorId": {"type":"string"}, + "simulatorName": {"type":"string"}, + "skipTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + }, + "targetName": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.build-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "anyOf": [ + { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appPath": {"type":"string"}, + "buildLogPath": {"type":"string"}, + "bundleId": {"type":"string"}, + "configuration": {"type":"string"}, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "scheme": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "request": {"$ref":"#/$defs/buildInvocationRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + {"type":"null"} + ] + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.build-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/swift_package_list.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/swift_package_list.json new file mode 100644 index 000000000..dc2d15949 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/swift_package_list.json @@ -0,0 +1,143 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Swift Package List"}, + "description": "List SwiftPM processes.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": {}, + "type": "object" + }, + "name": "swift_package_list", + "outputSchema": { + "$defs": { + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.process-list/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "processes": { + "items": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "packagePath": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "name": {"type":"string"}, + "processId": {"minimum":1,"type":"integer"}, + "uptimeSeconds": {"minimum":0,"type":"integer"} + }, + "required": ["name","processId","uptimeSeconds"], + "type": "object" + }, + "type": "array" + }, + "summary": { + "additionalProperties": false, + "properties": { + "runningProcessCount": {"minimum":0,"type":"integer"} + }, + "required": ["runningProcessCount"], + "type": "object" + } + }, + "required": ["summary","processes"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.process-list"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/swift_package_run.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/swift_package_run.json new file mode 100644 index 000000000..8727e3fed --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/swift_package_run.json @@ -0,0 +1,231 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Swift Package Run"}, + "description": "swift package target run.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "arguments": { + "items": {"type":"string"}, + "type": "array" + }, + "background": {"type":"boolean"}, + "executableName": {"type":"string"}, + "packagePath": {"type":"string"}, + "parseAsLibrary": {"type":"boolean"}, + "timeout": {"type":"number"} + }, + "required": ["packagePath"], + "type": "object" + }, + "name": "swift_package_run", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "buildInvocationRequest": { + "additionalProperties": false, + "properties": { + "arch": {"type":"string"}, + "configuration": {"type":"string"}, + "derivedDataPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "executableName": {"type":"string"}, + "onlyTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulatorId": {"type":"string"}, + "simulatorName": {"type":"string"}, + "skipTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + }, + "targetName": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.build-run-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appPath": {"type":"string"}, + "buildLogPath": {"type":"string"}, + "bundleId": {"type":"string"}, + "deviceId": {"type":"string"}, + "executablePath": {"type":"string"}, + "osLogPath": {"type":"string"}, + "packagePath": {"type":"string"}, + "processId": {"minimum":1,"type":"integer"}, + "runtimeLogPath": {"type":"string"}, + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "output": { + "additionalProperties": false, + "properties": { + "stderr": { + "items": {"type":"string"}, + "type": "array" + }, + "stdout": { + "items": {"type":"string"}, + "type": "array" + } + }, + "required": ["stdout","stderr"], + "type": "object" + }, + "request": {"$ref":"#/$defs/buildInvocationRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.build-run-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/swift_package_stop.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/swift_package_stop.json new file mode 100644 index 000000000..d77993d51 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/swift_package_stop.json @@ -0,0 +1,169 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Swift Package Stop"}, + "description": "Stop SwiftPM run.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "pid": {"type":"number"} + }, + "required": ["pid"], + "type": "object" + }, + "name": "swift_package_stop", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.stop-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "appName": {"type":"string"}, + "bundleId": {"type":"string"}, + "deviceId": {"type":"string"}, + "processId": {"minimum":1,"type":"integer"}, + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.stop-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/swift_package_test.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/swift_package_test.json new file mode 100644 index 000000000..1cdd9514a --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/swift_package_test.json @@ -0,0 +1,272 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Swift Package Test"}, + "description": "Run swift package target tests.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "filter": {"description":"regex: pattern","type":"string"}, + "packagePath": {"type":"string"}, + "parallel": {"type":"boolean"}, + "parseAsLibrary": {"type":"boolean"}, + "showCodecov": {"type":"boolean"}, + "testProduct": {"type":"string"} + }, + "required": ["packagePath"], + "type": "object" + }, + "name": "swift_package_test", + "outputSchema": { + "$defs": { + "buildInvocationRequest": { + "additionalProperties": false, + "properties": { + "arch": {"type":"string"}, + "configuration": {"type":"string"}, + "derivedDataPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "executableName": {"type":"string"}, + "onlyTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulatorId": {"type":"string"}, + "simulatorName": {"type":"string"}, + "skipTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + }, + "targetName": {"type":"string"}, + "workspacePath": {"type":"string"} + }, + "type": "object" + }, + "counts": { + "additionalProperties": false, + "properties": { + "failed": {"minimum":0,"type":"integer"}, + "passed": {"minimum":0,"type":"integer"}, + "skipped": {"minimum":0,"type":"integer"} + }, + "required": ["passed","failed","skipped"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "testDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "testFailures": { + "items": {"$ref":"#/$defs/testFailureEntry"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors","testFailures"], + "type": "object" + }, + "testFailureEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"}, + "suite": {"type":"string"}, + "test": {"type":"string"} + }, + "required": ["suite","test","message"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.test-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "buildLogPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "packagePath": {"type":"string"}, + "xcresultPath": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/testDiagnostics"}, + "request": {"$ref":"#/$defs/buildInvocationRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "counts": {"$ref":"#/$defs/counts"}, + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + }, + "testCases": { + "items": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["passed","failed","skipped"] + }, + "suite": {"type":"string"}, + "test": {"type":"string"} + }, + "required": ["test","status"], + "type": "object" + }, + "type": "array" + }, + "tests": { + "additionalProperties": false, + "properties": { + "discovered": { + "additionalProperties": false, + "properties": { + "items": { + "items": {"type":"string"}, + "type": "array" + }, + "total": {"minimum":0,"type":"integer"} + }, + "required": ["total","items"], + "type": "object" + }, + "selected": { + "items": {"type":"string"}, + "type": "array" + } + }, + "required": [], + "type": "object" + } + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.test-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/swipe.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/swipe.json new file mode 100644 index 000000000..042224c68 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/swipe.json @@ -0,0 +1,478 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Swipe"}, + "description": "Swipe within a scrollable UI element using withinElementRef from a current rs/1 runtime snapshot. withinElementRef is required; do not use elementRef. Optional distance is a normalized stroke fraction greater than 0 and up to 1. Example input: {\"withinElementRef\":\"e7\",\"direction\":\"up\",\"distance\":0.7}.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "direction": { + "description": "up|down|left|right", + "enum": ["up","down","left","right"], + "type": "string" + }, + "distance": {"description":"Normalized stroke fraction greater than 0 and up to 1","exclusiveMinimum":0,"maximum":1,"type":"number"}, + "duration": {"description":"seconds","exclusiveMinimum":0,"type":"number"}, + "postDelay": {"description":"seconds","maximum":10,"minimum":0,"type":"number"}, + "preDelay": {"description":"seconds","maximum":10,"minimum":0,"type":"number"}, + "withinElementRef": {"minLength":1,"type":"string"} + }, + "required": ["withinElementRef","direction"], + "type": "object" + }, + "name": "swipe", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "compactRuntimeSnapshot": { + "additionalProperties": false, + "properties": { + "count": {"minimum":0,"type":"integer"}, + "evidence": { + "description": "Non-actionable semantic evidence rows in role|label|value|identifier format. These rows intentionally omit element refs.", + "items": {"type":"string"}, + "type": "array" + }, + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "scroll": { + "items": {"type":"string"}, + "type": "array" + }, + "seq": {"minimum":0,"type":"integer"}, + "targets": { + "items": {"type":"string"}, + "type": "array" + }, + "text": { + "items": {"type":"string"}, + "type": "array" + }, + "type": {"const":"runtime-snapshot"}, + "udid": {"type":"string"} + }, + "required": ["type","rs","screenHash","seq","count","targets","scroll","udid"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "direction": { + "enum": ["up","down","left","right"] + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "frame": { + "additionalProperties": false, + "properties": { + "height": {"type":"number"}, + "width": {"type":"number"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y","width","height"], + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "point": { + "additionalProperties": false, + "properties": { + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y"], + "type": "object" + }, + "recoverableUiError": { + "additionalProperties": false, + "properties": { + "candidates": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "code": { + "enum": ["SNAPSHOT_MISSING","SNAPSHOT_EXPIRED","SNAPSHOT_PARSE_FAILED","SNAPSHOT_CAPTURE_FAILED","ELEMENT_REF_NOT_FOUND","TARGET_NOT_FOUND","TARGET_AMBIGUOUS","TARGET_NOT_ACTIONABLE","WAIT_TIMEOUT","UI_STATE_CHANGED","ACTION_FAILED"] + }, + "elementRef": {"type":"string"}, + "message": {"type":"string"}, + "recoveryHint": {"type":"string"}, + "snapshotAgeMs": {"minimum":0,"type":"integer"}, + "timeoutMs": {"minimum":0,"type":"integer"} + }, + "required": ["code","message","recoveryHint"], + "type": "object" + }, + "runtimeActionName": { + "enum": ["tap","typeText","longPress","touch","swipeWithin"] + }, + "runtimeElement": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionName"}, + "type": "array" + }, + "frame": {"$ref":"#/$defs/frame"}, + "identifier": {"type":"string"}, + "label": {"type":"string"}, + "ref": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "role": {"$ref":"#/$defs/runtimeElementRole"}, + "state": {"$ref":"#/$defs/runtimeElementState"}, + "value": {"type":"string"} + }, + "required": ["ref","frame","actions"], + "type": "object" + }, + "runtimeElementRole": { + "enum": ["application","button","cell","image","keyboard-key","list","menu","other","scroll-view","slider","switch","tab","text","text-field","window"] + }, + "runtimeElementState": { + "additionalProperties": false, + "properties": { + "enabled": {"type":"boolean"}, + "focused": {"type":"boolean"}, + "selected": {"type":"boolean"}, + "visible": {"type":"boolean"} + }, + "type": "object" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.ui-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"}, + "withinElementRef": {"type":"string"} + }, + "required": ["type","withinElementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"} + }, + "required": ["type","from","to"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"swipe"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "elementRef": {"type":"string"}, + "from": {"$ref":"#/$defs/point"}, + "steps": {"minimum":1,"type":"integer"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"drag"} + }, + "required": ["type","elementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"touch"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "elementRef": {"type":"string"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "button": {"type":"string"}, + "type": {"const":"button"} + }, + "required": ["type","button"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "gesture": {"type":"string"}, + "type": {"const":"gesture"} + }, + "required": ["type","gesture"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCode": {"minimum":0,"type":"integer"}, + "type": {"const":"key-press"} + }, + "required": ["type","keyCode"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCodes": { + "items": {"minimum":0,"type":"integer"}, + "type": "array" + }, + "type": {"const":"key-sequence"} + }, + "required": ["type","keyCodes"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "stepCount": {"minimum":1,"type":"integer"}, + "type": {"const":"batch"} + }, + "required": ["type","stepCount"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "capture": {"$ref":"#/$defs/compactRuntimeSnapshot"}, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"}, + "uiError": {"$ref":"#/$defs/recoverableUiError"} + }, + "required": ["summary","action","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.ui-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/sync_xcode_defaults.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/sync_xcode_defaults.json new file mode 100644 index 000000000..500ab3f64 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/sync_xcode_defaults.json @@ -0,0 +1,258 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Sync Xcode Defaults"}, + "description": "Sync session defaults (scheme, simulator) from Xcode's current IDE selection.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": {}, + "type": "object" + }, + "name": "sync_xcode_defaults", + "outputSchema": { + "$defs": { + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "sessionDefaultsOperation": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "type": {"const":"show"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"sync-xcode"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "activatedProfile": {"type":"string"}, + "changedKeys": { + "items": {"type":"string"}, + "type": "array" + }, + "notices": { + "items": {"type":"string"}, + "type": "array" + }, + "persisted": {"type":"boolean"}, + "type": {"const":"set"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "clearedKeys": { + "items": {"type":"string"}, + "type": "array" + }, + "profile": {"type":"string"}, + "scope": { + "enum": ["all","profile","current"] + }, + "type": {"const":"clear"} + }, + "required": ["type","scope"], + "type": "object" + } + ] + }, + "sessionDefaultsProfile": { + "additionalProperties": false, + "properties": { + "arch": { + "anyOf": [ + {"const":null}, + { + "enum": ["arm64","x86_64"] + } + ] + }, + "bundleId": { + "type": ["string","null"] + }, + "configuration": { + "type": ["string","null"] + }, + "derivedDataPath": { + "type": ["string","null"] + }, + "deviceId": { + "type": ["string","null"] + }, + "env": { + "anyOf": [ + {"const":null}, + { + "additionalProperties": {"type":"string"}, + "propertyNames": {"minLength":1,"type":"string"}, + "type": "object" + } + ] + }, + "extraArgs": { + "anyOf": [ + {"const":null}, + { + "items": {"type":"string"}, + "type": "array" + } + ] + }, + "platform": { + "type": ["string","null"] + }, + "preferXcodebuild": { + "type": ["boolean","null"] + }, + "projectPath": { + "type": ["string","null"] + }, + "scheme": { + "type": ["string","null"] + }, + "simulatorId": { + "type": ["string","null"] + }, + "simulatorName": { + "type": ["string","null"] + }, + "simulatorPlatform": { + "anyOf": [ + {"const":null}, + { + "enum": ["iOS Simulator","watchOS Simulator","tvOS Simulator","visionOS Simulator"] + } + ] + }, + "suppressWarnings": { + "type": ["boolean","null"] + }, + "useLatestOS": { + "type": ["boolean","null"] + }, + "workspacePath": { + "type": ["string","null"] + } + }, + "required": ["projectPath","workspacePath","scheme","configuration","simulatorName","simulatorId","simulatorPlatform","deviceId","useLatestOS","arch","suppressWarnings","derivedDataPath","preferXcodebuild","platform","bundleId","env"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.session-defaults/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "currentProfile": {"type":"string"}, + "operation": {"$ref":"#/$defs/sessionDefaultsOperation"}, + "profiles": { + "additionalProperties": {"$ref":"#/$defs/sessionDefaultsProfile"}, + "properties": { + "(default)": {"$ref":"#/$defs/sessionDefaultsProfile"} + }, + "required": ["(default)"], + "type": "object" + } + }, + "required": ["currentProfile","profiles"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.session-defaults"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/tap.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/tap.json new file mode 100644 index 000000000..b426e8d7e --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/tap.json @@ -0,0 +1,471 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Tap"}, + "description": "Tap one elementRef from the latest snapshot_ui or wait_for_ui output. The elementRef must list the tap action in the snapshot targets; do not use refs from text-only rows. For multiple same-screen taps or visible switch toggles with no intermediate assertion, use batch instead of repeated tap calls. Other same-screen refs may remain usable after success; refresh after navigation, scrolling, sheet changes, or obvious layout changes.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "elementRef": {"minLength":1,"type":"string"}, + "postDelay": {"description":"seconds","maximum":10,"minimum":0,"type":"number"}, + "preDelay": {"description":"seconds","maximum":10,"minimum":0,"type":"number"} + }, + "required": ["elementRef"], + "type": "object" + }, + "name": "tap", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "compactRuntimeSnapshot": { + "additionalProperties": false, + "properties": { + "count": {"minimum":0,"type":"integer"}, + "evidence": { + "description": "Non-actionable semantic evidence rows in role|label|value|identifier format. These rows intentionally omit element refs.", + "items": {"type":"string"}, + "type": "array" + }, + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "scroll": { + "items": {"type":"string"}, + "type": "array" + }, + "seq": {"minimum":0,"type":"integer"}, + "targets": { + "items": {"type":"string"}, + "type": "array" + }, + "text": { + "items": {"type":"string"}, + "type": "array" + }, + "type": {"const":"runtime-snapshot"}, + "udid": {"type":"string"} + }, + "required": ["type","rs","screenHash","seq","count","targets","scroll","udid"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "direction": { + "enum": ["up","down","left","right"] + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "frame": { + "additionalProperties": false, + "properties": { + "height": {"type":"number"}, + "width": {"type":"number"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y","width","height"], + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "point": { + "additionalProperties": false, + "properties": { + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y"], + "type": "object" + }, + "recoverableUiError": { + "additionalProperties": false, + "properties": { + "candidates": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "code": { + "enum": ["SNAPSHOT_MISSING","SNAPSHOT_EXPIRED","SNAPSHOT_PARSE_FAILED","SNAPSHOT_CAPTURE_FAILED","ELEMENT_REF_NOT_FOUND","TARGET_NOT_FOUND","TARGET_AMBIGUOUS","TARGET_NOT_ACTIONABLE","WAIT_TIMEOUT","UI_STATE_CHANGED","ACTION_FAILED"] + }, + "elementRef": {"type":"string"}, + "message": {"type":"string"}, + "recoveryHint": {"type":"string"}, + "snapshotAgeMs": {"minimum":0,"type":"integer"}, + "timeoutMs": {"minimum":0,"type":"integer"} + }, + "required": ["code","message","recoveryHint"], + "type": "object" + }, + "runtimeActionName": { + "enum": ["tap","typeText","longPress","touch","swipeWithin"] + }, + "runtimeElement": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionName"}, + "type": "array" + }, + "frame": {"$ref":"#/$defs/frame"}, + "identifier": {"type":"string"}, + "label": {"type":"string"}, + "ref": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "role": {"$ref":"#/$defs/runtimeElementRole"}, + "state": {"$ref":"#/$defs/runtimeElementState"}, + "value": {"type":"string"} + }, + "required": ["ref","frame","actions"], + "type": "object" + }, + "runtimeElementRole": { + "enum": ["application","button","cell","image","keyboard-key","list","menu","other","scroll-view","slider","switch","tab","text","text-field","window"] + }, + "runtimeElementState": { + "additionalProperties": false, + "properties": { + "enabled": {"type":"boolean"}, + "focused": {"type":"boolean"}, + "selected": {"type":"boolean"}, + "visible": {"type":"boolean"} + }, + "type": "object" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.ui-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"}, + "withinElementRef": {"type":"string"} + }, + "required": ["type","withinElementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"} + }, + "required": ["type","from","to"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"swipe"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "elementRef": {"type":"string"}, + "from": {"$ref":"#/$defs/point"}, + "steps": {"minimum":1,"type":"integer"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"drag"} + }, + "required": ["type","elementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"touch"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "elementRef": {"type":"string"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "button": {"type":"string"}, + "type": {"const":"button"} + }, + "required": ["type","button"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "gesture": {"type":"string"}, + "type": {"const":"gesture"} + }, + "required": ["type","gesture"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCode": {"minimum":0,"type":"integer"}, + "type": {"const":"key-press"} + }, + "required": ["type","keyCode"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCodes": { + "items": {"minimum":0,"type":"integer"}, + "type": "array" + }, + "type": {"const":"key-sequence"} + }, + "required": ["type","keyCodes"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "stepCount": {"minimum":1,"type":"integer"}, + "type": {"const":"batch"} + }, + "required": ["type","stepCount"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "capture": {"$ref":"#/$defs/compactRuntimeSnapshot"}, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"}, + "uiError": {"$ref":"#/$defs/recoverableUiError"} + }, + "required": ["summary","action","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.ui-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/test_device.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/test_device.json new file mode 100644 index 000000000..81405d072 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/test_device.json @@ -0,0 +1,295 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Test Device"}, + "description": "Test on device.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "extraArgs": { + "items": {"type":"string"}, + "type": "array" + }, + "platform": { + "description": "Device platform: iOS, watchOS, tvOS, or visionOS. Defaults to iOS.", + "enum": ["iOS","watchOS","tvOS","visionOS"], + "type": "string" + }, + "progress": {"description":"Show detailed test progress output (MCP defaults to true, CLI defaults to false)","type":"boolean"}, + "testProductsPath": {"description":"Path to a prepared .xctestproducts package. Cannot be combined with source inputs","type":"string"}, + "testRunnerEnv": { + "description": "Environment variables to pass to the test runner (TEST_RUNNER_ prefix added automatically)", + "items": { + "additionalProperties": false, + "properties": { + "key": {"minLength":1,"type":"string"}, + "value": {"type":"string"} + }, + "required": ["key","value"], + "type": "object" + }, + "type": "array" + }, + "xctestrunPath": {"description":"Path to a prepared .xctestrun file. Cannot be combined with source inputs","type":"string"} + }, + "type": "object" + }, + "name": "test_device", + "outputSchema": { + "$defs": { + "buildInvocationRequest": { + "additionalProperties": false, + "properties": { + "arch": {"type":"string"}, + "buildForTesting": {"type":"boolean"}, + "configuration": {"type":"string"}, + "derivedDataPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "executableName": {"type":"string"}, + "onlyTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulatorId": {"type":"string"}, + "simulatorName": {"type":"string"}, + "skipTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + }, + "targetName": {"type":"string"}, + "testProductsPath": {"type":"string"}, + "workspacePath": {"type":"string"}, + "xctestrunPath": {"type":"string"} + }, + "type": "object" + }, + "counts": { + "additionalProperties": false, + "properties": { + "failed": {"minimum":0,"type":"integer"}, + "passed": {"minimum":0,"type":"integer"}, + "skipped": {"minimum":0,"type":"integer"} + }, + "required": ["passed","failed","skipped"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "testDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "testFailures": { + "items": {"$ref":"#/$defs/testFailureEntry"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors","testFailures"], + "type": "object" + }, + "testFailureEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"}, + "suite": {"type":"string"}, + "test": {"type":"string"} + }, + "required": ["suite","test","message"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.test-result/3.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "buildLogPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "packagePath": {"type":"string"}, + "testProductsPath": {"type":"string"}, + "xcresultPath": {"type":"string"}, + "xctestrunPath": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/testDiagnostics"}, + "request": {"$ref":"#/$defs/buildInvocationRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "counts": {"$ref":"#/$defs/counts"}, + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + }, + "testCases": { + "items": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["passed","failed","skipped"] + }, + "suite": {"type":"string"}, + "test": {"type":"string"} + }, + "required": ["test","status"], + "type": "object" + }, + "type": "array" + }, + "tests": { + "additionalProperties": false, + "properties": { + "discovered": { + "additionalProperties": false, + "properties": { + "items": { + "items": {"type":"string"}, + "type": "array" + }, + "total": {"minimum":0,"type":"integer"} + }, + "required": ["total","items"], + "type": "object" + }, + "selected": { + "items": {"type":"string"}, + "type": "array" + } + }, + "required": [], + "type": "object" + } + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.test-result"}, + "schemaVersion": {"const":"3"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/test_macos.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/test_macos.json new file mode 100644 index 000000000..f5b6d53fa --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/test_macos.json @@ -0,0 +1,290 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Test macOS"}, + "description": "Test macOS target.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "extraArgs": { + "items": {"type":"string"}, + "type": "array" + }, + "progress": {"description":"Show detailed test progress output (MCP defaults to true, CLI defaults to false)","type":"boolean"}, + "testProductsPath": {"description":"Path to a prepared .xctestproducts package. Cannot be combined with source inputs","type":"string"}, + "testRunnerEnv": { + "description": "Environment variables to pass to the test runner (TEST_RUNNER_ prefix added automatically)", + "items": { + "additionalProperties": false, + "properties": { + "key": {"minLength":1,"type":"string"}, + "value": {"type":"string"} + }, + "required": ["key","value"], + "type": "object" + }, + "type": "array" + }, + "xctestrunPath": {"description":"Path to a prepared .xctestrun file. Cannot be combined with source inputs","type":"string"} + }, + "type": "object" + }, + "name": "test_macos", + "outputSchema": { + "$defs": { + "buildInvocationRequest": { + "additionalProperties": false, + "properties": { + "arch": {"type":"string"}, + "buildForTesting": {"type":"boolean"}, + "configuration": {"type":"string"}, + "derivedDataPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "executableName": {"type":"string"}, + "onlyTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulatorId": {"type":"string"}, + "simulatorName": {"type":"string"}, + "skipTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + }, + "targetName": {"type":"string"}, + "testProductsPath": {"type":"string"}, + "workspacePath": {"type":"string"}, + "xctestrunPath": {"type":"string"} + }, + "type": "object" + }, + "counts": { + "additionalProperties": false, + "properties": { + "failed": {"minimum":0,"type":"integer"}, + "passed": {"minimum":0,"type":"integer"}, + "skipped": {"minimum":0,"type":"integer"} + }, + "required": ["passed","failed","skipped"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "testDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "testFailures": { + "items": {"$ref":"#/$defs/testFailureEntry"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors","testFailures"], + "type": "object" + }, + "testFailureEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"}, + "suite": {"type":"string"}, + "test": {"type":"string"} + }, + "required": ["suite","test","message"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.test-result/3.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "buildLogPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "packagePath": {"type":"string"}, + "testProductsPath": {"type":"string"}, + "xcresultPath": {"type":"string"}, + "xctestrunPath": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/testDiagnostics"}, + "request": {"$ref":"#/$defs/buildInvocationRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "counts": {"$ref":"#/$defs/counts"}, + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + }, + "testCases": { + "items": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["passed","failed","skipped"] + }, + "suite": {"type":"string"}, + "test": {"type":"string"} + }, + "required": ["test","status"], + "type": "object" + }, + "type": "array" + }, + "tests": { + "additionalProperties": false, + "properties": { + "discovered": { + "additionalProperties": false, + "properties": { + "items": { + "items": {"type":"string"}, + "type": "array" + }, + "total": {"minimum":0,"type":"integer"} + }, + "required": ["total","items"], + "type": "object" + }, + "selected": { + "items": {"type":"string"}, + "type": "array" + } + }, + "required": [], + "type": "object" + } + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.test-result"}, + "schemaVersion": {"const":"3"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/test_sim.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/test_sim.json new file mode 100644 index 000000000..a9c02ce97 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/test_sim.json @@ -0,0 +1,290 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Test Simulator"}, + "description": "Test on iOS sim.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "extraArgs": { + "items": {"type":"string"}, + "type": "array" + }, + "progress": {"description":"Show detailed test progress output (MCP defaults to true, CLI defaults to false)","type":"boolean"}, + "testProductsPath": {"description":"Path to a prepared .xctestproducts package. Cannot be combined with source inputs","type":"string"}, + "testRunnerEnv": { + "description": "Environment variables to pass to the test runner (TEST_RUNNER_ prefix added automatically)", + "items": { + "additionalProperties": false, + "properties": { + "key": {"minLength":1,"type":"string"}, + "value": {"type":"string"} + }, + "required": ["key","value"], + "type": "object" + }, + "type": "array" + }, + "xctestrunPath": {"description":"Path to a prepared .xctestrun file. Cannot be combined with source inputs","type":"string"} + }, + "type": "object" + }, + "name": "test_sim", + "outputSchema": { + "$defs": { + "buildInvocationRequest": { + "additionalProperties": false, + "properties": { + "arch": {"type":"string"}, + "buildForTesting": {"type":"boolean"}, + "configuration": {"type":"string"}, + "derivedDataPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "executableName": {"type":"string"}, + "onlyTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "packagePath": {"type":"string"}, + "platform": {"type":"string"}, + "projectPath": {"type":"string"}, + "scheme": {"type":"string"}, + "simulatorId": {"type":"string"}, + "simulatorName": {"type":"string"}, + "skipTesting": { + "items": {"type":"string"}, + "type": "array" + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + }, + "targetName": {"type":"string"}, + "testProductsPath": {"type":"string"}, + "workspacePath": {"type":"string"}, + "xctestrunPath": {"type":"string"} + }, + "type": "object" + }, + "counts": { + "additionalProperties": false, + "properties": { + "failed": {"minimum":0,"type":"integer"}, + "passed": {"minimum":0,"type":"integer"}, + "skipped": {"minimum":0,"type":"integer"} + }, + "required": ["passed","failed","skipped"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "testDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "testFailures": { + "items": {"$ref":"#/$defs/testFailureEntry"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors","testFailures"], + "type": "object" + }, + "testFailureEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"}, + "suite": {"type":"string"}, + "test": {"type":"string"} + }, + "required": ["suite","test","message"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.test-result/3.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "buildLogPath": {"type":"string"}, + "deviceId": {"type":"string"}, + "packagePath": {"type":"string"}, + "testProductsPath": {"type":"string"}, + "xcresultPath": {"type":"string"}, + "xctestrunPath": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/testDiagnostics"}, + "request": {"$ref":"#/$defs/buildInvocationRequest"}, + "summary": { + "additionalProperties": false, + "properties": { + "counts": {"$ref":"#/$defs/counts"}, + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["SUCCEEDED","FAILED"] + }, + "target": { + "enum": ["simulator","device","macos","swift-package"] + } + }, + "required": ["status"], + "type": "object" + }, + "testCases": { + "items": { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "status": { + "enum": ["passed","failed","skipped"] + }, + "suite": {"type":"string"}, + "test": {"type":"string"} + }, + "required": ["test","status"], + "type": "object" + }, + "type": "array" + }, + "tests": { + "additionalProperties": false, + "properties": { + "discovered": { + "additionalProperties": false, + "properties": { + "items": { + "items": {"type":"string"}, + "type": "array" + }, + "total": {"minimum":0,"type":"integer"} + }, + "required": ["total","items"], + "type": "object" + }, + "selected": { + "items": {"type":"string"}, + "type": "array" + } + }, + "required": [], + "type": "object" + } + }, + "required": ["summary","artifacts","diagnostics"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.test-result"}, + "schemaVersion": {"const":"3"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/toggle_connect_hardware_keyboard.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/toggle_connect_hardware_keyboard.json new file mode 100644 index 000000000..423eb4fa6 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/toggle_connect_hardware_keyboard.json @@ -0,0 +1,249 @@ +{ + "annotations": {"destructiveHint":false,"idempotentHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Toggle Connect Hardware Keyboard"}, + "description": "Toggle whether the iOS Simulator simulates a hardware keyboard connection. Disconnecting makes the on-screen keyboard appear for tap-based input. Requires the simulator to be booted and Accessibility permission for the MCP host.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": {}, + "type": "object" + }, + "name": "toggle_connect_hardware_keyboard", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.simulator-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "type": {"const":"boot"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"erase"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"open"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"reset-location"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "coordinates": { + "additionalProperties": false, + "properties": { + "latitude": {"maximum":90,"minimum":-90,"type":"number"}, + "longitude": {"maximum":180,"minimum":-180,"type":"number"} + }, + "required": ["latitude","longitude"], + "type": "object" + }, + "type": {"const":"set-location"} + }, + "required": ["type","coordinates"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "appearance": {"type":"string"}, + "type": {"const":"set-appearance"} + }, + "required": ["type","appearance"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "dataNetwork": {"type":"string"}, + "type": {"const":"statusbar"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-software-keyboard"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-connect-hardware-keyboard"} + }, + "required": ["type"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","action"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.simulator-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/toggle_software_keyboard.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/toggle_software_keyboard.json new file mode 100644 index 000000000..b2f7bec68 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/toggle_software_keyboard.json @@ -0,0 +1,249 @@ +{ + "annotations": {"destructiveHint":false,"idempotentHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Toggle Software Keyboard"}, + "description": "Toggle the iOS Simulator software keyboard. Shows or hides the on-screen keyboard. Requires the simulator to be booted and Accessibility permission for the MCP host.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": {}, + "type": "object" + }, + "name": "toggle_software_keyboard", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.simulator-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "type": {"const":"boot"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"erase"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"open"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"reset-location"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "coordinates": { + "additionalProperties": false, + "properties": { + "latitude": {"maximum":90,"minimum":-90,"type":"number"}, + "longitude": {"maximum":180,"minimum":-180,"type":"number"} + }, + "required": ["latitude","longitude"], + "type": "object" + }, + "type": {"const":"set-location"} + }, + "required": ["type","coordinates"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "appearance": {"type":"string"}, + "type": {"const":"set-appearance"} + }, + "required": ["type","appearance"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "dataNetwork": {"type":"string"}, + "type": {"const":"statusbar"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-software-keyboard"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"toggle-connect-hardware-keyboard"} + }, + "required": ["type"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": [], + "type": "object" + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"} + }, + "required": ["summary","action"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.simulator-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/touch.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/touch.json new file mode 100644 index 000000000..3f85cfa18 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/touch.json @@ -0,0 +1,472 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Touch"}, + "description": "Send touch down/up events to a UI element by elementRef from a current rs/1 runtime snapshot.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "delay": {"description":"seconds","maximum":10,"minimum":0,"type":"number"}, + "down": {"type":"boolean"}, + "elementRef": {"minLength":1,"type":"string"}, + "up": {"type":"boolean"} + }, + "required": ["elementRef"], + "type": "object" + }, + "name": "touch", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "compactRuntimeSnapshot": { + "additionalProperties": false, + "properties": { + "count": {"minimum":0,"type":"integer"}, + "evidence": { + "description": "Non-actionable semantic evidence rows in role|label|value|identifier format. These rows intentionally omit element refs.", + "items": {"type":"string"}, + "type": "array" + }, + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "scroll": { + "items": {"type":"string"}, + "type": "array" + }, + "seq": {"minimum":0,"type":"integer"}, + "targets": { + "items": {"type":"string"}, + "type": "array" + }, + "text": { + "items": {"type":"string"}, + "type": "array" + }, + "type": {"const":"runtime-snapshot"}, + "udid": {"type":"string"} + }, + "required": ["type","rs","screenHash","seq","count","targets","scroll","udid"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "direction": { + "enum": ["up","down","left","right"] + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "frame": { + "additionalProperties": false, + "properties": { + "height": {"type":"number"}, + "width": {"type":"number"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y","width","height"], + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "point": { + "additionalProperties": false, + "properties": { + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y"], + "type": "object" + }, + "recoverableUiError": { + "additionalProperties": false, + "properties": { + "candidates": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "code": { + "enum": ["SNAPSHOT_MISSING","SNAPSHOT_EXPIRED","SNAPSHOT_PARSE_FAILED","SNAPSHOT_CAPTURE_FAILED","ELEMENT_REF_NOT_FOUND","TARGET_NOT_FOUND","TARGET_AMBIGUOUS","TARGET_NOT_ACTIONABLE","WAIT_TIMEOUT","UI_STATE_CHANGED","ACTION_FAILED"] + }, + "elementRef": {"type":"string"}, + "message": {"type":"string"}, + "recoveryHint": {"type":"string"}, + "snapshotAgeMs": {"minimum":0,"type":"integer"}, + "timeoutMs": {"minimum":0,"type":"integer"} + }, + "required": ["code","message","recoveryHint"], + "type": "object" + }, + "runtimeActionName": { + "enum": ["tap","typeText","longPress","touch","swipeWithin"] + }, + "runtimeElement": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionName"}, + "type": "array" + }, + "frame": {"$ref":"#/$defs/frame"}, + "identifier": {"type":"string"}, + "label": {"type":"string"}, + "ref": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "role": {"$ref":"#/$defs/runtimeElementRole"}, + "state": {"$ref":"#/$defs/runtimeElementState"}, + "value": {"type":"string"} + }, + "required": ["ref","frame","actions"], + "type": "object" + }, + "runtimeElementRole": { + "enum": ["application","button","cell","image","keyboard-key","list","menu","other","scroll-view","slider","switch","tab","text","text-field","window"] + }, + "runtimeElementState": { + "additionalProperties": false, + "properties": { + "enabled": {"type":"boolean"}, + "focused": {"type":"boolean"}, + "selected": {"type":"boolean"}, + "visible": {"type":"boolean"} + }, + "type": "object" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.ui-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"}, + "withinElementRef": {"type":"string"} + }, + "required": ["type","withinElementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"} + }, + "required": ["type","from","to"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"swipe"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "elementRef": {"type":"string"}, + "from": {"$ref":"#/$defs/point"}, + "steps": {"minimum":1,"type":"integer"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"drag"} + }, + "required": ["type","elementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"touch"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "elementRef": {"type":"string"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "button": {"type":"string"}, + "type": {"const":"button"} + }, + "required": ["type","button"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "gesture": {"type":"string"}, + "type": {"const":"gesture"} + }, + "required": ["type","gesture"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCode": {"minimum":0,"type":"integer"}, + "type": {"const":"key-press"} + }, + "required": ["type","keyCode"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCodes": { + "items": {"minimum":0,"type":"integer"}, + "type": "array" + }, + "type": {"const":"key-sequence"} + }, + "required": ["type","keyCodes"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "stepCount": {"minimum":1,"type":"integer"}, + "type": {"const":"batch"} + }, + "required": ["type","stepCount"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "capture": {"$ref":"#/$defs/compactRuntimeSnapshot"}, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"}, + "uiError": {"$ref":"#/$defs/recoverableUiError"} + }, + "required": ["summary","action","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.ui-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/type_text.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/type_text.json new file mode 100644 index 000000000..c46ef873a --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/type_text.json @@ -0,0 +1,471 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Type Text"}, + "description": "Type text into a UI element by elementRef from a current rs/1 runtime snapshot, optionally replacing existing field contents. elementRef is required; do not call with only text. Example input: {\"elementRef\":\"e8\",\"text\":\"London\",\"replaceExisting\":true}.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "elementRef": {"description":"Required runtime text-field elementRef from the latest snapshot_ui or wait_for_ui output","minLength":1,"type":"string"}, + "replaceExisting": {"description":"Select and replace existing field contents before typing","type":"boolean"}, + "text": {"description":"Text to type","minLength":1,"type":"string"} + }, + "required": ["elementRef","text"], + "type": "object" + }, + "name": "type_text", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "compactRuntimeSnapshot": { + "additionalProperties": false, + "properties": { + "count": {"minimum":0,"type":"integer"}, + "evidence": { + "description": "Non-actionable semantic evidence rows in role|label|value|identifier format. These rows intentionally omit element refs.", + "items": {"type":"string"}, + "type": "array" + }, + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "scroll": { + "items": {"type":"string"}, + "type": "array" + }, + "seq": {"minimum":0,"type":"integer"}, + "targets": { + "items": {"type":"string"}, + "type": "array" + }, + "text": { + "items": {"type":"string"}, + "type": "array" + }, + "type": {"const":"runtime-snapshot"}, + "udid": {"type":"string"} + }, + "required": ["type","rs","screenHash","seq","count","targets","scroll","udid"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "direction": { + "enum": ["up","down","left","right"] + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "frame": { + "additionalProperties": false, + "properties": { + "height": {"type":"number"}, + "width": {"type":"number"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y","width","height"], + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "point": { + "additionalProperties": false, + "properties": { + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y"], + "type": "object" + }, + "recoverableUiError": { + "additionalProperties": false, + "properties": { + "candidates": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "code": { + "enum": ["SNAPSHOT_MISSING","SNAPSHOT_EXPIRED","SNAPSHOT_PARSE_FAILED","SNAPSHOT_CAPTURE_FAILED","ELEMENT_REF_NOT_FOUND","TARGET_NOT_FOUND","TARGET_AMBIGUOUS","TARGET_NOT_ACTIONABLE","WAIT_TIMEOUT","UI_STATE_CHANGED","ACTION_FAILED"] + }, + "elementRef": {"type":"string"}, + "message": {"type":"string"}, + "recoveryHint": {"type":"string"}, + "snapshotAgeMs": {"minimum":0,"type":"integer"}, + "timeoutMs": {"minimum":0,"type":"integer"} + }, + "required": ["code","message","recoveryHint"], + "type": "object" + }, + "runtimeActionName": { + "enum": ["tap","typeText","longPress","touch","swipeWithin"] + }, + "runtimeElement": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionName"}, + "type": "array" + }, + "frame": {"$ref":"#/$defs/frame"}, + "identifier": {"type":"string"}, + "label": {"type":"string"}, + "ref": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "role": {"$ref":"#/$defs/runtimeElementRole"}, + "state": {"$ref":"#/$defs/runtimeElementState"}, + "value": {"type":"string"} + }, + "required": ["ref","frame","actions"], + "type": "object" + }, + "runtimeElementRole": { + "enum": ["application","button","cell","image","keyboard-key","list","menu","other","scroll-view","slider","switch","tab","text","text-field","window"] + }, + "runtimeElementState": { + "additionalProperties": false, + "properties": { + "enabled": {"type":"boolean"}, + "focused": {"type":"boolean"}, + "selected": {"type":"boolean"}, + "visible": {"type":"boolean"} + }, + "type": "object" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.ui-action-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"tap"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"}, + "withinElementRef": {"type":"string"} + }, + "required": ["type","withinElementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationSeconds": {"minimum":0,"type":"number"}, + "from": {"$ref":"#/$defs/point"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"swipe"} + }, + "required": ["type","from","to"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"swipe"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "direction": {"$ref":"#/$defs/direction"}, + "durationSeconds": {"minimum":0,"type":"number"}, + "elementRef": {"type":"string"}, + "from": {"$ref":"#/$defs/point"}, + "steps": {"minimum":1,"type":"integer"}, + "to": {"$ref":"#/$defs/point"}, + "type": {"const":"drag"} + }, + "required": ["type","elementRef","direction"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "event": {"type":"string"}, + "type": {"const":"touch"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "type": {"const":"touch"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "elementRef": {"type":"string"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","elementRef","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "durationMs": {"minimum":0,"type":"integer"}, + "type": {"const":"long-press"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["type","x","y","durationMs"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "button": {"type":"string"}, + "type": {"const":"button"} + }, + "required": ["type","button"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "gesture": {"type":"string"}, + "type": {"const":"gesture"} + }, + "required": ["type","gesture"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "elementRef": {"type":"string"}, + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type","elementRef"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "textLength": {"minimum":0,"type":"integer"}, + "type": {"const":"type-text"} + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCode": {"minimum":0,"type":"integer"}, + "type": {"const":"key-press"} + }, + "required": ["type","keyCode"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "keyCodes": { + "items": {"minimum":0,"type":"integer"}, + "type": "array" + }, + "type": {"const":"key-sequence"} + }, + "required": ["type","keyCodes"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "stepCount": {"minimum":1,"type":"integer"}, + "type": {"const":"batch"} + }, + "required": ["type","stepCount"], + "type": "object" + } + ] + }, + "artifacts": { + "additionalProperties": false, + "properties": { + "simulatorId": {"type":"string"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "capture": {"$ref":"#/$defs/compactRuntimeSnapshot"}, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"}, + "uiError": {"$ref":"#/$defs/recoverableUiError"} + }, + "required": ["summary","action","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.ui-action-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/wait_for_ui.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/wait_for_ui.json new file mode 100644 index 000000000..4e697aec2 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/wait_for_ui.json @@ -0,0 +1,405 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Wait for UI"}, + "description": "Poll rs/1 runtime UI snapshots until a selector-based UI predicate, selector-free textContains/gone text predicate, or selector-free settled predicate is satisfied, then record the latest snapshot. Prefer this after navigation or layout changes. Select with elementRef, identifier, label, role, or value when a selector is needed.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "elementRef": {"minLength":1,"type":"string"}, + "identifier": {"minLength":1,"type":"string"}, + "label": {"minLength":1,"type":"string"}, + "pollIntervalMs": {"description":"milliseconds","maximum":9007199254740991,"minimum":1,"type":"integer"}, + "predicate": { + "enum": ["exists","gone","enabled","focused","textContains","settled"], + "type": "string" + }, + "role": { + "enum": ["application","button","cell","image","keyboard-key","list","menu","other","scroll-view","slider","switch","tab","text","text-field","window"], + "type": "string" + }, + "settledDurationMs": {"description":"milliseconds","maximum":9007199254740991,"minimum":0,"type":"integer"}, + "text": {"minLength":1,"type":"string"}, + "timeoutMs": {"description":"milliseconds","maximum":9007199254740991,"minimum":0,"type":"integer"}, + "value": {"minLength":1,"type":"string"} + }, + "required": ["predicate"], + "type": "object" + }, + "name": "wait_for_ui", + "outputSchema": { + "$defs": { + "basicDiagnostics": { + "additionalProperties": false, + "properties": { + "errors": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + }, + "rawOutput": { + "items": {"type":"string"}, + "type": "array" + }, + "warnings": { + "items": {"$ref":"#/$defs/diagnosticEntry"}, + "type": "array" + } + }, + "required": ["warnings","errors"], + "type": "object" + }, + "compactRuntimeSnapshot": { + "additionalProperties": false, + "properties": { + "count": {"minimum":0,"type":"integer"}, + "evidence": { + "description": "Non-actionable semantic evidence rows in role|label|value|identifier format. These rows intentionally omit element refs.", + "items": {"type":"string"}, + "type": "array" + }, + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "scroll": { + "items": {"type":"string"}, + "type": "array" + }, + "seq": {"minimum":0,"type":"integer"}, + "targets": { + "items": {"type":"string"}, + "type": "array" + }, + "text": { + "items": {"type":"string"}, + "type": "array" + }, + "type": {"const":"runtime-snapshot"}, + "udid": {"type":"string"} + }, + "required": ["type","rs","screenHash","seq","count","targets","scroll","udid"], + "type": "object" + }, + "compactRuntimeSnapshotUnchanged": { + "additionalProperties": false, + "properties": { + "rs": {"const":"1"}, + "screenHash": {"minLength":1,"type":"string"}, + "seq": {"minimum":0,"type":"integer"}, + "type": {"const":"runtime-snapshot-unchanged"}, + "udid": {"type":"string"}, + "unchanged": {"const":true} + }, + "required": ["type","rs","screenHash","seq","unchanged","udid"], + "type": "object" + }, + "diagnosticEntry": { + "additionalProperties": false, + "properties": { + "location": {"type":"string"}, + "message": {"type":"string"} + }, + "required": ["message"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "frame": { + "additionalProperties": false, + "properties": { + "height": {"type":"number"}, + "width": {"type":"number"}, + "x": {"type":"number"}, + "y": {"type":"number"} + }, + "required": ["x","y","width","height"], + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "recoverableUiError": { + "additionalProperties": false, + "properties": { + "candidates": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "code": { + "enum": ["SNAPSHOT_MISSING","SNAPSHOT_EXPIRED","SNAPSHOT_PARSE_FAILED","SNAPSHOT_CAPTURE_FAILED","ELEMENT_REF_NOT_FOUND","TARGET_NOT_FOUND","TARGET_AMBIGUOUS","TARGET_NOT_ACTIONABLE","WAIT_TIMEOUT","UI_STATE_CHANGED","ACTION_FAILED"] + }, + "elementRef": {"type":"string"}, + "message": {"type":"string"}, + "recoveryHint": {"type":"string"}, + "snapshotAgeMs": {"minimum":0,"type":"integer"}, + "timeoutMs": {"minimum":0,"type":"integer"} + }, + "required": ["code","message","recoveryHint"], + "type": "object" + }, + "runtimeActionHint": { + "additionalProperties": false, + "properties": { + "action": {"$ref":"#/$defs/runtimeActionName"}, + "elementRef": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "label": {"type":"string"} + }, + "required": ["action","elementRef"], + "type": "object" + }, + "runtimeActionName": { + "enum": ["tap","typeText","longPress","touch","swipeWithin"] + }, + "runtimeElement": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionName"}, + "type": "array" + }, + "frame": {"$ref":"#/$defs/frame"}, + "identifier": {"type":"string"}, + "label": {"type":"string"}, + "ref": {"pattern":"^e[1-9][0-9]*$","type":"string"}, + "role": {"$ref":"#/$defs/runtimeElementRole"}, + "state": {"$ref":"#/$defs/runtimeElementState"}, + "value": {"type":"string"} + }, + "required": ["ref","frame","actions"], + "type": "object" + }, + "runtimeElementRole": { + "enum": ["application","button","cell","image","keyboard-key","list","menu","other","scroll-view","slider","switch","tab","text","text-field","window"] + }, + "runtimeElementState": { + "additionalProperties": false, + "properties": { + "enabled": {"type":"boolean"}, + "focused": {"type":"boolean"}, + "selected": {"type":"boolean"}, + "visible": {"type":"boolean"} + }, + "type": "object" + }, + "runtimeSnapshot": { + "additionalProperties": false, + "properties": { + "actions": { + "items": {"$ref":"#/$defs/runtimeActionHint"}, + "type": "array" + }, + "capturedAtMs": {"minimum":0,"type":"integer"}, + "elements": { + "items": {"$ref":"#/$defs/runtimeElement"}, + "type": "array" + }, + "expiresAtMs": {"minimum":0,"type":"integer"}, + "protocol": {"const":"rs/1"}, + "screenHash": {"minLength":1,"type":"string"}, + "seq": {"minimum":0,"type":"integer"}, + "simulatorId": {"type":"string"}, + "type": {"const":"runtime-snapshot"} + }, + "required": ["type","protocol","simulatorId","screenHash","seq","capturedAtMs","expiresAtMs","elements","actions"], + "type": "object" + }, + "runtimeSnapshotUnchanged": { + "additionalProperties": false, + "properties": { + "protocol": {"const":"rs/1"}, + "screenHash": {"minLength":1,"type":"string"}, + "seq": {"minimum":0,"type":"integer"}, + "simulatorId": {"type":"string"}, + "type": {"const":"runtime-snapshot-unchanged"} + }, + "required": ["type","protocol","simulatorId","screenHash","seq"], + "type": "object" + }, + "statusSummary": { + "additionalProperties": false, + "properties": { + "status": { + "enum": ["SUCCEEDED","FAILED"] + } + }, + "required": ["status"], + "type": "object" + }, + "uiHierarchyCapture": { + "additionalProperties": false, + "properties": { + "type": {"const":"ui-hierarchy"}, + "uiHierarchy": { + "items": {"$ref":"#/$defs/uiHierarchyNode"}, + "type": "array" + } + }, + "required": ["type","uiHierarchy"], + "type": "object" + }, + "uiHierarchyNode": {"type":"object"}, + "videoRecordingCapture": { + "additionalProperties": false, + "properties": { + "fps": {"minimum":1,"type":"integer"}, + "outputFile": {"type":"string"}, + "sessionId": {"type":"string"}, + "state": { + "enum": ["started","stopped"] + }, + "type": {"const":"video-recording"} + }, + "required": ["type","state"], + "type": "object" + }, + "waitMatch": { + "additionalProperties": false, + "properties": { + "matches": { + "items": { + "oneOf": [ + {"$ref":"#/$defs/runtimeElement"}, + {"type":"string"} + ] + }, + "type": "array" + }, + "predicate": {"$ref":"#/$defs/waitPredicate"} + }, + "required": ["predicate","matches"], + "type": "object" + }, + "waitPredicate": { + "enum": ["exists","gone","enabled","focused","textContains","settled"] + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.capture-result/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": { + "additionalProperties": false, + "properties": { + "screenshotPath": {"type":"string"}, + "simulatorId": {"type":"string"} + }, + "required": ["simulatorId"], + "type": "object" + }, + "capture": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "format": {"type":"string"}, + "height": {"minimum":0,"type":"integer"}, + "width": {"minimum":0,"type":"integer"} + }, + "required": ["format","width","height"], + "type": "object" + }, + {"$ref":"#/$defs/uiHierarchyCapture"}, + {"$ref":"#/$defs/runtimeSnapshot"}, + {"$ref":"#/$defs/compactRuntimeSnapshot"}, + {"$ref":"#/$defs/videoRecordingCapture"}, + {"$ref":"#/$defs/runtimeSnapshotUnchanged"}, + {"$ref":"#/$defs/compactRuntimeSnapshotUnchanged"} + ] + }, + "diagnostics": {"$ref":"#/$defs/basicDiagnostics"}, + "summary": {"$ref":"#/$defs/statusSummary"}, + "uiError": {"$ref":"#/$defs/recoverableUiError"}, + "waitMatch": {"$ref":"#/$defs/waitMatch"} + }, + "required": ["summary","artifacts"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.capture-result"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/xcode_ide_call_tool.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/xcode_ide_call_tool.json new file mode 100644 index 000000000..26a36b897 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/xcode_ide_call_tool.json @@ -0,0 +1,141 @@ +{ + "annotations": {"destructiveHint":true,"openWorldHint":false,"readOnlyHint":false,"title":"Call Xcode IDE Tool"}, + "description": "Call a remote Xcode IDE MCP tool.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "arguments": {"default":"{}","description":"JSON object string containing arguments for the remote Xcode MCP tool.","type":"string"}, + "remoteTool": {"description":"Exact remote Xcode MCP tool name.","minLength":1,"type":"string"}, + "timeoutMs": {"description":"Optional timeout override in milliseconds for this single tool call.","maximum":120000,"minimum":100,"type":"integer"} + }, + "required": ["remoteTool"], + "type": "object" + }, + "name": "xcode_ide_call_tool", + "outputSchema": { + "$defs": { + "artifacts": { + "additionalProperties": false, + "properties": { + "rawResponseJsonPath": {"type":"string"} + }, + "required": ["rawResponseJsonPath"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + }, + "relayedContentItem": { + "additionalProperties": true, + "properties": { + "type": {"type":"string"} + }, + "required": ["type"], + "type": "object" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.xcode-bridge-call-result/3.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": {"$ref":"#/$defs/artifacts"}, + "content": { + "items": {"$ref":"#/$defs/relayedContentItem"}, + "type": "array" + }, + "remoteTool": {"type":"string"}, + "succeeded": {"type":"boolean"} + }, + "required": ["remoteTool","succeeded","content"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.xcode-bridge-call-result"}, + "schemaVersion": {"const":"3"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/xcode_ide_list_tools.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/xcode_ide_list_tools.json new file mode 100644 index 000000000..e33f490d9 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/xcode_ide_list_tools.json @@ -0,0 +1,125 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"List Xcode IDE Tools"}, + "description": "Lists Xcode-IDE-only MCP capabilities (Use for: SwiftUI previews image capture, code snippet execution, issue Navigator/build logs, and window/tab context).", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "refresh": {"description":"When true, forces a refresh from Xcode bridge. When omitted, uses cached tools if available and refreshes only when the cache is empty.","type":"boolean"} + }, + "type": "object" + }, + "name": "xcode_ide_list_tools", + "outputSchema": { + "$defs": { + "artifacts": { + "additionalProperties": false, + "properties": { + "rawResponseJsonPath": {"type":"string"} + }, + "required": ["rawResponseJsonPath"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.xcode-bridge-tool-list/3.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "artifacts": {"$ref":"#/$defs/artifacts"}, + "toolCount": {"minimum":0,"type":"integer"} + }, + "required": ["toolCount"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.xcode-bridge-tool-list"}, + "schemaVersion": {"const":"3"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/xcode_tools_bridge_disconnect.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/xcode_tools_bridge_disconnect.json new file mode 100644 index 000000000..c71284dbc --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/xcode_tools_bridge_disconnect.json @@ -0,0 +1,147 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Disconnect Xcode Tools Bridge"}, + "description": "Disconnect bridge and unregister proxied `xcode_tools_*` tools.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": {}, + "type": "object" + }, + "name": "xcode_tools_bridge_disconnect", + "outputSchema": { + "$defs": { + "bridgeStatus": { + "additionalProperties": false, + "properties": { + "bridgeAvailable": {"type":"boolean"}, + "bridgePath": { + "type": ["string","null"] + }, + "bridgePid": { + "type": ["integer","null"] + }, + "connected": {"type":"boolean"}, + "lastError": { + "type": ["string","null"] + }, + "proxiedToolCount": {"minimum":0,"type":"integer"}, + "workflowEnabled": {"type":"boolean"}, + "xcodePid": { + "type": ["string","null"] + }, + "xcodeRunning": { + "type": ["boolean","null"] + }, + "xcodeSessionId": { + "type": ["string","null"] + } + }, + "required": ["workflowEnabled","bridgeAvailable","bridgePath","xcodeRunning","connected","bridgePid","proxiedToolCount","lastError","xcodePid","xcodeSessionId"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.xcode-bridge-status/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "enum": ["status","disconnect"], + "type": "string" + }, + "status": {"$ref":"#/$defs/bridgeStatus"} + }, + "required": ["action","status"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.xcode-bridge-status"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/xcode_tools_bridge_status.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/xcode_tools_bridge_status.json new file mode 100644 index 000000000..2e22e8a18 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/xcode_tools_bridge_status.json @@ -0,0 +1,147 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":true,"title":"Xcode Tools Bridge Status"}, + "description": "Show xcrun mcpbridge availability and proxy tool sync status.", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": {}, + "type": "object" + }, + "name": "xcode_tools_bridge_status", + "outputSchema": { + "$defs": { + "bridgeStatus": { + "additionalProperties": false, + "properties": { + "bridgeAvailable": {"type":"boolean"}, + "bridgePath": { + "type": ["string","null"] + }, + "bridgePid": { + "type": ["integer","null"] + }, + "connected": {"type":"boolean"}, + "lastError": { + "type": ["string","null"] + }, + "proxiedToolCount": {"minimum":0,"type":"integer"}, + "workflowEnabled": {"type":"boolean"}, + "xcodePid": { + "type": ["string","null"] + }, + "xcodeRunning": { + "type": ["boolean","null"] + }, + "xcodeSessionId": { + "type": ["string","null"] + } + }, + "required": ["workflowEnabled","bridgeAvailable","bridgePath","xcodeRunning","connected","bridgePid","proxiedToolCount","lastError","xcodePid","xcodeSessionId"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.xcode-bridge-status/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "action": { + "enum": ["status","disconnect"], + "type": "string" + }, + "status": {"$ref":"#/$defs/bridgeStatus"} + }, + "required": ["action","status"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.xcode-bridge-status"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/xcode_tools_bridge_sync.json b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/xcode_tools_bridge_sync.json new file mode 100644 index 000000000..6c2e6189e --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp-contracts/session-defaults-enabled/xcode_tools_bridge_sync.json @@ -0,0 +1,154 @@ +{ + "annotations": {"destructiveHint":false,"openWorldHint":false,"readOnlyHint":false,"title":"Sync Xcode Tools Bridge"}, + "description": "One-shot connect + tools/list sync (manual retry; avoids background prompt spam).", + "execution": {"taskSupport":"forbidden"}, + "inputSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": {}, + "type": "object" + }, + "name": "xcode_tools_bridge_sync", + "outputSchema": { + "$defs": { + "bridgeStatus": { + "additionalProperties": false, + "properties": { + "bridgeAvailable": {"type":"boolean"}, + "bridgePath": { + "type": ["string","null"] + }, + "bridgePid": { + "type": ["integer","null"] + }, + "connected": {"type":"boolean"}, + "lastError": { + "type": ["string","null"] + }, + "proxiedToolCount": {"minimum":0,"type":"integer"}, + "workflowEnabled": {"type":"boolean"}, + "xcodePid": { + "type": ["string","null"] + }, + "xcodeRunning": { + "type": ["boolean","null"] + }, + "xcodeSessionId": { + "type": ["string","null"] + } + }, + "required": ["workflowEnabled","bridgeAvailable","bridgePath","xcodeRunning","connected","bridgePid","proxiedToolCount","lastError","xcodePid","xcodeSessionId"], + "type": "object" + }, + "errorConsistency": { + "allOf": [ + { + "if": { + "properties": { + "didError": {"const":false} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"type":"null"} + }, + "required": ["error"] + } + }, + { + "if": { + "properties": { + "didError": {"const":true} + }, + "required": ["didError"] + }, + "then": { + "properties": { + "error": {"minLength":1,"type":"string"} + }, + "required": ["error"] + } + } + ], + "properties": { + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + } + }, + "type": "object" + }, + "nextSteps": { + "items": {"minLength":1,"type":"string"}, + "minItems": 1, + "type": "array" + } + }, + "$id": "https://xcodebuildmcp.com/schemas/structured-output/xcodebuildmcp.output.xcode-bridge-sync/2.registration.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "oneOf": [ + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "status": {"$ref":"#/$defs/bridgeStatus"}, + "sync": { + "additionalProperties": false, + "properties": { + "added": {"minimum":0,"type":"integer"}, + "removed": {"minimum":0,"type":"integer"}, + "total": {"minimum":0,"type":"integer"}, + "updated": {"minimum":0,"type":"integer"} + }, + "required": ["added","updated","removed","total"], + "type": "object" + } + }, + "required": ["sync","status"], + "type": "object" + }, + "didError": {"type":"boolean"}, + "error": { + "type": ["string","null"] + }, + "nextSteps": {"$ref":"#/$defs/nextSteps"}, + "schema": {"const":"xcodebuildmcp.output.xcode-bridge-sync"}, + "schemaVersion": {"const":"2"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + }, + { + "additionalProperties": false, + "allOf": [ + {"$ref":"#/$defs/errorConsistency"} + ], + "properties": { + "data": { + "additionalProperties": false, + "properties": { + "category": { + "enum": ["runtime","validation","schema"] + }, + "code": {"minLength":1,"type":"string"} + }, + "required": ["category","code"], + "type": "object" + }, + "didError": {"const":true}, + "error": {"minLength":1,"type":"string"}, + "schema": {"const":"xcodebuildmcp.output.error"}, + "schemaVersion": {"const":"1"} + }, + "required": ["schema","schemaVersion","didError","error","data"], + "type": "object" + } + ], + "type": "object" + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp/json/contracts/doctor-report--success.json b/src/snapshot-tests/__fixtures__/mcp/json/contracts/doctor-report--success.json new file mode 100644 index 000000000..53ef3a482 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp/json/contracts/doctor-report--success.json @@ -0,0 +1,10 @@ +{ + "schema": "xcodebuildmcp.output.doctor-report", + "schemaVersion": "2", + "didError": false, + "error": null, + "data": { + "serverVersion": "0.0.0-contract", + "checks": [] + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp/json/contracts/workflow-selection--success.json b/src/snapshot-tests/__fixtures__/mcp/json/contracts/workflow-selection--success.json new file mode 100644 index 000000000..bb785fc6d --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp/json/contracts/workflow-selection--success.json @@ -0,0 +1,10 @@ +{ + "schema": "xcodebuildmcp.output.workflow-selection", + "schemaVersion": "2", + "didError": false, + "error": null, + "data": { + "enabledWorkflows": [], + "registeredToolCount": 0 + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp/json/contracts/xcode-bridge-status--success.json b/src/snapshot-tests/__fixtures__/mcp/json/contracts/xcode-bridge-status--success.json new file mode 100644 index 000000000..527e55d25 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp/json/contracts/xcode-bridge-status--success.json @@ -0,0 +1,21 @@ +{ + "schema": "xcodebuildmcp.output.xcode-bridge-status", + "schemaVersion": "2", + "didError": false, + "error": null, + "data": { + "action": "status", + "status": { + "workflowEnabled": false, + "bridgeAvailable": false, + "bridgePath": null, + "xcodeRunning": null, + "connected": false, + "bridgePid": null, + "proxiedToolCount": 0, + "lastError": null, + "xcodePid": null, + "xcodeSessionId": null + } + } +} diff --git a/src/snapshot-tests/__fixtures__/mcp/json/contracts/xcode-bridge-sync--success.json b/src/snapshot-tests/__fixtures__/mcp/json/contracts/xcode-bridge-sync--success.json new file mode 100644 index 000000000..9915c3788 --- /dev/null +++ b/src/snapshot-tests/__fixtures__/mcp/json/contracts/xcode-bridge-sync--success.json @@ -0,0 +1,26 @@ +{ + "schema": "xcodebuildmcp.output.xcode-bridge-sync", + "schemaVersion": "2", + "didError": false, + "error": null, + "data": { + "sync": { + "added": 0, + "updated": 0, + "removed": 0, + "total": 0 + }, + "status": { + "workflowEnabled": false, + "bridgeAvailable": false, + "bridgePath": null, + "xcodeRunning": null, + "connected": false, + "bridgePid": null, + "proxiedToolCount": 0, + "lastError": null, + "xcodePid": null, + "xcodeSessionId": null + } + } +} diff --git a/src/snapshot-tests/__tests__/json-fixture-schema.test.ts b/src/snapshot-tests/__tests__/json-fixture-schema.test.ts index eebf9f358..c9bb1f54e 100644 --- a/src/snapshot-tests/__tests__/json-fixture-schema.test.ts +++ b/src/snapshot-tests/__tests__/json-fixture-schema.test.ts @@ -1,7 +1,18 @@ -import { describe, expect, it } from 'vitest'; +import { afterAll, beforeAll, describe, expect, it } from 'vitest'; +import type { Tool } from '@modelcontextprotocol/sdk/types.js'; +import { loadManifest } from '../../core/manifest/load-manifest.ts'; +import { assertCodex031InputSchemaCompatible } from '../codex-031-input-schema.ts'; import { createStructuredFixtureSchemaValidator } from '../json-schema-validation.ts'; +import { createMcpSnapshotHarness, type McpSnapshotHarness } from '../mcp-harness.ts'; +import { expectMcpToolContractFixtures } from '../mcp-tool-contract-fixtures.ts'; const validator = createStructuredFixtureSchemaValidator(); +const manifest = loadManifest(); +let fullHarness: McpSnapshotHarness; +let adaptiveHarness: McpSnapshotHarness; +let fullTools: Tool[]; +let adaptiveTools: Tool[]; +const activeHarnesses: McpSnapshotHarness[] = []; function isRecord(value: unknown): value is Record { return typeof value === 'object' && value !== null && !Array.isArray(value); @@ -16,6 +27,40 @@ function fixtureHasRequest(relativePath: string): boolean { return isRecord(fixture.envelope.data) && Object.hasOwn(fixture.envelope.data, 'request'); } +beforeAll(async () => { + const options = { + enabledWorkflows: [...manifest.workflows.keys()], + env: { + XCODEBUILDMCP_DEBUG: 'true', + // Include predicate-gated tools in the complete public contract. + XCODEBUILDMCP_EXPERIMENTAL_WORKFLOW_DISCOVERY: 'true', + }, + }; + try { + fullHarness = await createMcpSnapshotHarness({ + ...options, + disableSessionDefaults: true, + }); + activeHarnesses.push(fullHarness); + adaptiveHarness = await createMcpSnapshotHarness({ + ...options, + disableSessionDefaults: false, + }); + activeHarnesses.push(adaptiveHarness); + fullTools = (await fullHarness.client.listTools()).tools; + adaptiveTools = (await adaptiveHarness.client.listTools()).tools; + } catch (error) { + await Promise.all(activeHarnesses.map((harness) => harness.cleanup())); + activeHarnesses.length = 0; + throw error; + } +}, 30_000); + +afterAll(async () => { + await Promise.all(activeHarnesses.map((harness) => harness.cleanup())); + activeHarnesses.length = 0; +}); + describe('structured JSON fixture schemas', () => { it('discovers JSON fixtures from transport/format buckets', () => { expect(validator.fixtures.length).toBeGreaterThan(0); @@ -38,6 +83,217 @@ describe('structured JSON fixture schemas', () => { expect(() => validator.compileAllSchemas()).not.toThrow(); }); + it('converts every registered input schema in both public modes with Codex 0.31', () => { + const incompatibilities: string[] = []; + for (const [mode, tools] of [ + ['session defaults disabled', fullTools], + ['session defaults enabled', adaptiveTools], + ] as const) { + for (const tool of tools) { + try { + assertCodex031InputSchemaCompatible(tool.inputSchema); + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + incompatibilities.push(`${mode}: ${tool.name}: ${message}`); + } + } + } + + expect(incompatibilities).toEqual([]); + }); + + it('matches one readable contract fixture per registered tool in both public modes', () => { + expectMcpToolContractFixtures('session-defaults-disabled', fullTools); + expectMcpToolContractFixtures('session-defaults-enabled', adaptiveTools); + }); + + it('validates every live registered output schema in both public modes', () => { + validator.validateRegisteredOutputSchemas(fullTools); + validator.validateRegisteredOutputSchemas(adaptiveTools); + }); + + it('normalizes JSON-shaped wire inputs at the live tool boundary', async () => { + const sessionResult = await fullHarness.callTool('session_set_defaults', { + env: [ + { key: 'FEATURE_FLAG', value: 'enabled' }, + { key: 'API_URL', value: 'https://example.invalid' }, + ], + }); + expect(sessionResult.outcome).toBe('success'); + expect(sessionResult.structuredEnvelope).toMatchObject({ + schema: 'xcodebuildmcp.output.session-defaults', + didError: false, + data: { + profiles: { + '(default)': { + env: { + FEATURE_FLAG: 'enabled', + API_URL: 'https://example.invalid', + }, + }, + }, + }, + }); + + const xcodeResult = await fullHarness.callTool('xcode_ide_call_tool', { + remoteTool: 'ContractFixtureProbe', + arguments: '{"tabIdentifier":"missing"}', + }); + expect(xcodeResult.outcome).not.toBe('validation-error'); + expect(xcodeResult.structuredEnvelope?.schema).toBe( + 'xcodebuildmcp.output.xcode-bridge-call-result', + ); + + for (const invalidArguments of [ + 'not-json', + '["not", "an", "object"]', + '"not an object"', + 'null', + ]) { + const invalidResult = await fullHarness.callTool('xcode_ide_call_tool', { + remoteTool: 'ContractFixtureProbe', + arguments: invalidArguments, + }); + expect(invalidResult.structuredEnvelope).toMatchObject({ + schema: 'xcodebuildmcp.output.error', + didError: true, + data: { code: 'PARAMETER_VALIDATION_FAILED' }, + }); + } + }); + + it('normalizes environment entries through every live handler boundary', async () => { + const env = [{ key: 'CONTRACT_PROBE', value: 'enabled' }]; + const missingProject = '/__xcodebuildmcp_contract_probe__/Missing.xcodeproj'; + const missingTests = '/__xcodebuildmcp_contract_probe__/Missing.xctestproducts'; + const probes = [ + { + toolName: 'build_run_device', + arguments: { + projectPath: missingProject, + scheme: 'ContractProbe', + deviceId: 'CONTRACT-PROBE-DEVICE', + env, + }, + expectedSchema: 'xcodebuildmcp.output.build-run-result', + expectedInfrastructureText: 'spawn xcodebuild ENOENT', + }, + { + toolName: 'launch_app_device', + arguments: { + deviceId: 'CONTRACT-PROBE-DEVICE', + bundleId: 'com.example.contract-probe', + env, + }, + expectedSchema: 'xcodebuildmcp.output.launch-result', + expectedInfrastructureText: 'spawn xcrun ENOENT', + }, + { + toolName: 'test_device', + arguments: { + testProductsPath: missingTests, + deviceId: 'CONTRACT-PROBE-DEVICE', + testRunnerEnv: env, + }, + expectedSchema: 'xcodebuildmcp.output.test-result', + expectedInfrastructureText: 'spawn xcodebuild ENOENT', + }, + { + toolName: 'test_macos', + arguments: { testProductsPath: missingTests, testRunnerEnv: env }, + expectedSchema: 'xcodebuildmcp.output.test-result', + expectedInfrastructureText: 'spawn xcodebuild ENOENT', + }, + { + toolName: 'launch_app_sim', + arguments: { + simulatorId: 'CONTRACT-PROBE-SIMULATOR', + bundleId: 'com.example.contract-probe', + env, + }, + expectedSchema: 'xcodebuildmcp.output.launch-result', + expectedInfrastructureText: 'spawn xcrun ENOENT', + }, + { + toolName: 'test_sim', + arguments: { + testProductsPath: missingTests, + simulatorName: 'Contract Probe Missing Simulator', + testRunnerEnv: env, + }, + expectedSchema: 'xcodebuildmcp.output.test-result', + expectedInfrastructureText: 'Unable to determine the simulator platform', + }, + ] as const; + + for (const probe of probes) { + const result = await fullHarness.callTool(probe.toolName, probe.arguments); + expect(result.outcome, probe.toolName).not.toBe('success'); + expect(result.outcome, probe.toolName).not.toBe('validation-error'); + if ('expectedSchema' in probe && result.outcome === 'domain-error') { + expect(result.structuredEnvelope?.schema, probe.toolName).toBe(probe.expectedSchema); + } + if (result.outcome === 'infrastructure-error') { + expect(result.structuredEnvelope, probe.toolName).toBeNull(); + expect(result.rawText, probe.toolName).toContain(probe.expectedInfrastructureText); + } + } + }, 30_000); + + it('rejects the historical schema-valued additionalProperties input', () => { + expect(() => + assertCodex031InputSchemaCompatible({ + type: 'object', + properties: { + testRunnerEnv: { + type: 'object', + additionalProperties: { type: 'string' }, + }, + }, + }), + ).toThrow( + 'inputSchema.properties.testRunnerEnv.additionalProperties: invalid type: map, expected a boolean', + ); + }); + + it('mirrors Codex 0.31 handling for unsupported types and nullable optional fields', () => { + expect(() => + assertCodex031InputSchemaCompatible({ + type: 'object', + properties: { nullableValue: { type: 'null' } }, + }), + ).toThrow("inputSchema.properties.nullableValue.type: unsupported type 'null'"); + + expect(() => + assertCodex031InputSchemaCompatible({ + type: 'object', + description: null, + properties: {}, + required: null, + additionalProperties: null, + }), + ).not.toThrow(); + }); + + it('mirrors Codex 0.31 top-level ToolInputSchema deserialization', () => { + for (const inputSchema of [ + {}, + { properties: {} }, + { type: ['object', 'null'], properties: {} }, + { type: 'object', properties: {}, required: 'value' }, + ]) { + expect(() => assertCodex031InputSchemaCompatible(inputSchema)).toThrow(); + } + + expect(() => + assertCodex031InputSchemaCompatible({ + type: 'object', + properties: {}, + additionalProperties: { type: 'string' }, + }), + ).not.toThrow(); + }); + it('covers normal and minimal request-bearing fixture variants', () => { expect(fixtureHasRequest('cli/json/simulator/build--success.json')).toBe(true); expect(fixtureHasRequest('mcp/json/simulator/build--success.json')).toBe(false); diff --git a/src/snapshot-tests/codex-031-input-schema.ts b/src/snapshot-tests/codex-031-input-schema.ts new file mode 100644 index 000000000..de3ea75ff --- /dev/null +++ b/src/snapshot-tests/codex-031-input-schema.ts @@ -0,0 +1,163 @@ +type JsonObject = Record; + +function isObject(value: unknown): value is JsonObject { + return typeof value === 'object' && value !== null && !Array.isArray(value); +} + +function deserializeToolInputSchema(value: unknown): JsonObject { + if (!isObject(value)) { + throw new Error('inputSchema: expected an object'); + } + if (typeof value.type !== 'string') { + throw new Error('inputSchema.type: expected a string'); + } + if ( + value.required !== undefined && + value.required !== null && + (!Array.isArray(value.required) || + !value.required.every((required) => typeof required === 'string')) + ) { + throw new Error('inputSchema.required: expected an array of strings'); + } + + const inputSchema: JsonObject = { + type: value.type, + properties: value.properties ?? {}, + }; + if (value.required !== undefined && value.required !== null) { + inputSchema.required = value.required; + } + return inputSchema; +} + +function sanitizeSchema(value: unknown): unknown { + if (typeof value === 'boolean') { + return { type: 'string' }; + } + if (Array.isArray(value)) { + return value.map(sanitizeSchema); + } + if (!isObject(value)) { + return value; + } + + const sanitized: JsonObject = structuredClone(value); + if (isObject(sanitized.properties)) { + sanitized.properties = Object.fromEntries( + Object.entries(sanitized.properties).map(([key, property]) => [ + key, + sanitizeSchema(property), + ]), + ); + } + if ('items' in sanitized) { + sanitized.items = sanitizeSchema(sanitized.items); + } + for (const combiner of ['oneOf', 'anyOf', 'allOf', 'prefixItems']) { + if (combiner in sanitized) { + sanitized[combiner] = sanitizeSchema(sanitized[combiner]); + } + } + + const supportedTypes = new Set(['object', 'array', 'string', 'number', 'integer', 'boolean']); + let schemaType = typeof sanitized.type === 'string' ? sanitized.type : undefined; + if (!schemaType && Array.isArray(sanitized.type)) { + schemaType = sanitized.type.find( + (candidate): candidate is string => + typeof candidate === 'string' && supportedTypes.has(candidate), + ); + } + if (!schemaType) { + if ( + 'properties' in sanitized || + 'required' in sanitized || + 'additionalProperties' in sanitized + ) { + schemaType = 'object'; + } else if ('items' in sanitized || 'prefixItems' in sanitized) { + schemaType = 'array'; + } else if ('enum' in sanitized || 'const' in sanitized || 'format' in sanitized) { + schemaType = 'string'; + } else if ( + 'minimum' in sanitized || + 'maximum' in sanitized || + 'exclusiveMinimum' in sanitized || + 'exclusiveMaximum' in sanitized || + 'multipleOf' in sanitized + ) { + schemaType = 'number'; + } else { + schemaType = 'string'; + } + } + sanitized.type = schemaType; + + if (schemaType === 'object') { + sanitized.properties ??= {}; + if ( + 'additionalProperties' in sanitized && + typeof sanitized.additionalProperties !== 'boolean' + ) { + sanitized.additionalProperties = sanitizeSchema(sanitized.additionalProperties); + } + } + if (schemaType === 'array') { + sanitized.items ??= { type: 'string' }; + } + return sanitized; +} + +function assertString(value: unknown, label: string): void { + if (value !== undefined && value !== null && typeof value !== 'string') { + throw new Error(`${label}: expected a string`); + } +} + +function deserializeSchema(value: unknown, path: string): void { + if (!isObject(value) || typeof value.type !== 'string') { + throw new Error(`${path}: expected a typed schema object`); + } + + assertString(value.description, `${path}.description`); + switch (value.type) { + case 'boolean': + case 'string': + case 'number': + case 'integer': + return; + case 'array': + deserializeSchema(value.items, `${path}.items`); + return; + case 'object': { + if (!isObject(value.properties)) { + throw new Error(`${path}.properties: expected an object`); + } + for (const [key, property] of Object.entries(value.properties)) { + deserializeSchema(property, `${path}.properties.${key}`); + } + if ( + value.required !== undefined && + value.required !== null && + (!Array.isArray(value.required) || + !value.required.every((required) => typeof required === 'string')) + ) { + throw new Error(`${path}.required: expected an array of strings`); + } + if ( + value.additionalProperties !== undefined && + value.additionalProperties !== null && + typeof value.additionalProperties !== 'boolean' + ) { + throw new Error(`${path}.additionalProperties: invalid type: map, expected a boolean`); + } + return; + } + default: + throw new Error(`${path}.type: unsupported type '${value.type}'`); + } +} + +export function assertCodex031InputSchemaCompatible(inputSchema: unknown): void { + const toolInputSchema = deserializeToolInputSchema(inputSchema); + deserializeSchema(sanitizeSchema(toolInputSchema), 'inputSchema'); +} diff --git a/src/snapshot-tests/fixture-io.ts b/src/snapshot-tests/fixture-io.ts index 349b3f0e5..8cafa6d54 100644 --- a/src/snapshot-tests/fixture-io.ts +++ b/src/snapshot-tests/fixture-io.ts @@ -15,7 +15,7 @@ export interface FixtureMatchOptions { allowUpdate?: boolean; } -function shouldUpdateSnapshots(options?: FixtureMatchOptions): boolean { +export function shouldUpdateSnapshots(options?: FixtureMatchOptions): boolean { if (options?.allowUpdate === false) { return false; } diff --git a/src/snapshot-tests/json-schema-validation.ts b/src/snapshot-tests/json-schema-validation.ts index 2ada3a008..3e0294085 100644 --- a/src/snapshot-tests/json-schema-validation.ts +++ b/src/snapshot-tests/json-schema-validation.ts @@ -3,6 +3,7 @@ import path from 'node:path'; import { Ajv2020 } from 'ajv/dist/2020.js'; import type { ErrorObject, ValidateFunction } from 'ajv'; import { globSync } from 'glob'; +import type { Tool } from '@modelcontextprotocol/sdk/types.js'; const FIXTURE_ROOT = path.resolve(process.cwd(), 'src/snapshot-tests/__fixtures__'); const JSON_FIXTURE_BUCKETS = ['cli/json', 'mcp/json'] as const; @@ -35,6 +36,7 @@ export interface StructuredFixtureSchemaValidator { fixtures: readonly DiscoveredJsonFixture[]; compileAllSchemas(): void; validateFixture(fixture: DiscoveredJsonFixture): void; + validateRegisteredOutputSchemas(tools: readonly Tool[]): void; } function toRelative(absolutePath: string): string { @@ -185,6 +187,126 @@ function formatAjvErrors(errors: ErrorObject[] | null | undefined): string { .join('\n'); } +function resolveLocalReference(root: unknown, reference: string, label: string): unknown { + if (!reference.startsWith('#/')) { + throw new Error(`${label}: output schema contains non-local $ref ${reference}.`); + } + + let current: unknown = root; + for (const rawSegment of reference.slice(2).split('/')) { + const segment = rawSegment.replaceAll('~1', '/').replaceAll('~0', '~'); + if (Array.isArray(current)) { + const index = Number(segment); + if (!Number.isInteger(index) || index < 0 || index >= current.length) { + throw new Error(`${label}: unresolved local $ref ${reference}.`); + } + current = current[index]; + continue; + } + if (!isRecord(current) || !Object.prototype.hasOwnProperty.call(current, segment)) { + throw new Error(`${label}: unresolved local $ref ${reference}.`); + } + current = current[segment]; + } + return current; +} + +function assertLocalReferencesResolve(value: unknown, root: unknown, label: string): void { + if (Array.isArray(value)) { + value.forEach((child) => assertLocalReferencesResolve(child, root, label)); + return; + } + if (!isRecord(value)) return; + + if (typeof value.$ref === 'string') { + resolveLocalReference(root, value.$ref, label); + } + Object.values(value).forEach((child) => assertLocalReferencesResolve(child, root, label)); +} + +function collectEnvelopeRoutes(value: unknown, routes: Set): void { + if (Array.isArray(value)) { + value.forEach((child) => collectEnvelopeRoutes(child, routes)); + return; + } + if (!isRecord(value)) return; + + const properties = value.properties; + if (isRecord(properties)) { + const schema = properties.schema; + const schemaVersion = properties.schemaVersion; + if ( + isRecord(schema) && + typeof schema.const === 'string' && + isRecord(schemaVersion) && + typeof schemaVersion.const === 'string' + ) { + routes.add(`${schema.const}@${schemaVersion.const}`); + } + } + Object.values(value).forEach((child) => collectEnvelopeRoutes(child, routes)); +} + +function validateRegisteredOutputSchema( + tool: Tool, + fixtures: readonly DiscoveredJsonFixture[], +): number { + if (!tool.outputSchema) { + throw new Error(`${tool.name}: live MCP registration omitted its output schema.`); + } + const label = `${tool.name} output schema`; + assertLocalReferencesResolve(tool.outputSchema, tool.outputSchema, label); + + const ajv = new Ajv2020({ allErrors: true, strict: true, validateSchema: true }); + const validate = ajv.compile(tool.outputSchema); + const routes = new Set(); + collectEnvelopeRoutes(tool.outputSchema, routes); + if (!routes.has('xcodebuildmcp.output.error@1')) { + throw new Error(`${label}: standard error envelope branch is missing.`); + } + + const domainRoutes = [...routes].filter((route) => route !== 'xcodebuildmcp.output.error@1'); + if (domainRoutes.length === 0) { + throw new Error(`${label}: successful structured-output branch is missing.`); + } + + let validatedFixtureCount = 0; + for (const route of domainRoutes) { + const matchingFixtures = fixtures.filter( + (fixture) => + fixture.relativePath.startsWith('mcp/json/') && + fixture.envelope.didError === false && + `${fixture.envelope.schema}@${fixture.envelope.schemaVersion}` === route, + ); + if (matchingFixtures.length === 0) { + throw new Error(`${label}: no successful MCP JSON fixture matches ${route}.`); + } + for (const fixture of matchingFixtures) { + const parsed = readJsonDocument(fixture.absolutePath, `fixture ${fixture.relativePath}`); + if (!validate(parsed)) { + throw new Error( + `${label}: fixture ${fixture.relativePath} failed live output-schema validation.\n${formatAjvErrors(validate.errors)}`, + ); + } + validatedFixtureCount += 1; + } + } + + const standardError = { + schema: 'xcodebuildmcp.output.error', + schemaVersion: '1', + didError: true, + error: 'Contract validation error', + data: { category: 'validation', code: 'CONTRACT_VALIDATION' }, + }; + if (!validate(standardError)) { + throw new Error( + `${label}: standard error envelope failed live output-schema validation.\n${formatAjvErrors(validate.errors)}`, + ); + } + return validatedFixtureCount; +} + export function createStructuredFixtureSchemaValidator(): StructuredFixtureSchemaValidator { const schemaDocuments = discoverSchemaDocuments(); const schemaIdsByPath = new Map( @@ -259,5 +381,14 @@ export function createStructuredFixtureSchemaValidator(): StructuredFixtureSchem ].join('\n'), ); }, + validateRegisteredOutputSchemas(tools: readonly Tool[]): void { + let validatedFixtureCount = 0; + for (const tool of tools) { + validatedFixtureCount += validateRegisteredOutputSchema(tool, fixtures); + } + if (validatedFixtureCount === 0) { + throw new Error('No successful MCP JSON fixture matched a live registered output schema.'); + } + }, }; } diff --git a/src/snapshot-tests/mcp-harness.ts b/src/snapshot-tests/mcp-harness.ts index c6a9b5e43..5e1e4ad6d 100644 --- a/src/snapshot-tests/mcp-harness.ts +++ b/src/snapshot-tests/mcp-harness.ts @@ -36,6 +36,7 @@ export interface McpSnapshotHarness extends WorkflowSnapshotHarness { export interface CreateMcpSnapshotHarnessOptions { cwd?: string; + disableSessionDefaults?: boolean; enabledWorkflows?: string[]; env?: Record; } @@ -145,7 +146,7 @@ export async function createMcpSnapshotHarness( env: createSnapshotHarnessEnv({ ...(opts.env ?? {}), XCODEBUILDMCP_ENABLED_WORKFLOWS: enabledWorkflows.join(','), - XCODEBUILDMCP_DISABLE_SESSION_DEFAULTS: 'true', + XCODEBUILDMCP_DISABLE_SESSION_DEFAULTS: String(opts.disableSessionDefaults ?? true), XCODEBUILDMCP_DISABLE_XCODE_AUTO_SYNC: '1', XCODEBUILDMCP_TEST_FORCE_TOOL_EXPOSURE: 'sync_xcode_defaults', }), diff --git a/src/snapshot-tests/mcp-tool-contract-fixtures.ts b/src/snapshot-tests/mcp-tool-contract-fixtures.ts new file mode 100644 index 000000000..e5a5aba69 --- /dev/null +++ b/src/snapshot-tests/mcp-tool-contract-fixtures.ts @@ -0,0 +1,152 @@ +import fs from 'node:fs'; +import path from 'node:path'; +import type { Tool } from '@modelcontextprotocol/sdk/types.js'; +import { shouldUpdateSnapshots } from './fixture-io.ts'; + +export type McpToolContractMode = 'session-defaults-disabled' | 'session-defaults-enabled'; + +const FIXTURE_ROOT = path.resolve(process.cwd(), 'src/snapshot-tests/__fixtures__/mcp-contracts'); +const SAFE_TOOL_NAME = /^[a-z0-9_-]+$/; +const INLINE_LIMIT = 240; + +function canonicalize(value: unknown): unknown { + if (Array.isArray(value)) { + return value.map(canonicalize); + } + if (typeof value !== 'object' || value === null) { + return value; + } + + return Object.fromEntries( + Object.entries(value) + .filter(([, child]) => child !== undefined) + .sort(([left], [right]) => left.localeCompare(right)) + .map(([key, child]) => [key, canonicalize(child)]), + ); +} + +function isPrimitive(value: unknown): boolean { + return value === null || ['boolean', 'number', 'string'].includes(typeof value); +} + +function indent(value: string, spaces: number): string { + const prefix = ' '.repeat(spaces); + return value + .split('\n') + .map((line) => `${prefix}${line}`) + .join('\n'); +} + +function formatValue(value: unknown, depth: number): string { + if (isPrimitive(value)) { + return JSON.stringify(value); + } + + if (Array.isArray(value)) { + if (value.length === 0) return '[]'; + const inline = JSON.stringify(value); + if (value.every(isPrimitive) && inline.length <= INLINE_LIMIT) return inline; + + const children = value.map((child) => indent(formatValue(child, depth + 1), 2)); + return `[\n${children.join(',\n')}\n]`; + } + + const entries = Object.entries(value as Record); + if (entries.length === 0) return '{}'; + const inline = JSON.stringify(value); + if (entries.every(([, child]) => isPrimitive(child)) && inline.length <= INLINE_LIMIT) { + return inline; + } + + const children = entries.map(([key, child]) => { + const formatted = formatValue(child, depth + 1); + const [first, ...rest] = formatted.split('\n'); + const lines = [` ${JSON.stringify(key)}: ${first}`]; + lines.push(...rest.map((line) => ` ${line}`)); + return lines.join('\n'); + }); + return `{\n${children.join(',\n')}\n}`; +} + +function formatTool(tool: Tool): string { + return `${formatValue(canonicalize(tool), 0)}\n`; +} + +function sortedToolNames(tools: readonly Tool[]): string[] { + const names = tools.map((tool) => tool.name).sort(); + const uniqueNames = new Set(names); + if (uniqueNames.size !== names.length) { + throw new Error('Live MCP tool contracts contain duplicate tool names.'); + } + + for (const name of names) { + if (!SAFE_TOOL_NAME.test(name)) { + throw new Error(`Unsafe MCP tool name for contract fixture: ${name}`); + } + } + return names; +} + +function existingFixtureNames(directory: string): string[] { + if (!fs.existsSync(directory)) return []; + return fs + .readdirSync(directory, { withFileTypes: true }) + .filter((entry) => entry.isFile() && entry.name.endsWith('.json')) + .map((entry) => entry.name.slice(0, -'.json'.length)) + .sort(); +} + +function assertInventory(mode: McpToolContractMode, expected: string[], actual: string[]): void { + if (JSON.stringify(actual) === JSON.stringify(expected)) return; + + const expectedSet = new Set(expected); + const actualSet = new Set(actual); + const missing = expected.filter((name) => !actualSet.has(name)); + const stale = actual.filter((name) => !expectedSet.has(name)); + throw new Error( + [ + `MCP tool contract fixture inventory mismatch for ${mode}.`, + `Missing: ${missing.length > 0 ? missing.join(', ') : '(none)'}`, + `Stale: ${stale.length > 0 ? stale.join(', ') : '(none)'}`, + 'Run npm run test:schema-fixtures:update to intentionally refresh contracts.', + ].join('\n'), + ); +} + +export function expectMcpToolContractFixtures( + mode: McpToolContractMode, + tools: readonly Tool[], +): void { + const directory = path.join(FIXTURE_ROOT, mode); + const toolsByName = new Map(tools.map((tool) => [tool.name, tool])); + const liveNames = sortedToolNames(tools); + const fixtureNames = existingFixtureNames(directory); + + if (shouldUpdateSnapshots()) { + fs.mkdirSync(directory, { recursive: true }); + for (const staleName of fixtureNames.filter((name) => !toolsByName.has(name))) { + fs.unlinkSync(path.join(directory, `${staleName}.json`)); + } + for (const name of liveNames) { + fs.writeFileSync( + path.join(directory, `${name}.json`), + formatTool(toolsByName.get(name)!), + 'utf8', + ); + } + return; + } + + assertInventory(mode, liveNames, fixtureNames); + for (const name of liveNames) { + const fixturePath = path.join(directory, `${name}.json`); + const expected = fs.readFileSync(fixturePath, 'utf8'); + const actual = formatTool(toolsByName.get(name)!); + if (actual !== expected) { + throw new Error( + `MCP tool contract fixture mismatch: ${path.relative(process.cwd(), fixturePath)}\n` + + 'Run npm run test:schema-fixtures:update to intentionally refresh contracts.', + ); + } + } +} diff --git a/src/snapshot-tests/suites/xcode-ide-suite.ts b/src/snapshot-tests/suites/xcode-ide-suite.ts index 1e1cd3969..89a3e5b9b 100644 --- a/src/snapshot-tests/suites/xcode-ide-suite.ts +++ b/src/snapshot-tests/suites/xcode-ide-suite.ts @@ -243,7 +243,12 @@ export function registerXcodeIdeSnapshotSuite(runtime: SnapshotRuntime): void { result = await harness.invoke('xcode-ide', 'call-tool', { remoteTool: DOCUMENTATION_SEARCH_TOOL, - arguments: { query: DOCUMENTATION_SEARCH_QUERY, frameworks: ['AVFoundation'] }, + arguments: runtime.startsWith('mcp/') + ? JSON.stringify({ + query: DOCUMENTATION_SEARCH_QUERY, + frameworks: ['AVFoundation'], + }) + : { query: DOCUMENTATION_SEARCH_QUERY, frameworks: ['AVFoundation'] }, timeoutMs: 120_000, }); expectFixture(result, 'documentation-search--success', 'success'); diff --git a/src/utils/__tests__/environment-variable-input.test.ts b/src/utils/__tests__/environment-variable-input.test.ts new file mode 100644 index 000000000..847876b7e --- /dev/null +++ b/src/utils/__tests__/environment-variable-input.test.ts @@ -0,0 +1,44 @@ +import { describe, expect, it } from 'vitest'; +import { + environmentVariableEntriesSchema, + normalizeEnvironmentVariableArgument, +} from '../environment-variable-input.ts'; + +describe('environment variable MCP inputs', () => { + it('converts key-value entries to the internal dictionary', () => { + expect( + normalizeEnvironmentVariableArgument( + { + env: [ + { key: 'FEATURE_FLAG', value: 'enabled' }, + { key: 'API_URL', value: 'https://example.invalid' }, + ], + }, + 'env', + ), + ).toEqual({ + env: { + FEATURE_FLAG: 'enabled', + API_URL: 'https://example.invalid', + }, + }); + }); + + it('preserves an already-decoded CLI dictionary', () => { + const args = { env: { FEATURE_FLAG: 'enabled' } }; + expect(normalizeEnvironmentVariableArgument(args, 'env')).toBe(args); + }); + + it('rejects duplicate keys instead of silently overwriting a value', () => { + expect(() => + environmentVariableEntriesSchema.parse([ + { key: 'FEATURE_FLAG', value: 'first' }, + { key: 'FEATURE_FLAG', value: 'second' }, + ]), + ).toThrow('Duplicate environment variable key: FEATURE_FLAG'); + }); + + it('does not advertise the CLI dictionary as an MCP input', () => { + expect(() => environmentVariableEntriesSchema.parse({ FEATURE_FLAG: 'enabled' })).toThrow(); + }); +}); diff --git a/src/utils/environment-variable-input.ts b/src/utils/environment-variable-input.ts new file mode 100644 index 000000000..c3a134097 --- /dev/null +++ b/src/utils/environment-variable-input.ts @@ -0,0 +1,60 @@ +import * as z from 'zod'; + +const environmentVariableEntrySchema = z.strictObject({ + key: z.string().min(1), + value: z.string(), +}); + +export const environmentVariableEntriesSchema = z + .array(environmentVariableEntrySchema) + .superRefine((entries, ctx) => { + const seenKeys = new Set(); + + entries.forEach((entry, index) => { + if (seenKeys.has(entry.key)) { + ctx.addIssue({ + code: 'custom', + message: `Duplicate environment variable key: ${entry.key}`, + path: [index, 'key'], + }); + } + seenKeys.add(entry.key); + }); + }); + +export function createEnvironmentVariableInputSchema( + description: string, +): z.ZodOptional { + return environmentVariableEntriesSchema.optional().describe(description); +} + +export const testRunnerEnvironmentSchema = createEnvironmentVariableInputSchema( + 'Environment variables to pass to the test runner (TEST_RUNNER_ prefix added automatically)', +); + +export function toEnvironmentVariableRecord( + entries: z.infer | undefined, +): Record | undefined { + return entries === undefined + ? undefined + : Object.fromEntries(entries.map(({ key, value }) => [key, value])); +} + +export function normalizeEnvironmentVariableArgument( + args: Record, + key: 'env' | 'testRunnerEnv', +): Record { + if (!Object.prototype.hasOwnProperty.call(args, key)) { + return args; + } + + if (typeof args[key] === 'object' && args[key] !== null && !Array.isArray(args[key])) { + return args; + } + + const entries = environmentVariableEntriesSchema.parse(args[key]); + return { + ...args, + [key]: toEnvironmentVariableRecord(entries), + }; +} diff --git a/src/utils/tool-registry.ts b/src/utils/tool-registry.ts index afd5910fb..ff6509943 100644 --- a/src/utils/tool-registry.ts +++ b/src/utils/tool-registry.ts @@ -315,7 +315,7 @@ function registerToolFromManifest( toolName, { description: toolManifest.description ?? '', - inputSchema: toolModule.schema, + inputSchema: toolModule.mcpSchema, ...(outputSchema ? { outputSchema } : {}), annotations: toolManifest.annotations, }, @@ -402,7 +402,7 @@ function toCatalogTool( annotations: toolManifest.annotations, outputSchema: toolManifest.outputSchema, nextStepTemplates: toolManifest.nextSteps, - mcpSchema: toolModule.schema, + mcpSchema: toolModule.mcpSchema, cliSchema: toolModule.schema, stateful: toolManifest.routing?.stateful ?? false, handler: toolModule.handler as ToolDefinition['handler'], diff --git a/src/utils/typed-tool-factory.ts b/src/utils/typed-tool-factory.ts index dabbb7ab3..34feebd36 100644 --- a/src/utils/typed-tool-factory.ts +++ b/src/utils/typed-tool-factory.ts @@ -171,6 +171,7 @@ export function createSessionAwareTool(opts: { requirements?: SessionRequirement[]; exclusivePairs?: readonly ExclusiveParameterGroup[]; clearSessionDeviceIdUnlessPrepared?: boolean; + normalizeExplicitArgs?: (args: Record) => Record; }): ToolHandler { return createSessionAwareHandler({ internalSchema: opts.internalSchema, @@ -179,6 +180,7 @@ export function createSessionAwareTool(opts: { requirements: opts.requirements, exclusivePairs: opts.exclusivePairs, clearSessionDeviceIdUnlessPrepared: opts.clearSessionDeviceIdUnlessPrepared, + normalizeExplicitArgs: opts.normalizeExplicitArgs, }); } @@ -189,6 +191,7 @@ export function createSessionAwareToolWithContext(opts: { requirements?: SessionRequirement[]; exclusivePairs?: readonly ExclusiveParameterGroup[]; clearSessionDeviceIdUnlessPrepared?: boolean; + normalizeExplicitArgs?: (args: Record) => Record; }): ToolHandler { return createSessionAwareHandler(opts); } @@ -200,6 +203,7 @@ function createSessionAwareHandler(opts: { requirements?: SessionRequirement[]; exclusivePairs?: readonly ExclusiveParameterGroup[]; clearSessionDeviceIdUnlessPrepared?: boolean; + normalizeExplicitArgs?: (args: Record) => Record; }): ToolHandler { const { internalSchema, @@ -208,6 +212,7 @@ function createSessionAwareHandler(opts: { requirements = [], exclusivePairs = [], clearSessionDeviceIdUnlessPrepared = false, + normalizeExplicitArgs, } = opts; const impl = async ( @@ -227,9 +232,12 @@ function createSessionAwareHandler(opts: { if (typeof v === 'string' && v.trim() === '') continue; sanitizedArgs[k] = v; } + const explicitArgs = normalizeExplicitArgs + ? normalizeExplicitArgs(sanitizedArgs) + : sanitizedArgs; for (const pair of exclusivePairs) { - const provided = pair.filter((k) => Object.prototype.hasOwnProperty.call(sanitizedArgs, k)); + const provided = pair.filter((k) => Object.prototype.hasOwnProperty.call(explicitArgs, k)); if (provided.length >= 2) { setValidationErrorOutput( ctx, @@ -242,13 +250,13 @@ function createSessionAwareHandler(opts: { const sessionDefaults = filterSessionDefaultsForSchema(sessionStore.getAll(), internalSchema); if ( - sanitizedArgs.deviceId === undefined && - (sanitizedArgs.buildForTesting === true || clearSessionDeviceIdUnlessPrepared) + explicitArgs.deviceId === undefined && + (explicitArgs.buildForTesting === true || clearSessionDeviceIdUnlessPrepared) ) { delete sessionDefaults.deviceId; } const hasExplicitPreparedSource = - sanitizedArgs.testProductsPath !== undefined || sanitizedArgs.xctestrunPath !== undefined; + explicitArgs.testProductsPath !== undefined || explicitArgs.xctestrunPath !== undefined; if (hasExplicitPreparedSource) { for (const key of [ 'projectPath', @@ -269,7 +277,7 @@ function createSessionAwareHandler(opts: { } const merged = mergeSessionDefaultArgs({ defaults: sessionDefaults, - explicitArgs: sanitizedArgs, + explicitArgs, exclusivePairs, }); diff --git a/vitest.config.ts b/vitest.config.ts index 34d729e1c..078df336b 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -23,6 +23,7 @@ export default defineConfig({ '**/dist/**', 'src/smoke-tests/**', 'src/snapshot-tests/__tests__/**/*.snapshot.test.ts', + 'src/snapshot-tests/__tests__/json-fixture-schema.test.ts', ], pool: 'threads', maxWorkers: 4, diff --git a/vitest.schema.config.ts b/vitest.schema.config.ts new file mode 100644 index 000000000..fba8f1357 --- /dev/null +++ b/vitest.schema.config.ts @@ -0,0 +1,23 @@ +import { defineConfig } from 'vitest/config'; + +export default defineConfig({ + test: { + environment: 'node', + globals: true, + setupFiles: ['src/test-utils/vitest-executor-safety.setup.ts'], + include: ['src/snapshot-tests/__tests__/json-fixture-schema.test.ts'], + pool: 'threads', + maxWorkers: 1, + env: { + NODE_OPTIONS: '--max-old-space-size=4096', + }, + testTimeout: 30000, + hookTimeout: 10000, + teardownTimeout: 5000, + }, + resolve: { + alias: { + '^(\\.{1,2}/.*)\\.js$': '$1', + }, + }, +});