Skip to main content
Glama

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
NameRequiredDescriptionDefault
xcodeprojYesAbsolute path to the .xcodeproj file (or .xcworkspace if available) - e.g., /path/to/project.xcodeproj

Implementation Reference

  • 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'], }, },
  • 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));
  • 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 })), }; });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lapfelix/XcodeMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server