Skip to main content
Glama
conorluddy

XC-MCP: XCode CLI wrapper

by conorluddy

Terminate App on Simulator

simctl-terminate
Idempotent

Gracefully stop a running iOS app on a simulator, triggering lifecycle callbacks for clean shutdown. Use to reset app state or verify termination handling.

Instructions

simctl-terminate

Gracefully terminate a running iOS app on a simulator.

What it does

Stops a running app by sending a termination signal. The app's lifecycle methods (applicationWillTerminate:) will be called, allowing clean shutdown.

Parameters

  • udid (string, required): Simulator UDID (from simctl-list)

  • bundleId (string, required): App bundle ID (e.g., com.example.MyApp)

Returns

JSON response with:

  • Termination status

  • Command executed

  • Guidance for next steps (relaunching, uninstalling, checking container)

Examples

Terminate running app

await simctlTerminateTool({
  udid: 'device-123',
  bundleId: 'com.example.MyApp'
})

Common Use Cases

  1. Clean app restart: Terminate then relaunch to reset app state

  2. Test lifecycle: Verify app handles termination correctly

  3. Memory cleanup: Stop app before running memory-intensive tests

  4. State reset: Terminate app to clear runtime state between test runs

  5. Background testing: Stop foreground app to test background behavior

Important Notes

  • Graceful termination: App lifecycle methods are called for clean shutdown

  • Not running OK: Returns error if app is not running, but can be safely ignored

  • Simulator state: Works on both booted and shutdown simulators

  • No force kill: This is a graceful termination, not a force kill

Error Handling

  • App not running: Error returned but operation is safe to ignore

  • App not installed: Indicates app must be installed first

  • Simulator not booted: Warning shown but termination may still succeed

  • Invalid bundle ID: Validates bundle ID format (must contain '.')

Next Steps After Termination

  1. Launch app again: simctl-launch <udid> <bundleId>

  2. Uninstall app: simctl-uninstall <udid> <bundleId>

  3. Check app container: simctl-get-app-container <udid> <bundleId>

  4. Install new build: simctl-install <udid> /path/to/App.app

Difference from Force Kill

  • Terminate (this tool): Graceful shutdown with lifecycle callbacks

  • Force kill: Immediate termination without cleanup (use system kill command)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
udidYes
bundleIdYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv4.1.0

TDQS

A4.5/5.0
Behavior5/5

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

The annotations already cover read-only, destructive, and idempotency hints, and the description adds substantial behavioral context: applicationWillTerminate is called, terminating a non-running app returns a safe-to-ignore error, it works on booted and shutdown simulators, bundle IDs must contain '.', and it is not a force kill. This goes well beyond what annotations provide.

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 front-loaded with purpose, parameters, and a clear example, then organizes usage notes, errors, and next steps into labeled sections. It is longer than strictly necessary for a two-parameter tool, and points like 'app not running' and 'graceful/no force kill' are repeated across sections, though the extra detail is mostly useful.

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?

Without an output schema, the description still explains the JSON response contents, enumerates error cases (not running, not installed, simulator not booted, invalid bundle ID), and gives follow-up tool references. For a tool with two simple string parameters, this covers all critical invocation and post-action 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?

With 0% schema description coverage, the description fully compensates for both parameters. It explains udid as coming from simctl-listennett, provides a concrete bundle ID example, and adds the validation rule that bundle IDs must contain '.', making both parameters meaningful for invocation.

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 opening line, 'Gracefully terminate a running iOS app on a simulator,' gives a specific verb and resource. It clearly separates termination from launch/uninstall actions, but it never explicitly distinguishes itself from the sibling idb-terminate tool, so it stops short of full sibling differentiation.

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 'Common Use Cases' section and 'Difference from Force Kill' section make the intended contexts explicit, and the 'Next Steps' section names relevant sibling tools. However, there is no explicit guidance about when to prefer simctl-terminate over the alternative idb-terminate sibling, so exclusion guidance is incomplete.

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