Skip to main content
Glama
concavegit
by concavegit

list_schemes

Retrieve all available Xcode schemes from a specified project or workspace path to manage build configurations for iOS and macOS development.

Instructions

List all available schemes in an Xcode project or workspace

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectPathYesPath to the Xcode project (.xcodeproj) or workspace (.xcworkspace)

Implementation Reference

  • The core handler function that validates the project path, executes xcodebuild -list command, parses the output using parseXcodebuildOutput, and returns formatted JSON with schemes list.
    async listSchemes(args: ListSchemesArgs): Promise<any> { const { projectPath } = args; if (!projectPath) { throw new Error('Project path is required'); } if (!existsSync(projectPath)) { throw new Error(`Project path does not exist: ${projectPath}`); } const stats = statSync(projectPath); if (!stats.isDirectory()) { throw new Error(`Project path is not a directory: ${projectPath}`); } const isWorkspace = projectPath.endsWith('.xcworkspace'); const isProject = projectPath.endsWith('.xcodeproj'); if (!isWorkspace && !isProject) { throw new Error('Project path must be either a .xcworkspace or .xcodeproj file'); } try { const command = isWorkspace ? `xcodebuild -workspace "${projectPath}" -list` : `xcodebuild -project "${projectPath}" -list`; const { stdout, stderr } = await execAsync(command); if (stderr && stderr.trim() !== '') { console.error('xcodebuild stderr:', stderr); } const schemes = this.parseXcodebuildOutput(stdout); return { content: [ { type: "text", text: JSON.stringify({ projectPath, projectType: isWorkspace ? 'workspace' : 'project', schemes, totalSchemes: schemes.length }, null, 2) } ] }; } catch (error: any) { throw new Error(`Failed to list schemes: ${error.message}`); } }
  • The input schema registered for the list_schemes tool in the MCP tools list, defining the required projectPath parameter.
    name: "list_schemes", description: "List all available schemes in an Xcode project or workspace", inputSchema: { type: "object", properties: { projectPath: { type: "string", description: "Path to the Xcode project (.xcodeproj) or workspace (.xcworkspace)" } }, required: ["projectPath"] } },
  • src/index.ts:1419-1421 (registration)
    The switch case in the CallToolRequest handler that registers and dispatches calls to the list_schemes tool to the xcodeHandlers.listSchemes method.
    case "list_schemes": return { toolResult: await this.xcodeHandlers.listSchemes(args as any) };
  • Helper method that parses the stdout from xcodebuild -list, extracting scheme names and determining if they are shared based on indentation.
    private parseXcodebuildOutput(output: string): SchemeInfo[] { const lines = output.split('\n'); const schemes: SchemeInfo[] = []; let inSchemesSection = false; for (const line of lines) { const trimmedLine = line.trim(); if (trimmedLine === 'Schemes:') { inSchemesSection = true; continue; } if (inSchemesSection) { if (trimmedLine === '' || trimmedLine.startsWith('Build Configurations:') || trimmedLine.startsWith('If no build configuration')) { break; } if (trimmedLine && !trimmedLine.startsWith('Information about project')) { const isShared = !trimmedLine.startsWith(' '); const schemeName = trimmedLine.trim(); if (schemeName) { schemes.push({ name: schemeName, isShared }); } } } } return schemes; }
  • TypeScript interface defining the input arguments for the listSchemes handler.
    export interface ListSchemesArgs { projectPath: string; }

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/concavegit/app-store-connect-mcp-server'

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