Skip to main content
Glama

xcode_get_projects

Retrieve a list of projects within an Xcode workspace or project file to manage and navigate development environments.

Instructions

Get list of projects in 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

  • The main handler function that executes the tool logic: validates project path, opens the project, executes JXA script to retrieve list of projects from the workspace, and returns JSON-formatted result.
    public static async getProjects(projectPath: string, openProject: OpenProjectCallback): Promise<McpResult> { const validationError = PathValidator.validateProjectPath(projectPath); if (validationError) return validationError; await openProject(projectPath); const script = ` (function() { ${getWorkspaceByPathScript(projectPath)} const projects = workspace.projects(); const projectInfo = projects.map(project => ({ name: project.name(), id: project.id() })); return JSON.stringify(projectInfo, null, 2); })() `; const result = await JXAExecutor.execute(script); return { content: [{ type: 'text', text: result }] }; }
  • Defines the input schema, description, and registration data for the xcode_get_projects tool, used by both MCP server and CLI.
    name: 'xcode_get_projects', description: 'Get list of projects in 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'], }, },
  • Registers the tool in the MCP CallToolRequestSchema handler switch statement, performing parameter validation and delegating execution to InfoTools.getProjects.
    case 'xcode_get_projects': if (!args.xcodeproj) { throw new McpError(ErrorCode.InvalidParams, `Missing required parameter: xcodeproj`); } return await InfoTools.getProjects(args.xcodeproj as string, this.openProject.bind(this));
  • Registers the tool for the ListToolsRequestSchema by including it in getToolDefinitions() which returns the tool list with schema.
    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