Skip to main content
Glama
conorluddy

XC-MCP: XCode CLI wrapper

by conorluddy

Run Xcode Tests

xcodebuild-test

Run Xcode unit and UI tests with intelligent defaults, filtering, and test plans. Get structured pass/fail results and cached configurations for faster iterations.

Instructions

xcodebuild-test

⚡ Run Xcode tests with intelligent defaults and progressive disclosure

What it does

Executes unit and UI tests for Xcode projects with advanced learning that remembers successful test configurations and suggests optimal simulators per project. Provides detailed test metrics (passed/failed/skipped) with progressive disclosure to prevent token overflow. Supports test filtering (-only-testing, -skip-testing), test plans, and test-without-building mode for faster iteration. Learns from successful test runs to improve future suggestions.

Why you'd use it

  • Automatic smart defaults: remembers which simulator and config worked for tests

  • Detailed test metrics: structured pass/fail/skip counts instead of raw output

  • Progressive disclosure: concise summaries with full logs available via testId

  • Test filtering: run specific tests or skip problematic ones with -only-testing/-skip-testing

Parameters

Required

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

  • scheme (string): Test scheme name (use xcodebuild-list to discover)

Optional

  • configuration (string, default: 'Debug'): Build configuration (Debug/Release, defaults to cached or "Debug")

  • destination (string): Test destination (e.g., "platform=iOS Simulator,id=")

  • sdk (string): SDK to test against (e.g., "iphonesimulator")

  • derivedDataPath (string): Custom derived data path

  • testPlan (string): Test plan name to execute

  • onlyTesting (string[]): Array of test identifiers to run exclusively

  • skipTesting (string[]): Array of test identifiers to skip

  • testWithoutBuilding (boolean): Run tests without building (requires prior build)

Returns

Structured JSON with testId (for progressive disclosure), success status, test summary (total/passed/failed/skipped counts), failure details (first 3 failures), and cache metadata showing which smart defaults were applied. Use xcodebuild-get-details with testId for full logs.

Examples

Run all tests with smart defaults

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

Run specific tests only

const filtered = await xcodebuildTestTool({
  projectPath: "/path/to/MyApp.xcworkspace",
  scheme: "MyApp",
  onlyTesting: ["MyAppTests/testLogin", "MyAppTests/testLogout"]
});

Fast iteration with test-without-building

const quick = await xcodebuildTestTool({
  projectPath: "/path/to/MyApp.xcodeproj",
  scheme: "MyApp",
  testWithoutBuilding: true
});

Complete JSON Examples

Run All Tests

{"projectPath": "/path/to/MyApp.xcodeproj", "scheme": "MyApp"}

Run Specific Test Plan

{"projectPath": "/path/to/MyApp.xcodeproj", "scheme": "MyApp", "testPlan": "IntegrationTests"}

Run Only Specific Tests

{"projectPath": "/path/to/MyApp.xcodeproj", "scheme": "MyApp", "onlyTesting": ["MyAppTests/LoginTests", "MyAppTests/AuthTests/testLogin"]}

Skip Specific Tests

{"projectPath": "/path/to/MyApp.xcodeproj", "scheme": "MyApp", "skipTesting": ["MyAppTests/SlowTests", "MyAppUITests"]}

Test Without Building (Using Previous Build)

{"projectPath": "/path/to/MyApp.xcodeproj", "scheme": "MyApp", "testWithoutBuilding": true}

Test with Specific Destination

{"projectPath": "/path/to/MyApp.xcodeproj", "scheme": "MyApp", "destination": "platform=iOS Simulator,name=iPhone 16 Pro,OS=18.0"}

Release Configuration Testing

{"projectPath": "/path/to/MyApp.xcodeproj", "scheme": "MyApp", "configuration": "Release"}
  • xcodebuild-build: Build before testing

  • xcodebuild-get-details: Get full test logs (use with testId)

  • simctl-list: See available test simulators

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sdkNo
schemeYes
testPlanNo
destinationNo
onlyTestingNo
projectPathYes
skipTestingNo
configurationNoDebug
derivedDataPathNo
testWithoutBuildingNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
failedYes
passedYes
schemeYes
testIdYesCache id for full test log (xcodebuild-get-details)
skippedYes
successYes
durationMsNo
totalTestsYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv4.1.0
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": false,
      +  "properties": {
      +    "durationMs": {
      +      "type": "number"
      +    },
      +    "failed": {
      +      "type": "number"
      +    },
      +    "passed": {
      +      "type": "number"
      +    },
      +    "scheme": {
      +      "type": "string"
      +    },
      +    "skipped": {
      +      "type": "number"
      +    },
      +    "success": {
      +      "type": "boolean"
      +    },
      +    "testId": {
      +      "description": "Cache id for full test log (xcodebuild-get-details)",
      +      "type": "string"
      +    },
      +    "totalTests": {
      +      "type": "number"
      +    }
      +  },
      +  "required": [
      +    "testId",
      +    "success",
      +    "totalTests",
      +    "passed",
      +    "failed",
      +    "skipped",
      +    "scheme"
      +  ],
      +  "type": "object"
      +}
  2. Addedv2.0.2
  3. Removedv3.2.0
  4. Addedv1.1.0

TDQS

A4.5/5.0
Behavior4/5

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

Annotations are all false, so they provide no behavioral signals. The description compensates by disclosing that the tool 'learns from successful test runs', maintains 'cache metadata' of applied defaults, uses 'progressive disclosure' to avoid token overflow, and supports 'test-without-building' which implies it may skip a build. It also states it returns failure details and a testId for later retrieval. This goes beyond the annotations, though it does not exhaustively list all side effects (e.g., derived data writes), but it is sufficiently transparent for an agent.

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 well-structured with headings, front-loaded with a summary, and uses tables-like bullet lists for parameters and returns. However, it includes redundant content: 'Examples' (TypeScript) and 'Complete JSON Examples' (pure JSON) duplicate the same scenarios, and the 'Why you'd use it' overlaps with 'What it does'. While each section adds some value, trimming duplicates would improve conciseness without losing information.

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?

For a tool with 10 parameters, no schema descriptions, and an output schema (mentioned but not shown), the description is remarkably complete. It explains each parameter, gives multiple usage examples, details the return structure (testId, counts, failure details, cache metadata), and points to related tools for supplementary actions. An agent has everything needed to call it correctly and handle results. No obvious gaps remain.

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?

With 0% schema description coverage, the description must fully compensate, and it does. The 'Parameters' section provides a clear one-line description for each of the 10 parameters, including examples for destination and sdk, notes on defaults for configuration, and guidance that scheme should be discovered via xcodebuild-list. The extensive 'Complete JSON Examples' further illustrate valid usage, making all parameters semantically clear. This far exceeds 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 opens with '⚡ Run Xcode tests' and immediately states 'Executes unit and UI tests for Xcode projects', giving a specific verb and resource. It clearly distinguishes from siblings like xcodebuild-build (build) and xcodebuild-list (discover schemes) by focusing on test execution, and even names related tools to reinforce the boundary. The purpose is unambiguous.

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 lists concrete benefits (smart defaults, metrics, progressive disclosure, filtering) and the 'Related Tools' section routes to xcodebuild-list for scheme discovery and xcodebuild-get-details for logs. It implies when to use this tool over alternatives (e.g., when you need test results with caching) but does not explicitly state exclusions like 'use xcodebuild-build if you only need to compile'. Clear context, but no explicit when-not conditions.

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