Skip to main content
Glama

xcode_get_run_destinations

Retrieve available run destinations for an Xcode project to configure build targets and deployment options.

Instructions

Get list of available run destinations 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

  • Executes the core tool logic: validates project path, ensures project is open in Xcode, runs JXA script to fetch workspace.runDestinations(), formats as JSON with active status, handles empty results.
    public static async getRunDestinations(projectPath: string, openProject: OpenProjectCallback): Promise<McpResult> {
      const validationError = PathValidator.validateProjectPath(projectPath);
      if (validationError) return validationError;
    
      await openProject(projectPath);
    
      const script = `
        (function() {
          ${getWorkspaceByPathScript(projectPath)}
          
          const destinations = workspace.runDestinations();
          const activeDestination = workspace.activeRunDestination();
          
          const destInfo = destinations.map(dest => ({
            name: dest.name(),
            platform: dest.platform(),
            architecture: dest.architecture(),
            isActive: activeDestination && dest.name() === activeDestination.name()
          }));
          
          return JSON.stringify(destInfo, null, 2);
        })()
      `;
      
      const result = await JXAExecutor.execute(script);
      
      // Parse the result to check if destinations array is empty
      try {
        const destInfo = JSON.parse(result);
        if (Array.isArray(destInfo) && destInfo.length === 0) {
          return { content: [{ type: 'text', text: 'No run destinations found for the project' }] };
        }
      } catch (error) {
        // If parsing fails, return the raw result
      }
      
      return { content: [{ type: 'text', text: result }] };
    }
  • Defines the tool name, description, and input schema requiring the xcodeproj path (absolute path to Xcode project/workspace).
    name: 'xcode_get_run_destinations',
    description: 'Get list of available run destinations 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'],
    },
  • Registers the tool in the MCP server's CallToolRequest handler switch statement: validates xcodeproj param and dispatches to ProjectTools.getRunDestinations.
    case 'xcode_get_run_destinations':
      if (!args.xcodeproj) {
        throw new McpError(ErrorCode.InvalidParams, `Missing required parameter: xcodeproj`);
      }
      return await ProjectTools.getRunDestinations(args.xcodeproj as string, this.openProject.bind(this));
  • Includes the tool in the xcodeTools array used for environment validation to ensure Xcode and osascript are available before execution.
    const xcodeTools = [...buildTools, 'xcode_open_project', 'xcode_get_schemes', 'xcode_set_active_scheme', 
                       'xcode_get_run_destinations', 'xcode_get_workspace_info', 'xcode_get_projects'];
    const xcresultTools = ['xcresult_browse', 'xcresult_browser_get_console', 'xcresult_summary', 'xcresult_get_screenshot', 'xcresult_get_ui_hierarchy', 'xcresult_get_ui_element', 'xcresult_list_attachments', 'xcresult_export_attachment'];
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It implies a read-only operation ('Get list'), but doesn't disclose error conditions, performance characteristics, whether it requires Xcode to be running, or what format the returned list has (e.g., structured data vs raw output).

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 front-loads the core purpose with zero wasted words. Every element ('Get list', 'available run destinations', 'for a specific project') contributes directly to understanding the tool's function.

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 'run destinations' are (e.g., simulators/devices), what the return format looks like, or potential errors. Given the Xcode context and sibling tools involving execution, more behavioral 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?

Schema description coverage is 100%, with the single parameter 'xcodeproj' well-documented in the schema. The description adds no additional parameter context beyond implying the tool operates on a 'specific project', which aligns with the schema. Baseline 3 is appropriate when schema does the heavy lifting.

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 verb 'Get' and resource 'list of available run destinations for a specific project', making the purpose immediately understandable. It doesn't explicitly differentiate from siblings like 'xcode_get_projects' or 'xcode_get_schemes', but the specificity about 'run destinations' provides inherent distinction.

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. It doesn't mention prerequisites (e.g., needing an open project), exclusions, or relationships to siblings like 'xcode_get_schemes' or 'xcode_build_and_run' that might involve run destinations.

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