apple-instruments-mcp
v1.2.1MCP server for Apple platform profiling via xctrace/Instruments
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
doctor
One-shot health check: xctrace responsiveness/version/path, online and offline target counts, CoreSimulator access, and template/instrument availability. Useful before recording so a wedged or sandbox-restricted toolchain surfaces immediately instead of through a failed record.
profile_preset
Profile a target with a bundle of instruments in a single recording, then report each family that produced data. Presets: cpu / memory / network / full. `cpu` = Time Profiler. `memory` = Allocations + Leaks. `network` = Network Connections. `full` = all of the above. Faster than three separate runs when you want a broad picture.
| Parameter | Type | Description |
|---|---|---|
preset * | string | Preset bundle of instruments to record in a single trace. |
all_processes | boolean | Record all processes instead of launching or attaching to one target. |
bundle_id | App bundle ID for simulator/device launch, e.g. com.mycompany.myapp. | |
device_id | Optional simulator UUID or physical device ID. Omit for host macOS profiling. | |
dry_run | boolean | Return the xctrace command without recording. |
keep_trace | boolean | Keep generated trace and XML artifacts and include their paths in the report. |
launch_args | Optional shell-style arguments passed after launch_path. | |
launch_path | Executable or .app path to launch, useful for macOS apps and command-line tools. | |
output_dir | Optional directory for generated artifacts. A run-specific subdirectory is created inside it. | |
pid | Attach to a running process by PID. | |
process_name | Attach to a running process by name. | |
time_limit_seconds | integer | Recording duration in seconds. |
list_devices
List devices and runtimes visible to xctrace.
list_devices_structured
List devices and runtimes visible to xctrace as JSON.
list_templates
List all Instruments profiling templates installed on this Mac.
list_templates_structured
List Instruments profiling templates as JSON.
build_xctrace_command
Build the exact `xcrun xctrace record ...` command for the given target without executing it.
| Parameter | Type | Description |
|---|---|---|
template * | string | Instruments template name, e.g. 'Time Profiler', 'App Launch'. |
all_processes | boolean | Record all processes instead of launching or attaching to one target. |
bundle_id | App bundle ID for simulator/device launch, e.g. com.mycompany.myapp. | |
device_id | Optional simulator UUID or physical device ID. Omit for host macOS profiling. | |
launch_args | Optional shell-style arguments passed after launch_path. | |
launch_path | Executable or .app path to launch, useful for macOS apps and command-line tools. | |
output_path | Optional absolute path for the .trace output. Defaults to a placeholder. | |
pid | Attach to a running process by PID. | |
process_name | Attach to a running process by name. | |
time_limit_seconds | integer | Recording duration in seconds. |
profile_ios_app
Profile an iOS, iPadOS, tvOS, watchOS, or visionOS app by bundle ID on a simulator/device.
| Parameter | Type | Description |
|---|---|---|
bundle_id * | string | App bundle ID, e.g. com.mycompany.myapp. |
device_id * | string | Simulator UUID or physical device ID from list_devices. |
dry_run | boolean | Return the xctrace command without recording. |
keep_trace | boolean | Keep generated trace and XML artifacts and include their paths in the report. |
output_dir | Optional directory for generated artifacts. A run-specific subdirectory is created inside it. | |
profile_type | string | Analysis type to run. |
time_limit_seconds | integer | Recording duration in seconds. |
profile_mac_app
Profile a macOS app or executable by launching it.
| Parameter | Type | Description |
|---|---|---|
launch_path * | string | macOS .app or executable path to launch. |
dry_run | boolean | Return the xctrace command without recording. |
keep_trace | boolean | Keep generated trace and XML artifacts and include their paths in the report. |
launch_args | Optional shell-style arguments passed after launch_path. | |
output_dir | Optional directory for generated artifacts. A run-specific subdirectory is created inside it. | |
profile_type | string | Analysis type to run. |
time_limit_seconds | integer | Recording duration in seconds. |
profile_process
Profile a running process by process name or PID.
| Parameter | Type | Description |
|---|---|---|
dry_run | boolean | Return the xctrace command without recording. |
keep_trace | boolean | Keep generated trace and XML artifacts and include their paths in the report. |
output_dir | Optional directory for generated artifacts. A run-specific subdirectory is created inside it. | |
pid | Attach to a running process by PID. | |
process_name | Attach to a running process by name. | |
profile_type | string | Analysis type to run. |
time_limit_seconds | integer | Recording duration in seconds. |
profile_all_processes
Profile all processes on the host or selected device when the template supports it.
| Parameter | Type | Description |
|---|---|---|
device_id | Optional simulator UUID or physical device ID. Omit for host macOS profiling. | |
dry_run | boolean | Return the xctrace command without recording. |
keep_trace | boolean | Keep generated trace and XML artifacts and include their paths in the report. |
output_dir | Optional directory for generated artifacts. A run-specific subdirectory is created inside it. | |
profile_type | string | Analysis type to run. |
time_limit_seconds | integer | Recording duration in seconds. |
analyze_launch
Record an App Launch trace and report methods that hurt startup time.
| Parameter | Type | Description |
|---|---|---|
all_processes | boolean | Record all processes instead of launching or attaching to one target. |
bundle_id | App bundle ID for simulator/device launch, e.g. com.mycompany.myapp. | |
device_id | Optional simulator UUID or physical device ID. Omit for host macOS profiling. | |
dry_run | boolean | Return the xctrace command without recording. |
keep_trace | boolean | Keep generated trace and XML artifacts and include their paths in the report. |
launch_args | Optional shell-style arguments passed after launch_path. | |
launch_critical_ms | number | Launch time at or above this value is reported as critical. |
launch_good_ms | number | Launch time below this value is reported as good. |
launch_path | Executable or .app path to launch, useful for macOS apps and command-line tools. | |
offender_critical_ms | number | Launch offender self-time above this value is critical. |
offender_warning_ms | number | Launch offender self-time above this value is a warning. |
output_dir | Optional directory for generated artifacts. A run-specific subdirectory is created inside it. | |
pid | Attach to a running process by PID. | |
process_name | Attach to a running process by name. | |
time_limit_seconds | integer | Recording duration in seconds. |
analyze_launch_trace
Analyze an existing .trace bundle recorded with the App Launch template.
| Parameter | Type | Description |
|---|---|---|
trace_path * | string | Absolute path to the .trace bundle. |
bundle_id | string | Target name used in the report. |
launch_critical_ms | number | Launch time at or above this value is reported as critical. |
launch_good_ms | number | Launch time below this value is reported as good. |
offender_critical_ms | number | Launch offender self-time above this value is critical. |
offender_warning_ms | number | Launch offender self-time above this value is a warning. |
analyze_allocations
Record an Allocations trace and report live memory and top allocation categories.
| Parameter | Type | Description |
|---|---|---|
all_processes | boolean | Record all processes instead of launching or attaching to one target. |
bundle_id | App bundle ID for simulator/device launch, e.g. com.mycompany.myapp. | |
device_id | Optional simulator UUID or physical device ID. Omit for host macOS profiling. | |
dry_run | boolean | Return the xctrace command without recording. |
keep_trace | boolean | Keep generated trace and XML artifacts and include their paths in the report. |
launch_args | Optional shell-style arguments passed after launch_path. | |
launch_path | Executable or .app path to launch, useful for macOS apps and command-line tools. | |
memory_cache_warning_mb | number | Peak memory above this value suggests cache release recommendations. |
memory_critical_mb | number | Peak memory above this value is critical. |
memory_warning_mb | number | Peak memory above this value is a warning. |
output_dir | Optional directory for generated artifacts. A run-specific subdirectory is created inside it. | |
pid | Attach to a running process by PID. | |
process_name | Attach to a running process by name. | |
time_limit_seconds | integer | Recording duration in seconds. |
analyze_allocations_trace
Analyze an existing Allocations .trace bundle.
| Parameter | Type | Description |
|---|---|---|
trace_path * | string | Absolute path to the .trace bundle. |
bundle_id | string | Target name used in the report. |
memory_cache_warning_mb | number | Peak memory above this value suggests cache release recommendations. |
memory_critical_mb | number | Peak memory above this value is critical. |
memory_warning_mb | number | Peak memory above this value is a warning. |
analyze_leaks
Record a Leaks trace and report leaks with retain cycle hints when xctrace exports leak details.
| Parameter | Type | Description |
|---|---|---|
all_processes | boolean | Record all processes instead of launching or attaching to one target. |
bundle_id | App bundle ID for simulator/device launch, e.g. com.mycompany.myapp. | |
device_id | Optional simulator UUID or physical device ID. Omit for host macOS profiling. | |
dry_run | boolean | Return the xctrace command without recording. |
keep_trace | boolean | Keep generated trace and XML artifacts and include their paths in the report. |
launch_args | Optional shell-style arguments passed after launch_path. | |
launch_path | Executable or .app path to launch, useful for macOS apps and command-line tools. | |
leak_critical_count | integer | Leak count above this value is critical. |
output_dir | Optional directory for generated artifacts. A run-specific subdirectory is created inside it. | |
pid | Attach to a running process by PID. | |
process_name | Attach to a running process by name. | |
time_limit_seconds | integer | Recording duration in seconds. |
analyze_leaks_trace
Analyze an existing Leaks .trace bundle.
| Parameter | Type | Description |
|---|---|---|
trace_path * | string | Absolute path to the .trace bundle. |
bundle_id | string | Target name used in the report. |
leak_critical_count | integer | Leak count above this value is critical. |
analyze_time_profiler
Record a Time Profiler trace and report CPU hot methods.
| Parameter | Type | Description |
|---|---|---|
all_processes | boolean | Record all processes instead of launching or attaching to one target. |
bundle_id | App bundle ID for simulator/device launch, e.g. com.mycompany.myapp. | |
device_id | Optional simulator UUID or physical device ID. Omit for host macOS profiling. | |
dry_run | boolean | Return the xctrace command without recording. |
dsym_path | Optional path to a .dSYM bundle (or plain Mach-O) used to resolve raw-address frames (release builds with stripped symbols). When set, the report includes a Symbolication section with resolved/unresol… | |
hang_threshold_ms | integer | Main-thread inter-sample gap (ms) above which the gap is counted as a candidate stall. Default 250 mirrors typical hang-instrument settings. |
keep_trace | boolean | Keep generated trace and XML artifacts and include their paths in the report. |
launch_args | Optional shell-style arguments passed after launch_path. | |
launch_path | Executable or .app path to launch, useful for macOS apps and command-line tools. | |
method_critical_ms | number | Hot method self-time above this value is critical. |
method_warning_ms | number | Hot method self-time above this value is a warning. |
output_dir | Optional directory for generated artifacts. A run-specific subdirectory is created inside it. | |
pid | Attach to a running process by PID. | |
process_name | Attach to a running process by name. | |
scope_end_ms | Optional inclusive upper bound (ms since trace start) for sample analysis. Omit or set to 0 to extend to the end of the trace. | |
scope_start_ms | Optional inclusive lower bound (ms since trace start) for sample analysis. Use with `scope_end_ms` to zoom into a specific window (e.g. a jank around second 12). | |
time_limit_seconds | integer | Recording duration in seconds. |
total_critical_ms | number | Average CPU load at or above this many CPU-active milliseconds per wall-clock second is critical. |
total_good_ms | number | Average CPU load below this many CPU-active milliseconds per wall-clock second is good. |
user_binaries | string | Comma-separated binary names that count as 'user code' for the user-methods view (e.g. `MyApp,MyAppKit`). Empty disables the user-methods section. |
analyze_time_profiler_trace
Analyze an existing .trace bundle recorded with the Time Profiler template.
| Parameter | Type | Description |
|---|---|---|
trace_path * | string | Absolute path to the .trace bundle. |
bundle_id | string | Target name used in the report. |
dsym_path | Optional path to a .dSYM bundle (or plain Mach-O) used to resolve raw-address frames (release builds with stripped symbols). When set, the report includes a Symbolication section with resolved/unresol… | |
hang_threshold_ms | integer | Main-thread inter-sample gap (ms) above which the gap is counted as a candidate stall. Default 250 mirrors typical hang-instrument settings. |
method_critical_ms | number | Hot method self-time above this value is critical. |
method_warning_ms | number | Hot method self-time above this value is a warning. |
scope_end_ms | Optional inclusive upper bound (ms since trace start) for sample analysis. Omit or set to 0 to extend to the end of the trace. | |
scope_start_ms | Optional inclusive lower bound (ms since trace start) for sample analysis. Use with `scope_end_ms` to zoom into a specific window (e.g. a jank around second 12). | |
total_critical_ms | number | Average CPU load at or above this many CPU-active milliseconds per wall-clock second is critical. |
total_good_ms | number | Average CPU load below this many CPU-active milliseconds per wall-clock second is good. |
user_binaries | string | Comma-separated binary names that count as 'user code' for the user-methods view (e.g. `MyApp,MyAppKit`). Empty disables the user-methods section. |
analyze_network
Record a Network trace and report slow requests and transfer sizes.
| Parameter | Type | Description |
|---|---|---|
all_processes | boolean | Record all processes instead of launching or attaching to one target. |
bundle_id | App bundle ID for simulator/device launch, e.g. com.mycompany.myapp. | |
device_id | Optional simulator UUID or physical device ID. Omit for host macOS profiling. | |
dry_run | boolean | Return the xctrace command without recording. |
keep_trace | boolean | Keep generated trace and XML artifacts and include their paths in the report. |
launch_args | Optional shell-style arguments passed after launch_path. | |
launch_path | Executable or .app path to launch, useful for macOS apps and command-line tools. | |
output_dir | Optional directory for generated artifacts. A run-specific subdirectory is created inside it. | |
pid | Attach to a running process by PID. | |
process_name | Attach to a running process by name. | |
request_critical_ms | number | Request duration above this value is critical. |
request_warning_ms | number | Request duration above this value is a warning. |
slow_request_critical_count | integer | Slow request count above this value is critical. |
time_limit_seconds | integer | Recording duration in seconds. |
transfer_warning_mb | number | Transferred data above this value adds a transfer-size recommendation. |
analyze_network_trace
Analyze an existing .trace bundle recorded with the Network template.
| Parameter | Type | Description |
|---|---|---|
trace_path * | string | Absolute path to the .trace bundle. |
bundle_id | string | Target name used in the report. |
request_critical_ms | number | Request duration above this value is critical. |
request_warning_ms | number | Request duration above this value is a warning. |
slow_request_critical_count | integer | Slow request count above this value is critical. |
transfer_warning_mb | number | Transferred data above this value adds a transfer-size recommendation. |
compare_launch_traces
Compare two App Launch .trace bundles and report launch-time deltas.
| Parameter | Type | Description |
|---|---|---|
baseline_trace_path * | string | Absolute path to the baseline .trace bundle. |
candidate_trace_path * | string | Absolute path to the candidate .trace bundle. |
bundle_id | string | Target name used in the report. |
launch_critical_ms | number | Launch time at or above this value is reported as critical. |
launch_good_ms | number | Launch time below this value is reported as good. |
offender_critical_ms | number | Launch offender self-time above this value is critical. |
offender_warning_ms | number | Launch offender self-time above this value is a warning. |
compare_memory_traces
Compare two Allocations .trace bundles and report memory deltas.
| Parameter | Type | Description |
|---|---|---|
baseline_trace_path * | string | Absolute path to the baseline .trace bundle. |
candidate_trace_path * | string | Absolute path to the candidate .trace bundle. |
bundle_id | string | Target name used in the report. |
memory_cache_warning_mb | number | Peak memory above this value suggests cache release recommendations. |
memory_critical_mb | number | Peak memory above this value is critical. |
memory_warning_mb | number | Peak memory above this value is a warning. |
compare_cpu_traces
Compare two Time Profiler .trace bundles and report CPU hot-method deltas.
| Parameter | Type | Description |
|---|---|---|
baseline_trace_path * | string | Absolute path to the baseline .trace bundle. |
candidate_trace_path * | string | Absolute path to the candidate .trace bundle. |
bundle_id | string | Target name used in the report. |
method_critical_ms | number | Hot method self-time above this value is critical. |
method_warning_ms | number | Hot method self-time above this value is a warning. |
total_critical_ms | number | Average CPU load at or above this many CPU-active milliseconds per wall-clock second is critical. |
total_good_ms | number | Average CPU load below this many CPU-active milliseconds per wall-clock second is good. |