Skip to main content
Glama
conorluddy

XC-MCP: XCode CLI wrapper

by conorluddy

Clean Xcode Build

xcodebuild-clean
DestructiveIdempotent

Clean Xcode build artifacts and intermediate files to resolve stale builds and free up disk space. Validates project and Xcode setup, returns structured JSON with execution status and errors.

Instructions

xcodebuild-clean

⚡ Clean build artifacts with validation and structured output

What it does

Removes build artifacts and intermediate files for an Xcode project or workspace. Pre-validates that the project exists and Xcode is properly installed before executing, providing clear error messages if something is misconfigured. Returns structured JSON responses with execution status, duration, and any errors encountered during the clean operation.

Why you'd use it

  • Resolve build issues by removing stale or corrupted build artifacts

  • Free up disk space occupied by intermediate build files

  • Ensure clean builds from scratch without cached compilation results

  • Get structured feedback with execution time and success status

Parameters

Required

  • projectPath (string): Path to .xcodeproj or .xcworkspace file

  • scheme (string): Build scheme name to clean

Optional

  • configuration (string): Build configuration to clean (e.g., "Debug", "Release")

Returns

Structured JSON response containing success status, command executed, execution duration, output messages, and exit code. Includes both stdout and stderr for comprehensive debugging. Operation typically completes in under 3 minutes.

Examples

Clean default configuration

const result = await xcodebuildCleanTool({
  projectPath: "/path/to/MyApp.xcodeproj",
  scheme: "MyApp"
});

Clean specific configuration

const cleanRelease = await xcodebuildCleanTool({
  projectPath: "/path/to/MyApp.xcworkspace",
  scheme: "MyApp",
  configuration: "Release"
});
  • xcodebuild-build: Build after cleaning

  • xcodebuild-list: Discover available schemes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
schemeYes
projectPathYes
configurationNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv1.1.0
    • removedInput schema / additionalProperties
      Removed value: -false
    • removedInput schema / properties / configuration / description
      Removed value: -"Configuration to clean"
    • removedInput schema / properties / projectPath / description
      Removed value: -"Path to .xcodeproj or .xcworkspace file"
    • removedInput schema / properties / scheme / description
      Removed value: -"Scheme to clean"
  2. First observedv1.0.0

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already provide destructiveHint=true and idempotentHint=true, so the description correctly complements rather than repeats those. It adds useful behavioral context: pre-validating project existence and Xcode installation, returning structured JSON with status/duration/errors, and capturing stdout/stderr. No contradiction with annotations exists.

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 well-structured with clear headings, concise bullet lists, code examples, and related tools. It front-loads the core behavior and avoids filler; even operational details like typical completion time earn their place by setting agent expectations.

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

Completeness5/5

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

With no output schema, the description explains the return format in sufficient detail: success status, command executed, execution duration, output messages, exit code, and stdout/stderr. It also covers preconditions, parameters, examples, and related tools, making the tool fully callable by an agent without needing additional context.

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

Parameters5/5

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

Schema description coverage is 0%, so the description carries the full burden of explaining parameters. It does this well: projectPath is described as the path to .xcodeproj or .xcworkspace, scheme as the build scheme name, and configuration as the build configuration with examples. This fully compensates for the bare schema.

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

Purpose5/5

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

The description clearly states a specific verb and resource: 'Removes build artifacts and intermediate files for an Xcode project or workspace.' It also adds unique behaviors such as pre-validation and structured JSON output, which distinguishes it from related tools like xcodebuild-build and xcodebuild-list. This leaves no ambiguity about what the tool does.

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

Usage Guidelines4/5

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

The 'Why you'd use it' section provides concrete scenarios, and 'Related Tools' explicitly routes the agent to xcodebuild-build for building after cleaning and xcodebuild-list for discovering schemes. It lacks an explicit 'when not to use' statement, but the examples and related tool references make appropriate usage reasonably clear.

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