Skip to content

Commit 44e4b9c

Browse files
codeman9cameroncooke
authored andcommitted
feat: Add suppressWarnings option to reduce context window usage
Adds a new optional 'suppressWarnings' parameter to build and test tools that filters warning messages from output, helping AI assistants conserve context window space when warnings are not relevant to the task. Affected tools: - build_device, test_device - build_macos, build_run_macos, test_macos - build_sim, build_run_sim, test_sim - clean Includes unit tests for the warning suppression logic.
1 parent b0d6473 commit 44e4b9c

13 files changed

Lines changed: 112 additions & 0 deletions

File tree

src/mcp/tools/device/build_device.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ const baseSchemaObject = z.object({
2525
derivedDataPath: z.string().optional().describe('Path to derived data directory'),
2626
extraArgs: z.array(z.string()).optional().describe('Additional arguments to pass to xcodebuild'),
2727
preferXcodebuild: z.boolean().optional().describe('Prefer xcodebuild over faster alternatives'),
28+
suppressWarnings: z
29+
.boolean()
30+
.optional()
31+
.describe('If true, suppresses warning messages from build output to reduce context usage'),
2832
});
2933

3034
const baseSchema = z.preprocess(nullifyEmptyStrings, baseSchemaObject);

src/mcp/tools/device/test_device.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ const baseSchemaObject = z.object({
4747
.describe(
4848
'Environment variables to pass to the test runner (TEST_RUNNER_ prefix added automatically)',
4949
),
50+
suppressWarnings: z
51+
.boolean()
52+
.optional()
53+
.describe('If true, suppresses warning messages from build output to reduce context usage'),
5054
});
5155

5256
const baseSchema = z.preprocess(nullifyEmptyStrings, baseSchemaObject);

src/mcp/tools/macos/build_macos.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ const baseSchemaObject = z.object({
4646
.boolean()
4747
.optional()
4848
.describe('If true, prefers xcodebuild over the experimental incremental build system'),
49+
suppressWarnings: z
50+
.boolean()
51+
.optional()
52+
.describe('If true, suppresses warning messages from build output to reduce context usage'),
4953
});
5054

5155
const baseSchema = z.preprocess(nullifyEmptyStrings, baseSchemaObject);

src/mcp/tools/macos/build_run_macos.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ const baseSchemaObject = z.object({
3737
.boolean()
3838
.optional()
3939
.describe('If true, prefers xcodebuild over the experimental incremental build system'),
40+
suppressWarnings: z
41+
.boolean()
42+
.optional()
43+
.describe('If true, suppresses warning messages from build output to reduce context usage'),
4044
});
4145

4246
const baseSchema = z.preprocess(nullifyEmptyStrings, baseSchemaObject);

src/mcp/tools/macos/test_macos.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ const baseSchemaObject = z.object({
4848
.describe(
4949
'Environment variables to pass to the test runner (TEST_RUNNER_ prefix added automatically)',
5050
),
51+
suppressWarnings: z
52+
.boolean()
53+
.optional()
54+
.describe('If true, suppresses warning messages from build output to reduce context usage'),
5155
});
5256

5357
const baseSchema = z.preprocess(nullifyEmptyStrings, baseSchemaObject);

src/mcp/tools/simulator/build_run_sim.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ const baseOptions = {
5151
.describe(
5252
'If true, prefers xcodebuild over the experimental incremental build system, useful for when incremental build system fails.',
5353
),
54+
suppressWarnings: z
55+
.boolean()
56+
.optional()
57+
.describe('If true, suppresses warning messages from build output to reduce context usage'),
5458
};
5559

5660
const baseSchemaObject = z.object({

src/mcp/tools/simulator/build_sim.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ const baseOptions = {
4949
.describe(
5050
'If true, prefers xcodebuild over the experimental incremental build system, useful for when incremental build system fails.',
5151
),
52+
suppressWarnings: z
53+
.boolean()
54+
.optional()
55+
.describe('If true, suppresses warning messages from build output to reduce context usage'),
5256
};
5357

5458
const baseSchemaObject = z.object({

src/mcp/tools/simulator/test_sim.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ const baseSchemaObject = z.object({
6464
.describe(
6565
'Environment variables to pass to the test runner (TEST_RUNNER_ prefix added automatically)',
6666
),
67+
suppressWarnings: z
68+
.boolean()
69+
.optional()
70+
.describe('If true, suppresses warning messages from build output to reduce context usage'),
6771
});
6872

6973
// Apply preprocessor to handle empty strings
@@ -113,6 +117,7 @@ export async function test_simLogic(
113117
preferXcodebuild: params.preferXcodebuild ?? false,
114118
platform: XcodePlatform.iOSSimulator,
115119
testRunnerEnv: params.testRunnerEnv,
120+
suppressWarnings: params.suppressWarnings,
116121
},
117122
executor,
118123
);

src/mcp/tools/utilities/clean.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ const baseOptions = {
5151
.describe(
5252
'Optional: Platform to clean for (defaults to iOS). Choose from macOS, iOS, iOS Simulator, watchOS, watchOS Simulator, tvOS, tvOS Simulator, visionOS, visionOS Simulator',
5353
),
54+
suppressWarnings: z
55+
.boolean()
56+
.optional()
57+
.describe('If true, suppresses warning messages from build output to reduce context usage'),
5458
};
5559

5660
const baseSchemaObject = z.object({

src/types/common.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ export interface SharedBuildParams {
9494
configuration: string;
9595
derivedDataPath?: string;
9696
extraArgs?: string[];
97+
suppressWarnings?: boolean;
9798
}
9899

99100
/**

0 commit comments

Comments
 (0)