Skip to main content
Glama

tv_profile

Record a JS CPU profile on a Smart TV and read memory/layout metrics. Start sampling, exercise the UI, then stop to get a .cpuprofile and before/after metric diffs to catch leaks and slowdowns.

Instructions

Record a JS CPU profile on the device, and/or read memory & layout metrics. action:"start" begins sampling, then do the thing you want to measure (tv_press / tv_goto / a scroll), then action:"stop" writes a .cpuprofile file (open it in Chrome DevTools -> Performance -> Load profile) and returns a top-N summary of self time by function and by file. start and stop each also take a Performance.getMetrics reading, so stop reports before/after/diff per metric (JSHeapUsedSize, Nodes, JSEventListeners, LayoutCount, RecalcStyleCount, cumulative Duration counters) — that is how you catch growth the CPU profile cannot see. action:"metrics" is just that reading, with no recording. On a minified production build pass sourceMap (the app.js.map of THAT build) to get readable names. The CPU profile works on the whole park (Profiler exists down to Chrome 38); metrics need Chromium 60+ (tizen55, pc) — on webOS 3 action:"metrics" fails with a clear message, while start/stop still return the profile with metrics:null and a warning.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNostop: where to write the .cpuprofile. Defaults to a scratch path.
topNNostop: how many functions/files to report (default 20).
actionYesstart a recording, stop it and get the result, or just read the metrics right now.
deviceNoDevice id from devices.json. Omit to use the default device.
sourceMapNostop: path to the .map of the build running on the device. Only the top-N frames are de-minified; a map that fails to load degrades to a warning.
collectGarbageNoForce a GC right before this reading (default false). Turn it on for leak hunting — on stop it makes the heap diff show what is really retained instead of garbage not collected yet. It costs a GC pause, which is why it is off by default inside a recording.
samplingIntervalUsNostart: sampling interval in microseconds (default 1000). Raise it (e.g. 4000) for long recordings on a weak TV, where sampling itself costs.
Behavior5/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 so thoroughly: it discloses side effects (writes a .cpuprofile file), failure behavior on unsupported platforms (metrics fails with a clear message, start/stop return metrics:null with a warning), GC side effects, and degradation of sourceMap handling. No contradictions with structured data.

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 long but every sentence earns its place: overview front-loads the purpose, then action behavior, output format, sourceMap handling, platform caveats, and parameter advice. There is no redundancy or filler; the structure follows a logical flow from what → how → edge cases.

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?

With no output schema, the description fully covers return values: the top-N self-time summary, before/after/diff metrics, and the metrics:null + warning case. It also covers error modes, parameter interactions, and usage patterns, making the tool fully understandable without external references.

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

Parameters5/5

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

Even though the schema covers 100% of parameters, the description adds substantial context beyond the schema: the action enum values are explained in narrative, path/topN/sourceMap are tied to the stop action, collectGarbage is recommended for leak hunting with a GC-pause tradeoff, and samplingIntervalUs is advised for weak devices. This exceeds the schema's basic descriptions.

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+resource pair: 'Record a JS CPU profile on the device, and/or read memory & layout metrics.' It clearly distinguishes from sibling tools like tv_heap by focusing on CPU profiling and Performance metrics, and the three actions (start/stop/metrics) are precisely defined.

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?

Explicit workflow is given: 'action:"start" begins sampling, then do the thing you want to measure (tv_press / tv_goto / a scroll), then action:"stop"'. It also explains when to use the metrics action to catch growth invisible to CPU profiles, and provides platform-compatibility guidance for when metrics will fail.

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

Install Server

Other Tools

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/Ediand11/tv-debug-mcp'

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