Skip to main content
Glama

profiler-stack-query

Read-only

Query a native profile to inspect hang CPU stacks, function callers, thread CPU breakdown, or memory leak details for iOS and Android app debugging.

Instructions

Inspect a native profile after native-profiler-analyze or profiler-load. Modes:

  • hang_stacks: Full CPU context during a specific hang (by hang_index).

  • function_callers: Who calls function_name and what it calls.

  • thread_breakdown: CPU time split by thread, optionally filtered.

  • leak_stacks: Memory leak details (iOS only). Requires a trace with leak data.

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>",
      "mode": "<mode>"
    },
    "name": "profiler-stack-query"
  }
}

Input Schema

NameRequiredDescriptionDefault
modeYesQuery mode; see Modes in the tool description.
top_nNoMax results to return. Default: 15. Must be greater than 0.
threadNoThread filter. thread_breakdown: case-insensitive substring match. function_callers: exact raw thread name (e.g. ".blueskyweb.app"), or "main" for the UI thread; omit to search ALL threads (each result is tagged with its thread). Run thread_breakdown first to see the exact raw names.
device_idYesTarget device id from `list-devices` (iOS UDID or Android serial).
hang_indexNo0-based index into the hang list
object_typeNoObject type filter
function_nameNoNative function name

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed10 schema fields changed
    • changedInput schema / properties / device_id / description
      Previous value: -"iOS Simulator UDID or Android serial."New value: +"Target device id from `list-devices` (iOS UDID or Android serial)."
    • changedInput schema / properties / function_name / description
      Previous value: -"Function name for function_callers mode"New value: +"Native function name"
    • changedInput schema / properties / hang_index / description
      Previous value: -"0-based index into the hang list for hang_stacks mode"New value: +"0-based index into the hang list"
    • removedInput schema / properties / hang_index / maximum
      Removed value: -9007199254740991
    • removedInput schema / properties / hang_index / minimum
      Removed value: --9007199254740991
    • changedInput schema / properties / hang_index / type
      Previous value: -"integer"New value: +[
      +  "integer",
      +  "null"
      +]
    • changedInput schema / properties / mode / description
      Previous value: -"Query mode: hang_stacks (full CPU context during a hang), function_callers (who calls a native function), thread_breakdown (CPU split by thread), leak_stacks (leak details by object type)"New value: +"Query mode; see Modes in the tool description."
    • changedInput schema / properties / object_type / description
      Previous value: -"Object type filter for leak_stacks mode"New value: +"Object type filter"
    • changedInput schema / properties / top_n / description
      Previous value: -"Max results to return (default 15)"New value: +"Max results to return. Default: 15. Must be greater than 0."
    • removedInput schema / properties / top_n / maximum
      Removed value: -9007199254740991
  2. Changed1 schema field changedv0.22.0
    • addedInput schema / properties / device_id / minLength
      Added value: +1
  3. First observedv0.15.0

TDQS

A4.2/5.0
Behavior3/5

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

readOnlyHint=true already tells the agent this is a safe read, so the description's job is to add context beyond that; it does so with the prerequisite tools and the leak_stacks platform/data requirement. It says nothing about result volume, truncation via top_n, or what happens when a mode finds no matches, which matters for a query that can span all threads. Decent added context, but not rich.

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

Conciseness5/5

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

Front-loads the purpose in one sentence, then presents the four modes as a tight labeled list with no redundant prose. Every bullet carries a distinct fact (which parameter selects the case, platform limits, data prerequisites).

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 7-parameter, mode-driven tool with no output schema, the description covers prerequisites, mode selection, and platform constraints adequately. The remaining gap is return-shape expectation, which the agent must infer since no output schema exists to document it.

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 coverage is 100%, so the baseline is 3, and the description earns an extra point by tying parameters to modes: hang_index selects a specific hang, function_name drives function_callers, and the thread filter applies to thread_breakdown. That cross-parameter relevance is not fully spelled out in the schema, whose mode field merely points back to the description.

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 ("Inspect a native profile") and enumerates the four query modes with one-line semantics for each, so an agent knows exactly which operation this performs. It also names the two tools that must precede it (native-profiler-analyze, profiler-load), which separates it from the analysis tools in the sibling set.

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?

Gives a clear precondition (call after native-profiler-analyze or profiler-load) and per-mode applicability, including an exclusion: leak_stacks is iOS only and requires a trace with leak data. It stops short of naming a concrete alternative for CPU-related queries, but the when-to-use conditions for each mode are explicit.

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