Skip to main content
Glama

clean_proj

Remove build artifacts from Xcode projects using xcodebuild. Specify the project path to clean derived data and temporary files.

Instructions

Cleans build products for a specific project file using xcodebuild. IMPORTANT: Requires projectPath. Scheme/Configuration are optional. Example: clean_proj({ projectPath: '/path/to/MyProject.xcodeproj', scheme: 'MyScheme' })

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectPathYesPath to the .xcodeproj file (Required)
schemeNoOptional: The scheme to clean
configurationNoOptional: Build configuration to clean (Debug, Release, etc.)
derivedDataPathNoOptional: Path where derived data might be located
extraArgsNoAdditional xcodebuild arguments

Implementation Reference

  • Core handler logic shared between clean_ws and clean_proj tools. Executes xcodebuild clean command with provided parameters, defaulting scheme to empty and configuration to 'Debug', using macOS platform.
    async function _handleCleanLogic(params: {
      workspacePath?: string;
      projectPath?: string;
      scheme?: string;
      configuration?: string;
      derivedDataPath?: string;
      extraArgs?: string[];
    }): Promise<ToolResponse> {
      log('info', 'Starting xcodebuild clean request (internal)');
    
      // For clean operations, we need to provide a default platform and configuration
      return executeXcodeBuildCommand(
        {
          ...params,
          scheme: params.scheme || '', // Empty string if not provided
          configuration: params.configuration || 'Debug', // Default to Debug if not provided
        },
        {
          platform: XcodePlatform.macOS, // Default to macOS, but this doesn't matter much for clean
          logPrefix: 'Clean',
        },
        false,
        'clean', // Specify 'clean' as the build action
      );
    }
  • Zod input schema for the clean_proj tool defining required projectPath and optional parameters.
    {
      projectPath: z.string().describe('Path to the .xcodeproj file (Required)'),
      scheme: z.string().optional().describe('Optional: The scheme to clean'),
      configuration: z
        .string()
        .optional()
        .describe('Optional: Build configuration to clean (Debug, Release, etc.)'),
      derivedDataPath: z
        .string()
        .optional()
        .describe('Optional: Path where derived data might be located'),
      extraArgs: z.array(z.string()).optional().describe('Additional xcodebuild arguments'),
    },
  • Direct registration of the 'clean_proj' tool on the MCP server, including name, description, schema, and handler reference.
    export function registerCleanProjectTool(server: McpServer): void {
      server.tool(
        'clean_proj',
        "Cleans build products for a specific project file using xcodebuild. IMPORTANT: Requires projectPath. Scheme/Configuration are optional. Example: clean_proj({ projectPath: '/path/to/MyProject.xcodeproj', scheme: 'MyScheme' })",
        {
          projectPath: z.string().describe('Path to the .xcodeproj file (Required)'),
          scheme: z.string().optional().describe('Optional: The scheme to clean'),
          configuration: z
            .string()
            .optional()
            .describe('Optional: Build configuration to clean (Debug, Release, etc.)'),
          derivedDataPath: z
            .string()
            .optional()
            .describe('Optional: Path where derived data might be located'),
          extraArgs: z.array(z.string()).optional().describe('Additional xcodebuild arguments'),
        },
        (params) => _handleCleanLogic(params),
      );
    }
  • Central registration entry for conditionally enabling and registering the clean_proj tool based on environment variable.
    {
      register: registerCleanProjectTool,
      groups: [
        ToolGroup.MACOS_WORKFLOW,
        ToolGroup.IOS_SIMULATOR_WORKFLOW,
        ToolGroup.IOS_DEVICE_WORKFLOW,
      ],
      envVar: 'XCODEBUILDMCP_TOOL_CLEAN_PROJECT',
    },
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 mentions the required parameter and optional ones, but doesn't describe what 'clean' actually does (e.g., deletes derived data, removes build artifacts), potential side effects, permission requirements, or error behavior. The example helps but doesn't fully compensate for the lack of behavioral context.

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

Conciseness4/5

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

The description is appropriately sized with two sentences: one stating the purpose and requirements, and one providing an example. It's front-loaded with the core functionality. The example is helpful but could be considered slightly verbose, though not excessive.

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

Completeness3/5

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

Given the tool's moderate complexity (5 parameters, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose and parameter requirements but lacks details about what cleaning entails, potential impacts, or return values. For a mutation tool with no annotations, more behavioral context would be expected.

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 all 5 parameters thoroughly. The description adds minimal value beyond the schema by emphasizing that projectPath is required and scheme/configuration are optional, but doesn't provide additional semantic context about parameter usage or interactions.

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 ('Cleans build products') and resource ('for a specific project file using xcodebuild'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'clean_ws' or 'swift_package_clean', which would be needed for a score of 5.

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

Usage Guidelines3/5

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

The description provides implied usage guidance by stating 'Requires projectPath' and noting that Scheme/Configuration are optional, but it doesn't explicitly say when to use this tool versus alternatives like 'clean_ws' or 'swift_package_clean'. No when-not-to-use scenarios or clear alternatives are mentioned.

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/SampsonKY/XcodeBuildMCP'

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