Skip to main content
Glama

Measure frames, draw calls and GPU resources

three_perf

Measure page draw calls, triangles, shader programs, geometries, textures, JS heap, and frame-time percentiles. Check budgets and compare results with the prior run to validate performance changes.

Instructions

Measure a page for some seconds (after optional steps): draw calls and triangles per frame, shader programs, geometries and textures (exact, the same on every GPU), JS heap, and frame-time percentiles with the slowest frames and their cause (shader compile, GPU upload, draw calls, JS). Checks budget and compares with the last run of the same name (kept in .threesmith/perf/). Frame times come from software rendering: use them before/after on the same machine, not as real fps. Measure before and after every performance change.

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": {
      "target": "<target>"
    },
    "name": "three_perf"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameNoname of the measurement for the comparison (default: the entry file)
rootNofolder to serve when the page needs files above its own folder
saveNokeep this run for the next comparison (default true)
waitNo
entryNo
stepsNoSteps in order: {"type":"click","selector":"#start"} or {x,y}, {"type":"press","key":"Space"}, {"type":"hold","key":"ArrowRight","ms":300}, {"type":"drag","from":[x,y],"to":[x,y]}, {"type":"wheel","deltaY":200}, {"type":"wait","ms":500}, {"type":"wait-for","selector":"canvas"}, {"type":"frames","n":10}, {"type":"eval","js":"app.start()"}, {"type":"until","js":"$('ball').position.y < 0","timeout":5000}.
widthNo
budgetNolimits: frameMs (p95), calls and triangles (max per frame), textures, geometries, programs
heightNo
ignoreNo
targetYesFolder with the page (index.html), or the http(s) URL of a running dev server.
webgpuNo
secondsNohow long to measure (default 5)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.0

TDQS

A3.9/5.0
Behavior4/5

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

Beyond the annotations (readOnlyHint=false, openWorldHint=true), the description discloses real behavioral facts: the run takes seconds, it executes optional interaction steps first, it writes a snapshot into .threesmith/perf/ keyed by name for later comparison, and it evaluates a budget. The key caveat that timings come from software rendering and are not real fps is exactly the kind of limitation an agent needs and cannot get from annotations. It does not cover failure modes or what happens when the comparison baseline is missing.

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?

The output list is front-loaded in the first sentence, then persistence/comparison, then the interpretation caveat, then the workflow rule — a sensible order. Sentences are dense and the parenthetical cause list is useful, though the first sentence is a long run-on enumerating many things at once.

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

Completeness4/5

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

For a 13-parameter tool with nested `steps`/`budget` objects and no output schema, the description adequately pre-announces what a run yields and what side effects occur. Gaps remain around result format and how budget violations are reported, which an agent would want since no output schema exists.

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?

At 54% schema coverage across 13 parameters, the description compensates partially: it explains duration ('some seconds'), the steps flow ('after optional steps'), name-based baseline comparison, and what `budget` limits are checked against. It adds nothing about `ignore`, `webgpu`, `width`/`height`, `root`, `entry`, or `wait`, leaving several parameters with only terse or absent schema text.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific verb ('Measure') and enumerates the exact resources captured: draw calls and triangles per frame, shader programs, geometries, textures, JS heap, and frame-time percentiles with slowest-frame causes. That scope makes it distinguishable from a general inspector or a leak tool in practice, but no sibling is named, so differentiation is inferred rather than stated.

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?

Guidance is explicit on context: 'Measure before and after every performance change,' and it warns the frame times are software-rendered so they are only comparable before/after on the same machine rather than real fps. It stops short of naming when-not-to-use conditions or a specific alternative tool.

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