xcode_get_workspace_info
Retrieve detailed information about an Xcode workspace or project by providing the path to the .xcodeproj or .xcworkspace file, facilitating Xcode build automation and log parsing.
Instructions
Get information about a specific workspace
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| xcodeproj | Yes | Path to the .xcodeproj file (or .xcworkspace if available) - supports both absolute (/path/to/project.xcodeproj) and relative (MyApp.xcodeproj) paths |
Implementation Reference
- src/tools/InfoTools.ts:7-31 (handler)Core handler function that validates the project path, opens the project if needed, executes JXA script to retrieve workspace details (name, path, loaded status, active scheme, active run destination), and returns the JSON-formatted info.public static async getWorkspaceInfo(projectPath: string, openProject: OpenProjectCallback): Promise<McpResult> { const validationError = PathValidator.validateProjectPath(projectPath); if (validationError) return validationError; await openProject(projectPath); const script = ` (function() { ${getWorkspaceByPathScript(projectPath)} const info = { name: workspace.name(), path: workspace.path(), loaded: workspace.loaded(), activeScheme: workspace.activeScheme() ? workspace.activeScheme().name() : null, activeRunDestination: workspace.activeRunDestination() ? workspace.activeRunDestination().name() : null }; return JSON.stringify(info, null, 2); })() `; const result = await JXAExecutor.execute(script); return { content: [{ type: 'text', text: result }] }; }
- src/XcodeServer.ts:511-515 (registration)Tool dispatch/registration in the main MCP server switch statement within CallToolRequestSchema handler, which validates input and delegates to InfoTools.getWorkspaceInfo.case 'xcode_get_workspace_info': if (!args.xcodeproj) { throw new McpError(ErrorCode.InvalidParams, `Missing required parameter: xcodeproj`); } return await InfoTools.getWorkspaceInfo(args.xcodeproj as string, this.openProject.bind(this));
- Tool definition including name, description, and input schema (requiring xcodeproj path) used by the server for ListToolsRequestSchema and tool discovery.{ name: 'xcode_get_workspace_info', description: 'Get information about a specific workspace', inputSchema: { type: 'object', properties: { xcodeproj: { type: 'string', description: preferredXcodeproj ? `Absolute path to the .xcodeproj file (or .xcworkspace if available) - defaults to ${preferredXcodeproj}` : 'Absolute path to the .xcodeproj file (or .xcworkspace if available) - e.g., /path/to/project.xcodeproj', }, }, required: preferredXcodeproj ? [] : ['xcodeproj'], }, },
- src/XcodeServer.ts:948-952 (registration)Duplicate tool dispatch in the callToolDirect method for direct CLI/server compatibility.case 'xcode_get_workspace_info': if (!args.xcodeproj) { throw new McpError(ErrorCode.InvalidParams, `Missing required parameter: xcodeproj`); } return await InfoTools.getWorkspaceInfo(args.xcodeproj as string, this.openProject.bind(this));
- src/XcodeServer.ts:181-181 (helper)Tool listed in getToolLimitations for environment validation checks (requires Xcode and osascript).'xcode_get_run_destinations', 'xcode_get_workspace_info', 'xcode_get_projects'];