Skip to main content
Glama

build_xcode

Build Xcode projects and workspaces for iOS, macOS, tvOS, watchOS, and visionOS platforms using specified schemes, configurations, and destinations.

Instructions

Build an Xcode project or workspace

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectPathYesPath to the Xcode project or workspace
schemeYesXcode scheme to build
destinationYesBuild destination - Simulator: current architecture only (fast). Device: physical device. SimulatorUniversal: all architectures (slower but compatible)iOSSimulator
configurationNoBuild configuration (e.g., Debug, Release, Beta, or any custom configuration)Debug
derivedDataPathNoCustom derived data path (optional)

Implementation Reference

  • MCP tool 'build_xcode' handler: orchestrates input parsing, domain validation, use case execution (BuildProjectUseCase), metadata extraction, and result presentation.
    async execute(args: unknown): Promise<MCPResponse> {
      try {
        // 1. Cast to expected shape
        const input = args as {
          projectPath: unknown;
          scheme: unknown;
          destination: unknown;
          configuration?: unknown;
          derivedDataPath?: unknown;
        };
    
        // 2. Get derived data path - use provided value or get from config
        const projectPath = input.projectPath as string;
        const derivedDataPath = input.derivedDataPath ||
          this.configProvider.getDerivedDataPath(projectPath);
    
        // 3. Create domain request - domain objects will validate
        const request = BuildRequest.create(
          input.projectPath,
          input.scheme,
          input.destination,
          input.configuration,
          derivedDataPath
        );
    
        // 4. Execute use case
        const result = await this.buildUseCase.execute(request);
    
        // 5. Extract metadata for presentation
        const platform = PlatformDetector.fromDestination(request.destination);
    
        const metadata = {
          scheme: request.scheme,
          platform,
          configuration: request.configuration
        };
    
        // 6. Present the result
        return this.presenter.present(result, metadata);
    
      } catch (error: any) {
        // Handle all errors uniformly
        return this.presenter.presentError(error);
      }
    }
  • Input schema definition for the 'build_xcode' tool, specifying parameters like projectPath, scheme, destination (with enum), configuration, and derivedDataPath.
    get inputSchema() {
      return {
        type: 'object' as const,
        properties: {
          projectPath: {
            type: 'string',
            description: 'Path to the Xcode project or workspace'
          },
          scheme: {
            type: 'string',
            description: 'Xcode scheme to build'
          },
          destination: {
            type: 'string',
            enum: ['iOSSimulator', 'iOSDevice', 'iOSSimulatorUniversal', 
                   'macOS', 'macOSUniversal', 
                   'tvOSSimulator', 'tvOSDevice', 'tvOSSimulatorUniversal',
                   'watchOSSimulator', 'watchOSDevice', 'watchOSSimulatorUniversal',
                   'visionOSSimulator', 'visionOSDevice', 'visionOSSimulatorUniversal'],
            description: 'Build destination - Simulator: current architecture only (fast). Device: physical device. SimulatorUniversal: all architectures (slower but compatible)',
            default: 'iOSSimulator'
          },
          configuration: {
            type: 'string',
            description: 'Build configuration (e.g., Debug, Release, Beta, or any custom configuration)',
            default: 'Debug'
          },
          derivedDataPath: {
            type: 'string',
            description: 'Custom derived data path (optional)'
          }
        },
        required: ['projectPath', 'scheme', 'destination']
      };
    }
  • src/index.ts:77-118 (registration)
    Registers the 'build_xcode' tool by creating BuildXcodeControllerFactory.create() instance (line 88) and adding to tools Map using getToolDefinition().name.
    private registerTools() {
      // Create instances of all tools
      const toolInstances = [
        // Simulator management
        ListSimulatorsControllerFactory.create(),
        BootSimulatorControllerFactory.create(),
        ShutdownSimulatorControllerFactory.create(),
        // new ViewSimulatorScreenTool(),
        // Build and test
        // new BuildSwiftPackageTool(),
        // new RunSwiftPackageTool(),
        BuildXcodeControllerFactory.create(),
        InstallAppControllerFactory.create(),
        // new RunXcodeTool(),
        // new TestXcodeTool(),
        // new TestSwiftPackageTool(),
        // new CleanBuildTool(),
        // Archive and export
        // new ArchiveProjectTool(),
        // new ExportIPATool(),
        // Project info and schemes
        // new ListSchemesTool(),
        // new GetBuildSettingsTool(),
        // new GetProjectInfoTool(),
        // new ListTargetsTool(),
        // App management
        // new InstallAppTool(),
        // new UninstallAppTool(),
        // Device logs
        // new GetDeviceLogsTool(),
        // Advanced project management
        // new ManageDependenciesTool()
      ];
    
      // Register each tool by its name
      for (const tool of toolInstances) {
        const definition = tool.getToolDefinition();
        this.tools.set(definition.name, tool);
      }
    
      logger.info({ toolCount: this.tools.size }, 'Tools registered');
    }
  • Factory method that assembles all dependencies (adapters, use case, presenter, decorator) to create the fully-wired BuildXcodeController instance.
    export class BuildXcodeControllerFactory {
      static create(): MCPController {
        // Create infrastructure adapters
        const execAsync = promisify(exec);
        const executor = new ShellCommandExecutorAdapter(execAsync);
        const destinationMapper = new BuildDestinationMapperAdapter();
        const commandBuilder = new XcodeBuildCommandAdapter();
        const appLocator = new BuildArtifactLocatorAdapter(executor);
        const logManager = new LogManagerInstance();
        const outputParser = new XcbeautifyOutputParserAdapter();
        const outputFormatter = new XcbeautifyFormatterAdapter(executor);
    
        // Create use case with infrastructure
        const buildUseCase = new BuildProjectUseCase(
          destinationMapper,
          commandBuilder,
          executor,
          appLocator,
          logManager,
          outputParser,
          outputFormatter
        );
    
        // Create infrastructure services
        const configProvider = new ConfigProviderAdapter();
    
        // Create presenter
        const presenter = new BuildXcodePresenter();
    
        // Create the controller
        const controller = new BuildXcodeController(buildUseCase, presenter, configProvider);
    
        // Create dependency checker
        const dependencyChecker = new DependencyChecker(executor);
    
        // Wrap with dependency checking decorator
        const decoratedController = new DependencyCheckingDecorator(
          controller,
          ['xcodebuild', 'xcbeautify'],
          dependencyChecker
        );
    
        return decoratedController;
      }
  • Presenter formats build results and errors into MCPResponse, handling success/failure display with warnings, errors, and log paths.
    export class BuildXcodePresenter {
      private readonly maxErrorsToShow = 50;
      private readonly maxWarningsToShow = 20;
      
      present(result: BuildResult, metadata: {
        scheme: string;
        platform: Platform;
        configuration: string;
        showWarningDetails?: boolean;
      }): MCPResponse {
        if (result.outcome === BuildOutcome.Succeeded) {
          return this.presentSuccess(result, metadata);
        }
        return this.presentFailure(result, metadata);
      }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Build') but lacks details on execution behavior, such as whether it runs locally or remotely, timeouts, error handling, or output format. This is inadequate for a tool with potential complexity and no structured safety hints.

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 directly states the tool's purpose without unnecessary words. It is front-loaded and wastes no space, making it easy to parse quickly.

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?

Given the complexity of building Xcode projects (which can involve compilation, dependencies, and errors) and the lack of annotations and output schema, the description is insufficient. It doesn't cover behavioral aspects, error cases, or what to expect upon completion, leaving significant gaps for an AI agent to understand the tool fully.

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 schema description coverage is 100%, so parameters are well-documented in the schema itself. The description adds no additional parameter semantics beyond the schema, but since the schema is comprehensive, a baseline score of 3 is appropriate as it doesn't need to compensate for gaps.

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 ('Build') and resource ('Xcode project or workspace'), providing specific intent. However, it doesn't differentiate from sibling tools like 'install_app' or 'list_simulators', which are related but distinct operations in the Xcode ecosystem.

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?

No guidance is provided on when to use this tool versus alternatives. While sibling tools exist (e.g., 'install_app', 'list_simulators'), the description doesn't mention them or explain scenarios where building is appropriate versus other actions, leaving usage context unclear.

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/Stefan-Nitu/mcp-xcode'

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