Skip to main content
Glama

profiler-cpu-query

Query Hermes CPU profiles with targeted modes to identify hotspots, inspect CPU over a time range, trace call trees, or aggregate CPU by component.

Instructions

Query Hermes CPU profile data with targeted modes for iterative investigation. Requires react-profiler-stop (and ideally react-profiler-analyze) to have been called first. Modes:

  • top_functions: Global CPU hotspots ranked by self-time. Optional time_window_ms to filter.

  • time_window: CPU breakdown for a specific time range (e.g. during a slow commit or hang).

Self-times are the summed sampling intervals of the samples that landed in the window, so they measure sampled coverage rather than the window's width and do not change if you widen the query. Every table states how many samples it covers and how much of that was idle.

  • call_tree: For a given function_name, show its callees and optionally callers.

  • component_cpu: For a given component_name, aggregate CPU activity across all its commits. Use when investigating JS CPU hotspots or correlating CPU cost with specific components. Returns a markdown table of CPU hotspots, call tree, or per-component CPU breakdown. Fails if no CPU profile is stored — run react-profiler-stop first.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeYesQuery mode: top_functions (global hotspots), time_window (CPU in a time range), call_tree (callers/callees of a function), component_cpu (CPU during a component's commits)
portNoMetro server port. Optional — omit it to use this device's port, 8081 by default. Ignored for Chromium, whose CDP port is encoded in device_id.
top_nNoNumber of results to return (default 15)
device_idYesDevice logicalDeviceId from debugger-connect (iOS simulator UDID or Android logicalDeviceId).
function_nameNoFunction name for call_tree mode
component_nameNoComponent name for component_cpu mode
time_window_msNoTime window filter for time_window mode (ms since profiling started — the same clock profiler-commit-query prints)
include_callersNoFor call_tree mode: also show callers of the function

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv0.25.0
    • removedInput schema / properties / port / default
      Removed value: -8081
    • changedInput schema / properties / port / description
      Previous value: -"Metro server port"New value: +"Metro server port. Optional — omit it to use this device's port, 8081 by default. Ignored for Chromium, whose CDP port is encoded in device_id."
    • addedInput schema / properties / port / maximum
      Added value: +65535
    • addedInput schema / properties / port / minimum
      Added value: +1
    • changedInput schema / properties / port / type
      Previous value: -"number"New value: +"integer"
  2. Changed4 schema fields changedv0.22.0
    • addedInput schema / properties / device_id / minLength
      Added value: +1
    • changedInput schema / properties / time_window_ms / description
      Previous value: -"Time window filter for time_window mode (ms, performance.now clock)"New value: +"Time window filter for time_window mode (ms since profiling started — the same clock profiler-commit-query prints)"
    • changedInput schema / properties / time_window_ms / properties / end / description
      Previous value: -"End of window in ms (performance.now clock)"New value: +"End of window in ms since profiling started — the same clock profiler-commit-query prints"
    • changedInput schema / properties / time_window_ms / properties / start / description
      Previous value: -"Start of window in ms (performance.now clock)"New value: +"Start of window in ms since profiling started — the same clock profiler-commit-query prints"
  3. First observedv0.15.0

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations provided, the description carries the full behavioral burden and does so thoroughly. It defines self-times as summed sampling intervals, explains that widening the query window does not change values, states that every table reports sample count and idle portion, and warns that the tool fails if no CPU profile is stored. This goes well beyond what the schema alone provides.

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?

The description is front-loaded with the core purpose and prerequisite, then uses a compact bulleted list for the four modes. The length is justified by the tool's complexity, and every sentence carries operational information such as sampling semantics, output format, or failure behavior.

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?

The description covers prerequisites, failure mode, output format, mode semantics, and the sampling caveat about self-times. Since there is no output schema, the explicit statement that it returns a markdown table of CPU hotspots, call tree, or per-component CPU breakdown is necessary and sufficient.

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 100%, so the baseline is 3. The description adds useful semantic context such as using time_window for a slow commit or hang, component_cpu aggregating across all commits, and the optional time_window_ms filter on top_functions. It mostly reaffirms schema descriptions rather than deeply enriching every parameter, but the added mode-level guidance justifies a score above baseline.

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 description opens with a specific verb and resource: 'Query Hermes CPU profile data' and then enumerates four concrete query modes. This clearly distinguishes the tool from sibling profiler, render, and device-control tools by scoping it to Hermes CPU profile investigations.

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 description explicitly states the prerequisite that react-profiler-stop (and ideally react-profiler-analyze) must have been called first, and it gives a clear use case: 'Use when investigating JS CPU hotspots or correlating CPU cost with specific components.' It does not explicitly name sibling alternatives or when-not-to-use conditions, so it stops short of a 5.

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