xcode_get_workspace_info
Extract workspace details from Xcode project files to analyze project structure and configurations for build automation workflows.
Instructions
Get information about a specific workspace
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| xcodeproj | Yes | Absolute path to the .xcodeproj file (or .xcworkspace if available) - e.g., /path/to/project.xcodeproj |
Implementation Reference
- src/tools/InfoTools.ts:7-31 (handler)Primary handler function implementing the tool logic: validates project path, opens the project, executes JXA script to retrieve workspace information (name, path, loaded status, active scheme, active run destination), and returns formatted JSON.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 }] }; }
- Tool definition including name, description, and input schema (requires xcodeproj path). Used by MCP server for tool listing and validation.{ 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:511-515 (handler)Dispatch handler in main MCP CallToolRequest that performs parameter validation 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));
- src/XcodeServer.ts:301-319 (registration)Registers all tools including xcode_get_workspace_info via getToolDefinitions() for the MCP ListToolsRequest handler.this.server.setRequestHandler(ListToolsRequestSchema, async () => { const toolOptions: { includeClean: boolean; preferredScheme?: string; preferredXcodeproj?: string; } = { includeClean: this.includeClean }; if (this.preferredScheme) toolOptions.preferredScheme = this.preferredScheme; if (this.preferredXcodeproj) toolOptions.preferredXcodeproj = this.preferredXcodeproj; const toolDefinitions = getToolDefinitions(toolOptions); return { tools: toolDefinitions.map(tool => ({ name: tool.name, description: tool.description, inputSchema: tool.inputSchema })), }; });