Skip to content

Commit 3d7319a

Browse files
committed
fix: resolve parameter validation bug in project-discovery tools
- Fixed list_schems_ws, show_build_set_proj, and show_build_set_ws tools - Changed schema definitions from z.object({...}) to plain object {...} - Root cause: z.object schema pattern prevented proper parameter parsing - Added parameter casting for safe property access in list_schems_ws - Verified fix works through Reloaderoo CLI testing Tools affected: - list_schems_ws: workspacePath parameter validation - show_build_set_proj: projectPath and scheme parameter validation - show_build_set_ws: workspacePath and scheme parameter validation This resolves the issue where tools were receiving {signal:{}, requestId:1} instead of actual user parameters when using z.object schema pattern.
1 parent eb35e78 commit 3d7319a

3 files changed

Lines changed: 11 additions & 8 deletions

File tree

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,16 @@ export async function list_schems_wsLogic(
2525
params: unknown,
2626
executor: CommandExecutor,
2727
): Promise<ToolResponse> {
28+
// Cast params to a record type for safe property access
29+
const paramsRecord = params as Record<string, unknown>;
30+
2831
// Validate required parameters
29-
const workspaceValidation = validateRequiredParam('workspacePath', params.workspacePath);
32+
const workspaceValidation = validateRequiredParam('workspacePath', paramsRecord.workspacePath);
3033
if (!workspaceValidation.isValid) return workspaceValidation.errorResponse;
3134

3235
// Cast to proper type after validation
3336
const typedParams: ListSchemsWsParams = {
34-
workspacePath: params.workspacePath as string,
37+
workspacePath: paramsRecord.workspacePath as string,
3538
};
3639

3740
log('info', 'Listing schemes');
@@ -99,9 +102,9 @@ export default {
99102
name: 'list_schems_ws',
100103
description:
101104
"Lists available schemes in the workspace. IMPORTANT: Requires workspacePath. Example: list_schems_ws({ workspacePath: '/path/to/MyProject.xcworkspace' })",
102-
schema: z.object({
105+
schema: {
103106
workspacePath: z.string().describe('Path to the .xcworkspace file (Required)'),
104-
}),
107+
},
105108
async handler(args: Record<string, unknown>): Promise<ToolResponse> {
106109
return list_schems_wsLogic(args, getDefaultCommandExecutor());
107110
},

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ export default {
8585
name: 'show_build_set_proj',
8686
description:
8787
"Shows build settings from a project file using xcodebuild. IMPORTANT: Requires projectPath and scheme. Example: show_build_set_proj({ projectPath: '/path/to/MyProject.xcodeproj', scheme: 'MyScheme' })",
88-
schema: z.object({
88+
schema: {
8989
projectPath: z.string().describe('Path to the .xcodeproj file (Required)'),
9090
scheme: z.string().describe('Scheme name to show build settings for (Required)'),
91-
}),
91+
},
9292
async handler(args: Record<string, unknown>): Promise<ToolResponse> {
9393
return show_build_set_projLogic(args, getDefaultCommandExecutor());
9494
},

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ export default {
7878
name: 'show_build_set_ws',
7979
description:
8080
"Shows build settings from a workspace using xcodebuild. IMPORTANT: Requires workspacePath and scheme. Example: show_build_set_ws({ workspacePath: '/path/to/MyProject.xcworkspace', scheme: 'MyScheme' })",
81-
schema: z.object({
81+
schema: {
8282
workspacePath: z.string().describe('Path to the .xcworkspace file (Required)'),
8383
scheme: z.string().describe('The scheme to use (Required)'),
84-
}),
84+
},
8585
async handler(args: Record<string, unknown>): Promise<ToolResponse> {
8686
return show_build_set_wsLogic(args, getDefaultCommandExecutor());
8787
},

0 commit comments

Comments
 (0)