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
        })),
      };
    });
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden for behavioral disclosure. It states this is a 'Get' operation (implying read-only), but doesn't mention any behavioral traits like whether it requires specific Xcode versions, what format the list returns, if there are rate limits, or if it works with both .xcodeproj and .xcworkspace files as implied by the parameter description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that gets straight to the point with no wasted words. It's appropriately sized for a simple list-retrieval tool and front-loads the core functionality.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what format the 'list of projects' returns, whether it includes nested projects, how it handles errors, or any prerequisites. Given the complexity of Xcode workspaces and the lack of structured output documentation, more context is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description doesn't add any parameter information beyond what's already in the schema, which has 100% coverage. The schema fully documents the single required parameter 'xcodeproj' with its type, description, and example. The description doesn't compensate with additional context about parameter usage or constraints.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get list of projects') and resource ('in a specific workspace'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'xcode_get_workspace_info' or 'xcode_get_schemes', which might have overlapping functionality in the Xcode context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With many sibling tools like 'xcode_get_workspace_info' and 'xcode_get_schemes', there's no indication of how this tool differs or when it's the appropriate choice over other information-retrieval tools in the Xcode suite.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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