Skip to content

Commit cfb0d02

Browse files
Add type assertion to createTypedTool handlers for improved type safety
Co-authored-by: web <web@cameroncooke.com>
1 parent d5c9e4e commit cfb0d02

12 files changed

Lines changed: 14 additions & 16 deletions

File tree

src/mcp/tools/device/build_device.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export default {
6666
"Builds an app from a project or workspace for a physical Apple device. Provide exactly one of projectPath or workspacePath. Example: build_device({ projectPath: '/path/to/MyProject.xcodeproj', scheme: 'MyScheme' })",
6767
schema: baseSchemaObject.shape,
6868
handler: createTypedTool<BuildDeviceParams>(
69-
buildDeviceSchema,
69+
buildDeviceSchema as z.ZodType<BuildDeviceParams>,
7070
buildDeviceLogic,
7171
getDefaultCommandExecutor,
7272
),

src/mcp/tools/device/get_device_app_path.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ export default {
161161
"Gets the app bundle path for a physical device application (iOS, watchOS, tvOS, visionOS) using either a project or workspace. Provide exactly one of projectPath or workspacePath. Example: get_device_app_path({ projectPath: '/path/to/project.xcodeproj', scheme: 'MyScheme' })",
162162
schema: baseSchemaObject.shape, // MCP SDK compatibility
163163
handler: createTypedTool<GetDeviceAppPathParams>(
164-
getDeviceAppPathSchema,
164+
getDeviceAppPathSchema as z.ZodType<GetDeviceAppPathParams>,
165165
get_device_app_pathLogic,
166166
getDefaultCommandExecutor,
167167
),

src/mcp/tools/device/test_device.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ export default {
253253
'Runs tests for an Apple project or workspace on a physical device (iPhone, iPad, Apple Watch, Apple TV, Apple Vision Pro) using xcodebuild test and parses xcresult output. Provide exactly one of projectPath or workspacePath. IMPORTANT: Requires scheme and deviceId. Example: test_device({ projectPath: "/path/to/MyProject.xcodeproj", scheme: "MyScheme", deviceId: "device-uuid" })',
254254
schema: baseSchemaObject.shape,
255255
handler: createTypedTool<TestDeviceParams>(
256-
testDeviceSchema,
256+
testDeviceSchema as z.ZodType<TestDeviceParams>,
257257
(params: TestDeviceParams) => {
258258
return testDeviceLogic(
259259
{

src/mcp/tools/macos/build_macos.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export default {
9292
"Builds a macOS app using xcodebuild from a project or workspace. Provide exactly one of projectPath or workspacePath. Example: build_macos({ projectPath: '/path/to/MyProject.xcodeproj', scheme: 'MyScheme' })",
9393
schema: baseSchemaObject.shape, // MCP SDK compatibility
9494
handler: createTypedTool<BuildMacOSParams>(
95-
buildMacOSSchema,
95+
buildMacOSSchema as z.ZodType<BuildMacOSParams>,
9696
buildMacOSLogic,
9797
getDefaultCommandExecutor,
9898
),

src/mcp/tools/macos/build_run_macos.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ export default {
210210
"Builds and runs a macOS app from a project or workspace in one step. Provide exactly one of projectPath or workspacePath. Example: build_run_macos({ projectPath: '/path/to/MyProject.xcodeproj', scheme: 'MyScheme' })",
211211
schema: baseSchemaObject.shape, // MCP SDK compatibility
212212
handler: createTypedTool<BuildRunMacOSParams>(
213-
buildRunMacOSSchema,
213+
buildRunMacOSSchema as z.ZodType<BuildRunMacOSParams>,
214214
(params: BuildRunMacOSParams) =>
215215
buildRunMacOSLogic(
216216
{

src/mcp/tools/macos/get_macos_app_path.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ export default {
185185
"Gets the app bundle path for a macOS application using either a project or workspace. Provide exactly one of projectPath or workspacePath. Example: get_macos_app_path({ projectPath: '/path/to/project.xcodeproj', scheme: 'MyScheme' })",
186186
schema: baseSchemaObject.shape, // MCP SDK compatibility
187187
handler: createTypedTool<GetMacosAppPathParams>(
188-
getMacosAppPathSchema,
188+
getMacosAppPathSchema as z.ZodType<GetMacosAppPathParams>,
189189
get_macos_app_pathLogic,
190190
getDefaultCommandExecutor,
191191
),

src/mcp/tools/macos/test_macos.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ export default {
306306
'Runs tests for a macOS project or workspace using xcodebuild test and parses xcresult output. Provide exactly one of projectPath or workspacePath. IMPORTANT: Requires scheme. Example: test_macos({ projectPath: "/path/to/MyProject.xcodeproj", scheme: "MyScheme" })',
307307
schema: baseSchemaObject.shape, // MCP SDK compatibility
308308
handler: createTypedTool<TestMacosParams>(
309-
testMacosSchema,
309+
testMacosSchema as z.ZodType<TestMacosParams>,
310310
(params: TestMacosParams) => {
311311
return testMacosLogic(params, getDefaultCommandExecutor(), getDefaultFileSystemExecutor());
312312
},

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export default {
114114
"Lists available schemes for either a project or a workspace. Provide exactly one of projectPath or workspacePath. Example: list_schemes({ projectPath: '/path/to/MyProject.xcodeproj' })",
115115
schema: baseSchemaObject.shape,
116116
handler: createTypedTool<ListSchemesParams>(
117-
listSchemesSchema,
117+
listSchemesSchema as z.ZodType<ListSchemesParams>,
118118
listSchemesLogic,
119119
getDefaultCommandExecutor,
120120
),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export default {
107107
"Shows build settings from either a project or workspace using xcodebuild. Provide exactly one of projectPath or workspacePath, plus scheme. Example: show_build_settings({ projectPath: '/path/to/MyProject.xcodeproj', scheme: 'MyScheme' })",
108108
schema: baseSchemaObject.shape,
109109
handler: createTypedTool<ShowBuildSettingsParams>(
110-
showBuildSettingsSchema,
110+
showBuildSettingsSchema as z.ZodType<ShowBuildSettingsParams>,
111111
showBuildSettingsLogic,
112112
getDefaultCommandExecutor,
113113
),

src/mcp/tools/simulator/get_simulator_app_path.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ function constructDestinationString(
7777
return `platform=${platform}`;
7878
}
7979

80-
81-
8280
// Define base schema
8381
const baseGetSimulatorAppPathSchema = z.object({
8482
projectPath: z
@@ -296,7 +294,7 @@ export default {
296294
"Gets the app bundle path for a simulator by UUID or name using either a project or workspace file. IMPORTANT: Requires either projectPath OR workspacePath (not both), plus scheme, platform, and either simulatorId OR simulatorName (not both). Example: get_simulator_app_path({ projectPath: '/path/to/project.xcodeproj', scheme: 'MyScheme', platform: 'iOS Simulator', simulatorName: 'iPhone 16' })",
297295
schema: baseGetSimulatorAppPathSchema.shape, // MCP SDK compatibility
298296
handler: createTypedTool<GetSimulatorAppPathParams>(
299-
getSimulatorAppPathSchema,
297+
getSimulatorAppPathSchema as z.ZodType<GetSimulatorAppPathParams>,
300298
get_simulator_app_pathLogic,
301299
getDefaultCommandExecutor,
302300
),

0 commit comments

Comments
 (0)