Skip to main content
Glama

xcode_get_schemes

Retrieve available build schemes from an Xcode project file to configure and manage development workflows.

Instructions

Get list of available schemes for a specific project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xcodeprojYesAbsolute path to the .xcodeproj file (or .xcworkspace if available) - e.g., /path/to/project.xcodeproj

Implementation Reference

  • Core handler function for xcode_get_schemes: validates project path, ensures project is open, executes JXA script via JXAExecutor to retrieve all schemes and active scheme from Xcode, handles empty schemes case, returns formatted JSON list.
    public static async getSchemes(projectPath: string, openProject: OpenProjectCallback): Promise<McpResult> { const validationError = PathValidator.validateProjectPath(projectPath); if (validationError) return validationError; await openProject(projectPath); const script = ` (function() { ${getWorkspaceByPathScript(projectPath)} const schemes = workspace.schemes(); const activeScheme = workspace.activeScheme(); const schemeInfo = schemes.map(scheme => ({ name: scheme.name(), id: scheme.id(), isActive: activeScheme && scheme.id() === activeScheme.id() })); return JSON.stringify(schemeInfo, null, 2); })() `; const result = await JXAExecutor.execute(script); // Parse the result to check if schemes array is empty try { const schemeInfo = JSON.parse(result); if (Array.isArray(schemeInfo) && schemeInfo.length === 0) { return { content: [{ type: 'text', text: 'No schemes found in the project' }] }; } } catch (error) { // If parsing fails, return the raw result } return { content: [{ type: 'text', text: result }] }; }
  • Dispatch handler in main MCP CallToolRequest switch statement: validates xcodeproj argument and delegates to ProjectTools.getSchemes.
    case 'xcode_get_schemes': if (!args.xcodeproj) { throw new McpError(ErrorCode.InvalidParams, `Missing required parameter: xcodeproj`); } return await ProjectTools.getSchemes(args.xcodeproj as string, this.openProject.bind(this));
  • JSON Schema definition for xcode_get_schemes input parameters (xcodeproj path, optional if preferred provided). Used by getToolDefinitions for ListTools response.
    { name: 'xcode_get_schemes', description: 'Get list of available schemes for a specific project', 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'], },
  • Registration via dynamic tool list: calls getToolDefinitions (which includes xcode_get_schemes) in ListToolsRequest handler to provide tool metadata to MCP clients.
    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);

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