Skip to main content
Glama
ebowwa

Xcode MCP Server

by ebowwa

xcode_clean_project

Remove build artifacts from Xcode projects to resolve compilation issues and free disk space by specifying the project path and optional scheme.

Instructions

Clean build artifacts for an Xcode project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_pathYesPath to .xcodeproj file
schemeNoScheme to clean

Implementation Reference

  • Core handler logic for executing 'xcode_clean_project': strips 'xcode_' prefix to get 'clean_project', executes via CommandExecutor, formats output/errors into MCP response.
    // Handle Xcode commands
    // Remove 'xcode_' prefix if present
    const commandName = name.startsWith('xcode_') ? name.slice(6) : name;
    const result = await this.commandExecutor.executeCommand(commandName, args);
    
    let responseText = result.output;
    if (result.error) {
      responseText += `\n\nWarnings/Errors:\n${result.error}`;
    }
    if (!result.success) {
      responseText = `Command failed: ${result.error}\n\nCommand executed: ${result.command}`;
    }
    
    return {
      content: [
        {
          type: 'text',
          text: responseText,
        },
      ],
  • Generates input schema and metadata (name: 'xcode_clean_project', description, inputSchema with parameters from 'clean_project' command definition loaded from commands.json).
    generateMCPToolDefinitions(): Array<{
      name: string;
      description: string;
      inputSchema: any;
    }> {
      return Object.entries(this.commands).map(([name, command]) => ({
        name: `xcode_${name}`,
        description: command.description,
        inputSchema: {
          type: 'object',
          properties: command.parameters ? Object.fromEntries(
            Object.entries(command.parameters).map(([paramName, paramDef]) => [
              paramName,
              {
                type: paramDef.type,
                description: paramDef.description,
                ...(paramDef.default !== undefined && { default: paramDef.default })
              }
            ])
          ) : {},
          required: command.parameters ? Object.entries(command.parameters)
            .filter(([_, paramDef]) => paramDef.required)
            .map(([paramName]) => paramName) : []
        }
      }));
    }
  • src/index.ts:52-89 (registration)
    Loads commands from commands.json, generates MCP tool list including 'xcode_clean_project', registers with MCP server via ListToolsRequestSchema handler.
    // Load commands and dynamically create tool list
    await this.commandExecutor.loadCommands();
    const tools = this.commandExecutor.generateMCPToolDefinitions();
    
    // Add web monitor management tools
    const webMonitorTools = [
      {
        name: 'start_web_monitor',
        description: 'Start the web interface for visual command execution and monitoring',
        inputSchema: {
          type: 'object',
          properties: {},
          required: []
        }
      },
      {
        name: 'stop_web_monitor',
        description: 'Stop the web interface if it is running',
        inputSchema: {
          type: 'object',
          properties: {},
          required: []
        }
      },
      {
        name: 'web_monitor_status',
        description: 'Get the current status of the web monitor',
        inputSchema: {
          type: 'object',
          properties: {},
          required: []
        }
      }
    ];
    
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [...tools, ...webMonitorTools],
    }));
  • Executes the underlying 'clean_project' command: validates params, builds shell command from template, runs via execAsync or internal handler, returns result.
    async executeCommand(name: string, args: Record<string, any> = {}): Promise<{
      success: boolean;
      output: string;
      error?: string;
      command: string;
    }> {
      const command = this.getCommand(name);
      if (!command) {
        throw new Error(`Command '${name}' not found`);
      }
    
      this.validateParameters(command, args);
    
      // Handle internal commands
      if (command.command.startsWith('internal:')) {
        return await this.executeInternalCommand(command, args);
      }
    
      // Handle external commands
      const builtCommand = this.buildCommand(command, args);
    
      try {
        const { stdout, stderr } = await execAsync(builtCommand);
        
        return {
          success: true,
          output: stdout,
          error: stderr || undefined,
          command: builtCommand
        };
      } catch (error) {
        return {
          success: false,
          output: '',
          error: error instanceof Error ? error.message : String(error),
          command: builtCommand
        };
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('clean') but doesn't explain what 'clean' entails (e.g., deleting temporary files, resetting caches), whether it's safe or destructive, if it requires specific permissions, or what happens on success/failure. For a mutation tool with zero annotation coverage, this is a significant gap in transparency.

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 action ('clean build artifacts') without unnecessary words. Every part earns its place by specifying the target ('for an Xcode project'), making it appropriately sized for the tool's complexity.

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 tool has no annotations and no output schema, the description is incomplete. It lacks behavioral details (e.g., what 'clean' does, side effects), usage context, and output expectations. For a mutation tool with 2 parameters, this minimal description leaves significant gaps for an agent to operate effectively.

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%, so the schema already documents both parameters (project_path and scheme) with clear descriptions. The description doesn't add any meaning beyond what's in the schema (e.g., it doesn't explain parameter interactions or default behaviors). Baseline 3 is appropriate when the 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 ('clean') and resource ('build artifacts for an Xcode project'), making the purpose unambiguous. It distinguishes from siblings like xcode_build_project or xcode_archive_project by focusing on cleanup rather than building or archiving. However, it doesn't explicitly differentiate from all siblings (e.g., it could mention it's not about testing or device operations).

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. It doesn't mention prerequisites (e.g., needing Xcode installed), typical scenarios (e.g., after build failures or before fresh builds), or exclusions (e.g., not for cleaning derived data outside the project). The agent must infer usage from context alone.

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

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