Skip to main content
Glama

react-profiler-analyze

Analyze stored React profiling data to generate a markdown performance report that identifies hot commits, render cascades, root causes, and top components for debugging slow renders.

Instructions

Analyze stored profiling data and return a markdown performance report. Returns { report, reportFile, hotCommitsTotal, hotCommitsShown, sessionFiles }. The report is structured around hot React commits (≥16ms absolute floor) with per-commit render cascades, root cause identification, and a top components table. Raw profiling data is saved to disk with a unique session timestamp for later reload via profiler-load. After presenting the report, ask the user whether to investigate further (drill-down with profiler-cpu-query / profiler-commit-query) or implement fixes and re-profile for comparison. Use when the profiling session is complete and you need to interpret the collected data. Fails if react-profiler-stop has not been called or no profiling data is stored.

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>",
      "project_root": "<project_root>"
    },
    "name": "react-profiler-analyze"
  }
}

Input Schema

NameRequiredDescriptionDefault
portNoMetro port. Omit it to use this device's port (8081 by default). Ignored for Chromium, whose CDP port is in device_id. Range: 1 to 65535.
platformNoPlatform for source lookup when the recording does not identify one.
device_idYesDevice ID used to record or load the React profile.
rn_versionNoReact Native version (e.g. "0.73.4"). Default: "unknown".unknown
annotationsNoUser actions to annotate the report's commits with: each commit shows the action that preceded it.
project_rootYesAbsolute path to the RN project root for session context detection

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed7 schema fields changed
    • changedInput schema / properties / annotations / description
      Previous value: -"Optional list of user actions with their time offset from profiling start. Compute offsetMs = tapTimestampMs - startedAtEpochMs, where tapTimestampMs comes from the tap/swipe tool return value and startedAtEpochMs comes from react-profiler-start return value."New value: +"User actions to annotate the report's commits with: each commit shows the action that preceded it."
    • changedInput schema / properties / annotations / items / properties / offsetMs / description
      Previous value: -"Milliseconds since profiling started. Compute as: tapTimestampMs - startedAtEpochMs, using the timestampMs returned by tap/swipe and the startedAtEpochMs returned by react-profiler-start."New value: +"Milliseconds since profiling started: tapTimestampMs - startedAtEpochMs, where tapTimestampMs is the timestampMs a tap/swipe tool returned and startedAtEpochMs is the value react-profiler-start returned."
    • changedInput schema / properties / device_id / description
      Previous value: -"Device logicalDeviceId from debugger-connect (iOS simulator UDID or Android logicalDeviceId)."New value: +"Device ID used to record or load the React profile."
    • removedInput schema / properties / platform / default
      Removed value: -"ios"
    • changedInput schema / properties / platform / description
      Previous value: -"Target platform"New value: +"Platform for source lookup when the recording does not identify one."
    • changedInput schema / properties / port / description
      Previous 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."New value: +"Metro port. Omit it to use this device's port (8081 by default). Ignored for Chromium, whose CDP port is in device_id. Range: 1 to 65535."
    • changedInput schema / properties / rn_version / description
      Previous value: -"React Native version (e.g. \"0.73.4\")"New value: +"React Native version (e.g. \"0.73.4\"). Default: \"unknown\"."
  2. 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"
  3. First observedv0.15.0

TDQS

A4.6/5.0
Behavior5/5

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

No annotations are supplied, so the description carries the full behavioral burden and does so: it discloses a side effect (raw profiling data written to disk with a unique session timestamp), the exact failure precondition, the reporting threshold (hot commits ≥16ms), and what the report contains. It even prescribes the post-call interaction pattern (ask the user before drilling down), which is behavior an agent could not infer elsewhere.

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?

It is front-loaded with purpose and return shape, then moves to report structure, side effects, follow-up flow, and failure modes — logical ordering with no filler sentences. It runs long at roughly seven sentences, and the return-shape enumeration plus some report-structure detail could be compressed without losing meaning.

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?

There is no output schema, so the description must explain returns, and it names the fields (report, reportFile, hotCommitsTotal, hotCommitsShown, sessionFiles) and their shaping. For a six-parameter analysis tool with a disk side effect and a prerequisite, nothing an agent needs to call it correctly is missing.

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 including the nested annotations offsetMs formula is already documented in the schema; the description adds no parameter-level meaning. It does not, for example, explain that passing annotations changes which actions appear beside each commit, even though such context exists. Baseline 3 applies when the schema does the heavy lifting.

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 opening sentence gives a specific verb and resource ('Analyze stored profiling data and return a markdown performance report'), and the 'React' framing plus the mention of profiler-load/profiler-cpu-query separates it from native-profiler-analyze. An agent can identify this as the post-session interpretation step without opening any schema.

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?

It states the triggering condition explicitly ('Use when the profiling session is complete and you need to interpret the collected data'), gives a hard prerequisite ('Fails if react-profiler-stop has not been called or no profiling data is stored'), and routes the agent to specific follow-up tools (profiler-cpu-query / profiler-commit-query for drill-down, re-profile for comparison). When-to-use, when-not, and alternatives are all present.

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