Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/mcp/tools/device/__tests__/build_device.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,5 +346,32 @@ describe('build_device plugin', () => {
]);
expect(spy.commandCalls[0].logPrefix).toBe('iOS Device Build');
});

it('should target watchOS platform when platform=watchOS is provided', async () => {
const spy = createSpyExecutor();

const { result } = await runToolLogic(() =>
buildDeviceLogic(
{
projectPath: '/path/to/MyWatchApp.xcodeproj',
scheme: 'MyWatchApp',
platform: 'watchOS',
},
spy.executor,
),
);

expect(spy.commandCalls).toHaveLength(1);
const args = spy.commandCalls[0].args;
const destinationIndex = args.indexOf('-destination');
expect(destinationIndex).toBeGreaterThan(-1);
expect(args[destinationIndex + 1]).toBe('generic/platform=watchOS');
expect(spy.commandCalls[0].logPrefix).toBe('watchOS Device Build');
expect(result.nextStepParams).toEqual(
expect.objectContaining({
get_device_app_path: expect.objectContaining({ platform: 'watchOS' }),
}),
);
});
});
});
5 changes: 4 additions & 1 deletion src/mcp/tools/device/build_device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ const baseSchemaObject = z.object({
projectPath: z.string().optional().describe('Path to the .xcodeproj file'),
workspacePath: z.string().optional().describe('Path to the .xcworkspace file'),
scheme: z.string().describe('The scheme to build'),
platform: devicePlatformSchema,
configuration: z.string().optional().describe('Build configuration (Debug, Release)'),
derivedDataPath: z.string().optional(),
extraArgs: z.array(z.string()).optional(),
preferXcodebuild: z.boolean().optional(),
platform: devicePlatformSchema,
});

const buildDeviceSchema = z.preprocess(
Expand Down Expand Up @@ -128,6 +128,9 @@ export async function buildDeviceLogic(
...(params.derivedDataPath !== undefined
? { derivedDataPath: params.derivedDataPath }
: {}),
...(params.platform !== undefined
? { platform: String(mapDevicePlatform(params.platform)) }
: {}),
},
};
}
Expand Down
Loading