Skip to content

Commit 0d6cb4a

Browse files
committed
docs: improve parameter descriptions to clearly indicate XOR requirements
- Update simulatorId/simulatorName descriptions to explicitly state 'Provide EITHER this OR [other], not both' - Update projectPath/workspacePath descriptions to explicitly state 'Provide EITHER this OR [other], not both' - Apply to all consolidated tools: build_simulator, build_run_simulator, test_simulator, get_simulator_app_path - Helps AI agents understand parameter requirements without trial and error - Parameter descriptions now reinforce the XOR validation at three levels: tool description, parameter description, and runtime validation
1 parent 23c7ee9 commit 0d6cb4a

4 files changed

Lines changed: 68 additions & 16 deletions

File tree

src/mcp/tools/simulator/build_run_simulator.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,15 @@ const baseOptions = {
3636
simulatorId: z
3737
.string()
3838
.optional()
39-
.describe('UUID of the simulator to use (obtained from listSimulators)'),
40-
simulatorName: z.string().optional().describe("Name of the simulator to use (e.g., 'iPhone 16')"),
39+
.describe(
40+
'UUID of the simulator (from list_sims). Provide EITHER this OR simulatorName, not both',
41+
),
42+
simulatorName: z
43+
.string()
44+
.optional()
45+
.describe(
46+
"Name of the simulator (e.g., 'iPhone 16'). Provide EITHER this OR simulatorId, not both",
47+
),
4148
configuration: z.string().optional().describe('Build configuration (Debug, Release, etc.)'),
4249
derivedDataPath: z
4350
.string()
@@ -57,8 +64,14 @@ const baseOptions = {
5764
};
5865

5966
const baseSchemaObject = z.object({
60-
projectPath: z.string().optional().describe('Path to the .xcodeproj file'),
61-
workspacePath: z.string().optional().describe('Path to the .xcworkspace file'),
67+
projectPath: z
68+
.string()
69+
.optional()
70+
.describe('Path to .xcodeproj file. Provide EITHER this OR workspacePath, not both'),
71+
workspacePath: z
72+
.string()
73+
.optional()
74+
.describe('Path to .xcworkspace file. Provide EITHER this OR projectPath, not both'),
6275
...baseOptions,
6376
});
6477

src/mcp/tools/simulator/build_simulator.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,15 @@ const baseOptions = {
3131
simulatorId: z
3232
.string()
3333
.optional()
34-
.describe('UUID of the simulator to use (obtained from listSimulators)'),
35-
simulatorName: z.string().optional().describe("Name of the simulator to use (e.g., 'iPhone 16')"),
34+
.describe(
35+
'UUID of the simulator (from list_sims). Provide EITHER this OR simulatorName, not both',
36+
),
37+
simulatorName: z
38+
.string()
39+
.optional()
40+
.describe(
41+
"Name of the simulator (e.g., 'iPhone 16'). Provide EITHER this OR simulatorId, not both",
42+
),
3643
configuration: z.string().optional().describe('Build configuration (Debug, Release, etc.)'),
3744
derivedDataPath: z
3845
.string()
@@ -52,8 +59,14 @@ const baseOptions = {
5259
};
5360

5461
const baseSchemaObject = z.object({
55-
projectPath: z.string().optional().describe('Path to the .xcodeproj file'),
56-
workspacePath: z.string().optional().describe('Path to the .xcworkspace file'),
62+
projectPath: z
63+
.string()
64+
.optional()
65+
.describe('Path to .xcodeproj file. Provide EITHER this OR workspacePath, not both'),
66+
workspacePath: z
67+
.string()
68+
.optional()
69+
.describe('Path to .xcworkspace file. Provide EITHER this OR projectPath, not both'),
5770
...baseOptions,
5871
});
5972

src/mcp/tools/simulator/get_simulator_app_path.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,30 @@ function nullifyEmptyStrings(value: unknown): unknown {
9191

9292
// Define base schema
9393
const baseGetSimulatorAppPathSchema = z.object({
94-
projectPath: z.string().optional().describe('Path to the .xcodeproj file'),
95-
workspacePath: z.string().optional().describe('Path to the .xcworkspace file'),
94+
projectPath: z
95+
.string()
96+
.optional()
97+
.describe('Path to .xcodeproj file. Provide EITHER this OR workspacePath, not both'),
98+
workspacePath: z
99+
.string()
100+
.optional()
101+
.describe('Path to .xcworkspace file. Provide EITHER this OR projectPath, not both'),
96102
scheme: z.string().describe('The scheme to use (Required)'),
97103
platform: z
98104
.enum(['iOS Simulator', 'watchOS Simulator', 'tvOS Simulator', 'visionOS Simulator'])
99105
.describe('Target simulator platform (Required)'),
100106
simulatorId: z
101107
.string()
102108
.optional()
103-
.describe('UUID of the simulator to use (obtained from listSimulators)'),
104-
simulatorName: z.string().optional().describe("Name of the simulator to use (e.g., 'iPhone 16')"),
109+
.describe(
110+
'UUID of the simulator (from list_sims). Provide EITHER this OR simulatorName, not both',
111+
),
112+
simulatorName: z
113+
.string()
114+
.optional()
115+
.describe(
116+
"Name of the simulator (e.g., 'iPhone 16'). Provide EITHER this OR simulatorId, not both",
117+
),
105118
configuration: z.string().optional().describe('Build configuration (Debug, Release, etc.)'),
106119
useLatestOS: z
107120
.boolean()

src/mcp/tools/simulator/test_simulator.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,27 @@ function nullifyEmptyStrings(value: unknown): unknown {
2727

2828
// Define base schema object with all fields
2929
const baseSchemaObject = z.object({
30-
projectPath: z.string().optional().describe('Path to the .xcodeproj file'),
31-
workspacePath: z.string().optional().describe('Path to the .xcworkspace file'),
30+
projectPath: z
31+
.string()
32+
.optional()
33+
.describe('Path to .xcodeproj file. Provide EITHER this OR workspacePath, not both'),
34+
workspacePath: z
35+
.string()
36+
.optional()
37+
.describe('Path to .xcworkspace file. Provide EITHER this OR projectPath, not both'),
3238
scheme: z.string().describe('The scheme to use (Required)'),
3339
simulatorId: z
3440
.string()
3541
.optional()
36-
.describe('UUID of the simulator to use (obtained from listSimulators)'),
37-
simulatorName: z.string().optional().describe("Name of the simulator to use (e.g., 'iPhone 16')"),
42+
.describe(
43+
'UUID of the simulator (from list_sims). Provide EITHER this OR simulatorName, not both',
44+
),
45+
simulatorName: z
46+
.string()
47+
.optional()
48+
.describe(
49+
"Name of the simulator (e.g., 'iPhone 16'). Provide EITHER this OR simulatorId, not both",
50+
),
3851
configuration: z.string().optional().describe('Build configuration (Debug, Release, etc.)'),
3952
derivedDataPath: z
4053
.string()

0 commit comments

Comments
 (0)