Skip to main content
Glama
XC-MCP: XCode CLI wrapper

XC-MCP: XCode CLI wrapper

by conorluddy

Run Xcode Tests

xcodebuild-test

Run Xcode unit and UI tests with smart simulator defaults, test filtering, and concise pass/fail/skip summaries instead of raw output.

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

Execution status

parallelTesting: false disables parallel testing; true enables it; omitted preserves xcodebuild defaults. Zero executed tests return status NOT RUN and success false. A nonzero runner exit always fails.

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

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "projectPath": "<projectPath>",
      "scheme": "<scheme>"
    },
    "name": "xcodebuild-test"
  }
}

Input Schema

NameRequiredDescriptionDefault
sdkNo
schemeYes
testPlanNo
destinationNo
onlyTestingNo
projectPathYes
skipTestingNo
configurationNoDebug
derivedDataPathNo
parallelTestingNo
testWithoutBuildingNo

Output 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 changedv5.0.0
    • addedInput schema / properties / parallelTesting
      Added value: +{
      +  "type": "boolean"
      +}
  2. 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"
      +}
  3. Addedv2.0.2
  4. Removedv3.2.0
  5. Addedv1.1.0

TDQS

A4.5/5.0
Behavior5/5

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

Beyond the annotations, the description discloses meaningful runtime behavior: parallelTesting semantics, zero-test NOT RUN status, guaranteed failure on nonzero runner exit, progressive disclosure via testId, and caching/learning of simulator defaults. These are exactly the operational details an agent needs before invoking a test run.

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

Conciseness2/5

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

The description is front-loaded and well-sectioned, but it is heavily bloated: it duplicates the same scenarios in both TypeScript and JSON example blocks and repeats schema-level parameter details. Much of this could be trimmed without losing information an agent needs.

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 an 11-parameter test-execution tool with an output schema, the definition covers required inputs, optional behavior, failure semantics, and how to retrieve full logs. Nothing essential for correct invocation appears to be missing.

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 and 11 parameters, the description carries the full burden and documents every parameter, including array semantics for onlyTesting/skipTesting, the default for configuration, and the prerequisite that testWithoutBuilding requires a prior build. The examples reinforce correct usage beyond the bare schema types.

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 states a specific verb and resource ('Run Xcode tests', 'Executes unit and UI tests for Xcode projects') and clearly distinguishes itself from siblings like xcodebuild-build and xcodebuild-get-details. It also names its distinctive capabilities — test filtering, test plans, and test-without-building — so an agent can identify it without opening the schema.

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 and 'Related Tools' list give clear when-to-use context, including pointing to xcodebuild-list for scheme discovery and xcodebuild-get-details for logs. It stops short of explicit exclusions (e.g., 'do not use this to build'), but the surrounding guidance makes the intended role clear.

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