Skip to main content
Glama

Sample CPU by thread

sample_cpu

Profiles a running app's threads for a few seconds and reports which one is hot - UI/main, JS, or other. Use it to find CPU-heavy threads during React Native debugging.

Instructions

Profile the running app's threads for a few seconds and report which one is hot — the UI/main thread, the JS thread, or something else. iOS simulator: macOS sample, with native call-graph frames. Android: top -H, per-thread %CPU only (no frames).

Input Schema

NameRequiredDescriptionDefault
app_idNo
deviceNo
duration_sNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.6/5.0
Behavior3/5

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

With no annotations, the description carries the full burden and does disclose valuable platform-specific behavior: macOS `sample` with native call-graph frames on iOS simulator versus `top -H` giving only per-thread %CPU on Android. It also implies a short fixed sampling window. However, it omits prerequisites (app running, permissions), failure modes on unsupported platforms, and whether sampling blocks other calls.

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?

Two sentences, front-loaded with the purpose and outcome, followed by the platform-specific mechanism. No filler, and the em-dash structure keeps the hot-thread enumeration scannable.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-annotation, no-output-schema tool, the description does well on explaining what comes back and how it differs by platform, but it leaves the parameter surface and prerequisites undocumented, which is significant given three optional parameters at 0% schema coverage.

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

Parameters2/5

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

Schema coverage is 0%, so the description must compensate for all three parameters, yet it never names app_id, device, or duration_s. 'For a few seconds' loosely hints at a duration and the platform branches hint at device, but app_id is entirely unexplained and no defaults or accepted values are given for a tool where every parameter is optional.

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 (profile) and resource (running app's threads) with the concrete outcome: identifying the hot thread among UI/main, JS, or other. This clearly distinguishes it from siblings like profile_js and profile_renders, which target JS work or renders rather than CPU-per-thread.

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

Usage Guidelines3/5

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

Usage is implied by the outcome ('report which one is hot'), but the description never says when to pick this over profile_js or profile_renders, nor what prerequisites exist (does the app need to be running/foregrounded?). The agent must infer the selection criteria.

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