Skip to content

Commit 960b1ca

Browse files
committed
refactor: update error messages in schema validations
Changes: - Replaced 'error' keys with 'message' in Zod schema validations across multiple tools to standardize error handling and improve clarity. - Updated validation messages for projectPath, workspacePath, simulatorId, and simulatorName to enhance user feedback. This change ensures consistency in error messaging throughout the codebase, aligning with the latest Zod practices.
1 parent 30258f7 commit 960b1ca

31 files changed

Lines changed: 109 additions & 108 deletions

.smithery/index.cjs

Lines changed: 21 additions & 21 deletions
Large diffs are not rendered by default.

src/mcp/tools/device/build_device.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ const buildDeviceSchema = z.preprocess(
3131
nullifyEmptyStrings,
3232
baseSchemaObject
3333
.refine((val) => val.projectPath !== undefined || val.workspacePath !== undefined, {
34-
error: 'Either projectPath or workspacePath is required.',
34+
message: 'Either projectPath or workspacePath is required.',
3535
})
3636
.refine((val) => !(val.projectPath !== undefined && val.workspacePath !== undefined), {
37-
error: 'projectPath and workspacePath are mutually exclusive. Provide only one.',
37+
message: 'projectPath and workspacePath are mutually exclusive. Provide only one.',
3838
}),
3939
);
4040

src/mcp/tools/device/get_device_app_path.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ const getDeviceAppPathSchema = z.preprocess(
3737
nullifyEmptyStrings,
3838
baseSchemaObject
3939
.refine((val) => val.projectPath !== undefined || val.workspacePath !== undefined, {
40-
error: 'Either projectPath or workspacePath is required.',
40+
message: 'Either projectPath or workspacePath is required.',
4141
})
4242
.refine((val) => !(val.projectPath !== undefined && val.workspacePath !== undefined), {
43-
error: 'projectPath and workspacePath are mutually exclusive. Provide only one.',
43+
message: 'projectPath and workspacePath are mutually exclusive. Provide only one.',
4444
}),
4545
);
4646

src/mcp/tools/device/install_app_device.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
const installAppDeviceSchema = z.object({
2020
deviceId: z
2121
.string()
22-
.min(1, { error: 'Device ID cannot be empty' })
22+
.min(1, { message: 'Device ID cannot be empty' })
2323
.describe('UDID of the device (obtained from list_devices)'),
2424
appPath: z
2525
.string()

src/mcp/tools/device/test_device.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ const testDeviceSchema = z.preprocess(
5353
nullifyEmptyStrings,
5454
baseSchemaObject
5555
.refine((val) => val.projectPath !== undefined || val.workspacePath !== undefined, {
56-
error: 'Either projectPath or workspacePath is required.',
56+
message: 'Either projectPath or workspacePath is required.',
5757
})
5858
.refine((val) => !(val.projectPath !== undefined && val.workspacePath !== undefined), {
59-
error: 'projectPath and workspacePath are mutually exclusive. Provide only one.',
59+
message: 'projectPath and workspacePath are mutually exclusive. Provide only one.',
6060
}),
6161
);
6262

src/mcp/tools/macos/build_macos.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ const buildMacOSSchema = z.preprocess(
6060
nullifyEmptyStrings,
6161
baseSchemaObject
6262
.refine((val) => val.projectPath !== undefined || val.workspacePath !== undefined, {
63-
error: 'Either projectPath or workspacePath is required.',
63+
message: 'Either projectPath or workspacePath is required.',
6464
})
6565
.refine((val) => !(val.projectPath !== undefined && val.workspacePath !== undefined), {
66-
error: 'projectPath and workspacePath are mutually exclusive. Provide only one.',
66+
message: 'projectPath and workspacePath are mutually exclusive. Provide only one.',
6767
}),
6868
);
6969

src/mcp/tools/macos/build_run_macos.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ const buildRunMacOSSchema = z.preprocess(
5151
nullifyEmptyStrings,
5252
baseSchemaObject
5353
.refine((val) => val.projectPath !== undefined || val.workspacePath !== undefined, {
54-
error: 'Either projectPath or workspacePath is required.',
54+
message: 'Either projectPath or workspacePath is required.',
5555
})
5656
.refine((val) => !(val.projectPath !== undefined && val.workspacePath !== undefined), {
57-
error: 'projectPath and workspacePath are mutually exclusive. Provide only one.',
57+
message: 'projectPath and workspacePath are mutually exclusive. Provide only one.',
5858
}),
5959
);
6060

src/mcp/tools/macos/get_mac_app_path.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ const getMacosAppPathSchema = z.preprocess(
4646
nullifyEmptyStrings,
4747
baseSchemaObject
4848
.refine((val) => val.projectPath !== undefined || val.workspacePath !== undefined, {
49-
error: 'Either projectPath or workspacePath is required.',
49+
message: 'Either projectPath or workspacePath is required.',
5050
})
5151
.refine((val) => !(val.projectPath !== undefined && val.workspacePath !== undefined), {
52-
error: 'projectPath and workspacePath are mutually exclusive. Provide only one.',
52+
message: 'projectPath and workspacePath are mutually exclusive. Provide only one.',
5353
}),
5454
);
5555

src/mcp/tools/macos/test_macos.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ const testMacosSchema = z.preprocess(
6161
nullifyEmptyStrings,
6262
baseSchemaObject
6363
.refine((val) => val.projectPath !== undefined || val.workspacePath !== undefined, {
64-
error: 'Either projectPath or workspacePath is required.',
64+
message: 'Either projectPath or workspacePath is required.',
6565
})
6666
.refine((val) => !(val.projectPath !== undefined && val.workspacePath !== undefined), {
67-
error: 'projectPath and workspacePath are mutually exclusive. Provide only one.',
67+
message: 'projectPath and workspacePath are mutually exclusive. Provide only one.',
6868
}),
6969
);
7070

src/mcp/tools/project-discovery/list_schemes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ const listSchemesSchema = z.preprocess(
2727
nullifyEmptyStrings,
2828
baseSchemaObject
2929
.refine((val) => val.projectPath !== undefined || val.workspacePath !== undefined, {
30-
error: 'Either projectPath or workspacePath is required.',
30+
message: 'Either projectPath or workspacePath is required.',
3131
})
3232
.refine((val) => !(val.projectPath !== undefined && val.workspacePath !== undefined), {
33-
error: 'projectPath and workspacePath are mutually exclusive. Provide only one.',
33+
message: 'projectPath and workspacePath are mutually exclusive. Provide only one.',
3434
}),
3535
);
3636

0 commit comments

Comments
 (0)