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

XC-MCP: XCode CLI wrapper

by conorluddy

Record Test Step

test-record-step

Record a named test step by capturing a simulator screenshot and accessibility tree snapshot, then append it to a persistent session log for later report generation.

Instructions

test-record-step

Record a single named step in a test session, capturing a screenshot and accessibility tree snapshot.

What it does

Maintains a persistent session directory under ~/.xc-mcp/test-recordings/<sessionName>/ (override root with env var XC_MCP_RECORDINGS_DIR). Each call:

  1. Creates the session directory + steps.json on first call

  2. Captures a screenshot via xcrun simctl io <udid|booted> screenshot

  3. Captures an accessibility tree via idb ui describe-all (tolerates idb absence)

  4. Appends a step record to steps.json with sequential index (001, 002, …)

Session layout:

~/.xc-mcp/test-recordings/<sessionName>/
  steps.json          – session metadata + all step records
  screenshots/        – NNN-<label>.png per step
  accessibility/      – NNN-<label>.json per step (idb NDJSON or error stub)
  report.md           – generated by test-record-report

Parameters

  • sessionName (string, required): Unique session identifier (used as directory name)

  • label (string, required): Human-readable description of this step

  • udid (string, optional): Simulator UDID — defaults to booted

  • metadata (object, optional): Arbitrary key-value pairs attached to step record

  • assertion (string, optional): Assertion description recorded with step

Returns

JSON with { sessionName, stepIndex, label, screenshot, accessibilityFile, elementCount, timestampMs } plus guidance for next steps.

Examples

Record first step

await testRecordStepTool({ sessionName: "login-flow", label: "App launched" })

Step with assertion and metadata

await testRecordStepTool({
  sessionName: "login-flow",
  label: "Login succeeded",
  assertion: "Home screen is visible",
  metadata: { user: "test@example.com", env: "staging" }
})

Specific simulator

await testRecordStepTool({
  sessionName: "login-flow",
  label: "Credentials entered",
  udid: "device-123"
})

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": {
      "sessionName": "<sessionName>",
      "label": "<label>"
    },
    "name": "test-record-step"
  }
}

Input Schema

NameRequiredDescriptionDefault
udidNo
labelYesHuman description of this step
metadataNo
assertionNo
sessionNameYesRecording session name
assertionPassedNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv5.0.0
    • addedInput schema / properties / assertionPassed
      Added value: +{
      +  "type": "boolean"
      +}
  2. Addedv4.1.0

TDQS

A4.3/5.0
Behavior4/5

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

Annotations declare this is a non-readonly, non-destructive, non-idempotent write, and the description adds substantial context beyond that: it creates directories on first call, appends monotonically indexed records, writes to a configurable persistent path (XC_MCP_RECORDINGS_DIR), shells out to `xcrun simctl io ... screenshot` and `idb ui describe-all`, and tolerates idb absence. The one gap is that it never warns about appending duplicate steps on a repeated label or what happens when the same session is reused concurrently.

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?

Structure is excellent — purpose front-loaded, then behavior, layout, parameters, returns, examples under headings. It runs longer than necessary for a single-step recorder: three separate code examples largely restate the parameter list, and the ASCII session-layout block partially duplicates the numbered behavior list.

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

Completeness4/5

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

For a six-parameter mutation tool with no output schema, the definition covers nearly everything an agent needs: side effects, storage location, return field names, and worked examples. The only material omission is the `assertionPassed` parameter, whose role relative to `assertion` is left ambiguous.

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

Parameters4/5

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

Schema description coverage is only 33%, so the description must compensate, and it largely does: sessionName is explained as the directory name, udid is documented as defaulting to `booted`, metadata as arbitrary key-value pairs attached to the step record, and assertion as recorded text. However, the `assertionPassed` boolean present in the schema is omitted entirely, leaving one of six parameters undocumented in both places.

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 opening sentence names a specific verb and resource — 'Record a single named step in a test session' — and states the two artifacts captured (screenshot, accessibility tree). The enumerated four-step behavior and the session layout make it clearly distinguishable from siblings like app-state-capture (one-shot state) and test-record-report (report generation).

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?

Usage context is clear: this is the recurring per-step recorder within a named session, and the layout section explicitly attributes report.md to the test-record-report sibling. Examples show the intended call patterns (first step, with assertion/metadata, with explicit udid). It stops short of explicit when-not-to-use guidance or stating that at least one step must precede test-record-report.

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