Skip to main content
Glama

profiler-cpu-query

Query Hermes CPU profiles to pinpoint JavaScript hotspots, inspect CPU within a time window, trace function callers/callees, or aggregate CPU per component. Returns markdown tables for fast debugging.

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
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. Dates show when Glama detected each change.

  1. 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"
  2. First observedv0.15.0

TDQS

A4.9/5.0
Behavior5/5

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

No annotations are provided, so the description carries the full burden. It discloses a crucial sampling behavior (self-times are summed sampling intervals and do not change when widening a window), states that every table shows covered samples and idle fraction, and notes the fatal failure condition. This goes well beyond a generic description.

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 purpose and prerequisite, then presents modes in a compact bullet-style list, adds the nuanced sampling explanation, and ends with a usage hint and failure condition. Every sentence adds value; no fluff.

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?

For a complex tool with 8 parameters, no output schema, and no annotations, the description is remarkably complete: it explains modes, parameter roles, return format ('markdown table'), preconditions, and failure behavior. The subtle sampling caveat fills a gap that could mislead users into thinking wider windows increase data.

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% and the schema provides detailed per-parameter descriptions. However, the description adds extra semantic context for key parameters beyond the schema: it explains the meaning of time_window_ms (the clock reference 'same clock profiler-commit-query prints') and connects function_name/component_name to their modes. Slight deduction because not every parameter is explicitly tied to a mode in the description (port, top_n), but the schema covers those.

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 states a specific verb ('Query') and resource ('Hermes CPU profile data'), enumerates the four modes (top_functions, time_window, call_tree, component_cpu), and explains what each returns. It clearly distinguishes from sibling profiler tools by scoping to CPU ('CPU profile data', 'CPU hotspots') vs the react-profiler-* / native-profiler-* / profiler-commit-query / profiler-stack-query siblings.

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?

Explicitly states when to use ('Use when investigating JS CPU hotspots or correlating CPU cost with specific components') and names the required prerequisite ('Requires react-profiler-stop (and ideally react-profiler-analyze) to have been called first'). It also warns of failure mode if the prerequisite is not met ('Fails if no CPU profile is stored — run react-profiler-stop first').

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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/software-mansion/argent'

If you have feedback or need assistance with the MCP directory API, please join our Discord server