Skip to main content
Glama

native-profiler-start

Starts native profiling on an iOS or Android app to capture CPU, hangs, jank, memory growth, or leaks so you can reproduce an issue and stop the recording while the app runs.

Instructions

Start native profiling. Instruments records CPU, hangs, and leaks on iOS. Perfetto records CPU, jank, and memory growth on Android. Start the target app first for an attach recording. Wait for this call to return before reproducing the scenario, then call native-profiler-stop while the app is still running. On iOS and Android, a warning names apps whose timings may be affected by native network capture (started by network-capture-start).

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": {
      "device_id": "<device_id>"
    },
    "name": "native-profiler-start"
  }
}

Input Schema

NameRequiredDescriptionDefault
device_idYesTarget device id from `list-devices` (iOS UDID or Android serial).
app_processNoiOS: the CFBundleExecutable or display name of the app to profile. Android: the app's package name. If omitted, auto-detects the foreground app; set it only if auto-detection picks the wrong app.
template_pathNoiOS only. Path to an Instruments .tracetemplate file, or the name of a built-in template such as "Time Profiler" (defaults to the bundled Argent template).
malloc_stack_loggingNoiOS only. Enable allocation stacks from app launch. Restarts the app, clears its current state, and adds CPU and memory overhead. Leave it off for CPU and hang timing. On iOS, attach recordings typically lack allocation stacks. The all-processes capture (including ARGENT_IOS_CAPTURE=all-processes) rejects this option and records no leaks.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • changedInput schema / properties / app_process / description
      Previous value: -"iOS: the CFBundleExecutable or display name of the app to profile. Android: the app's package name. If omitted, auto-detects the currently running foreground app. Only provide this if auto-detection picks the wrong app."New value: +"iOS: the CFBundleExecutable or display name of the app to profile. Android: the app's package name. If omitted, auto-detects the foreground app; set it only if auto-detection picks the wrong app."
    • changedInput schema / properties / malloc_stack_logging / description
      Previous value: -"iOS-only. When true, cold-launches the app under the profiler with Malloc Stack Logging enabled so memory leaks carry an allocation backtrace (responsible frame + library). Without it, leaks are still detected but unattributable — Instruments reports '<Call stack limit reached>'. Trade-offs: this RESTARTS the app (current state is lost), adds memory/CPU overhead, and makes the app noticeably slow to launch (every startup allocation records a backtrace), so leave it off for pure CPU/hang profiling. Requires a non-degraded Xcode: on Xcode 26.4 and later the cold-launch path is broken, so the call is rejected up front (re-run without the flag, or set ARGENT_IOS_CAPTURE=device to override if the device path works on your host). ARGENT_IOS_CAPTURE=all-processes — e.g. exported globally for the normal capture path — also rejects this flag up front, since that fallback cannot cold-launch; unset it (or set it to device) first. Ignored on Android."New value: +"iOS only. Enable allocation stacks from app launch. Restarts the app, clears its current state, and adds CPU and memory overhead. Leave it off for CPU and hang timing. On iOS, attach recordings typically lack allocation stacks. The all-processes capture (including ARGENT_IOS_CAPTURE=all-processes) rejects this option and records no leaks."
    • changedInput schema / properties / template_path / description
      Previous value: -"iOS-only: path to an Instruments .tracetemplate file (defaults to bundled Argent template). Ignored on Android."New value: +"iOS only. Path to an Instruments .tracetemplate file, or the name of a built-in template such as \"Time Profiler\" (defaults to the bundled Argent template)."
  2. Changed1 schema field changedv0.22.0
    • addedInput schema / properties / device_id / minLength
      Added value: +1
  3. Changed1 schema field changedv0.16.0
    • addedInput schema / properties / malloc_stack_logging
      Added value: +{
      +  "description": "iOS-only. When true, cold-launches the app under the profiler with Malloc Stack Logging enabled so memory leaks carry an allocation backtrace (responsible frame + library). Without it, leaks are still detected but unattributable — Instruments reports '<Call stack limit reached>'. Trade-offs: this RESTARTS the app (current state is lost), adds memory/CPU overhead, and makes the app noticeably slow to launch (every startup allocation records a backtrace), so leave it off for pure CPU/hang profiling. Requires a non-degraded Xcode: on Xcode 26.4 and later the cold-launch path is broken, so the call is rejected up front (re-run without the flag, or set ARGENT_IOS_CAPTURE=device to override if the device path works on your host). ARGENT_IOS_CAPTURE=all-processes — e.g. exported globally for the normal capture path — also rejects this flag up front, since that fallback cannot cold-launch; unset it (or set it to device) first. Ignored on Android.",
      +  "type": "boolean"
      +}
  4. First observedv0.15.0

TDQS

A4.1/5.0
Behavior3/5

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

No annotations are supplied, so the description must carry the behavioral load, and it does well on platform differences, the attach-recording requirement, and the network-capture timing warning. However, it never states what is returned (a session handle?), how long a recording can run, or what permissions/entitlements are needed, and the mutation-like side effects are only described inside the schema for malloc_stack_logging.

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?

Front-loaded with purpose, then workflow order, then the caveat; every sentence carries information. It is on the dense side with four packed sentences, but nothing is redundant padding.

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 four-parameter start tool with no annotations and no output schema, the description covers purpose, platform behavior, ordering constraints, and a key hazard. The main remaining gap is the return value or session lifecycle, which the agent must infer from the instruction to wait before stopping.

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

Parameters3/5

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

Schema description coverage is 100%, so every parameter already carries a detailed description, and the tool description adds no parameter-level meaning of its own beyond naming network-capture-start as a timing influence. Baseline 3 is appropriate when the schema does all the semantic work.

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?

States a specific verb and resource ("Start native profiling") and immediately scopes it by platform: Instruments on iOS for CPU/hangs/leaks, Perfetto on Android for CPU/jank/memory growth. The word "native" plus the per-platform engine names distinguish it from the React-profiler siblings without needing to name them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives explicit prerequisites and sequencing: launch the target app first for an attach recording, wait for this call to return, reproduce the scenario, then call native-profiler-stop while the app is still running. It also flags an interaction hazard – apps affected by native network capture started via network-capture-start – which functions as a when-to-be-careful rule.

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