Skip to main content
Glama

perf

Measures a page's frame time, FPS, draw calls, triangles and asset size against a budget to diagnose stutter and test rendering variants or runtime optimizations.

Instructions

Measures the open page's frame time (fps), draw calls, triangles and asset size against a budget (desktop by default): it is for a frame a reply reports over budget, or a user who asks about performance (stutter, low fps). To find what costs the frame, give variants: each is measured on a fresh page against the baseline, in this one call, with named objects hidden, a pixel ratio, code run with renderer and scene (shadows or antialias off, a material swapped), or a query the page loads with ("noshadow&pr=0.5", for switches the game reads at load); no reopening or reload code needed. Sampling waits until no element covers the canvas (a loading screen), up to 15 s of the page running, and the load line says what it waited for or sampled under. With optimize: true it instead tries the @paprika3d/three-runtime switches one at a time: resolution (lowers the pixel ratio while frames run over budget), defaults (pixel ratio capped at 2, shaders compiled up front, shadow maps redrawn only when a caster moves), instancing (still meshes that share a geometry and material drawn as one), lod (simpler versions of meshes over 10,000 triangles at a distance) and dispose (frees the GPU memory of removed objects). instancing and lod stay only when frames get faster, the others unless they slow frames. A switch is reverted if a saved test that passed without it fails with it, and defaults, instancing and dispose also if they change the picture; a kept resolution or lod that changes it comes with before and after pictures. What it keeps goes in the project's game-runtime.json, which the runtime reads at every load, so it lasts until that file changes; it ends with the final test of game-tests.json when the project has one. On a game without the runtime it changes nothing and says how to import it.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "perf"
  }
}

Input Schema

NameRequiredDescriptionDefault
gameNoThe name the game was opened under with the `open` tool, to act on ("main" by default; a subagent uses its own).
costsNoAlso list the main scene's visible content by named group (an object goes by its nearest named ancestor, as `look` names it): triangles, those casting shadows, draw calls and texture MB, the 12 groups with the most triangles and the rest in one line. Counted, not timed, with no frustum culling; `variants` with `hide` times a group.
budgetNodesktop, mobile, quest, site (a 3D website: first scene frame within 3 s on fast-4g unless `network` says otherwise, 1 MB of script, 4 MB of assets), or limits to override: { frameMs, assetMB, triangles, drawCalls, textureMax, pixelRatioMax, firstSceneFrameMs, scriptMB }.
networkNoAlso time a first visit on this network, in real time with no cache: slow-4g, fast-4g or 3g (Chrome DevTools' presets), broadband (20 Mbps both ways, 40 ms), or { downKbps, upKbps, latencyMs } (upKbps defaults to downKbps). The reply names its numbers and whether a software renderer drew it, and says when the first scene frame came, which bytes came before it by kind (as sent: the harness's own server does not compress, a CDN does) and when an overlay over the canvas went. CPU `throttle` is separate.
optimizeNoTry the runtime switches and keep those that help (above). Of the other fields it takes only `budget`.
throttleNoSlow the page's JavaScript this many times, as on a weak laptop (4 is a typical one); GPU work is not slowed.
variantsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv0.4.5
    • changedInput schema / properties / network / description
      Previous value: -"Also time a first visit on this network (Chrome DevTools' presets), in real time with no cache: when the first scene frame came, which bytes came before it by kind (as sent: the harness's own server does not compress, a CDN does) and when an overlay over the canvas went. CPU `throttle` is separate."New value: +"Also time a first visit on this network, in real time with no cache: slow-4g, fast-4g or 3g (Chrome DevTools' presets), broadband (20 Mbps both ways, 40 ms), or { downKbps, upKbps, latencyMs } (upKbps defaults to downKbps). The reply names its numbers and whether a software renderer drew it, and says when the first scene frame came, which bytes came before it by kind (as sent: the harness's own server does not compress, a CDN does) and when an overlay over the canvas went. CPU `throttle` is separate."
    • removedInput schema / properties / network / enum
      Removed value: -[
      -  "slow-4g",
      -  "fast-4g",
      -  "3g"
      -]
    • changedInput schema / properties / network / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "object"
      +]
    • addedInput schema / properties / optimize
      Added value: +{
      +  "description": "Try the runtime switches and keep those that help (above). Of the other fields it takes only `budget`.",
      +  "type": "boolean"
      +}
  2. First observedv0.2.1

TDQS

A4.4/5.0
Behavior5/5

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

Annotations only declare readOnlyHint=false and openWorldHint=true, and the description adds what matters: sampling waits up to 15 s until no element covers the canvas, `optimize` tries switches one at a time with stated keep/revert rules, results are written to the project's game-runtime.json and persist until that file changes, a final `test` runs, and on a game without the runtime it changes nothing. That is real side-effect disclosure for a mutating tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The opening sentence front-loads purpose well, but the rest is a single dense block of run-on clauses covering variants, sampling, five switches, revert policy and persistence. Much of it is necessary, yet the lack of structure makes it hard to scan.

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 7-parameter mutating tool with no output schema, the description covers return contents (the load line, the reply's network numbers, before/after pictures) and the persistence of changes. Remaining gaps are minor, such as exact result formatting for the default non-optimize path.

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?

With schema coverage at 86% the baseline is 3, but the description adds genuine meaning: `variants` entries are measured on a fresh page against the baseline within one call, with `hide`/`pixelRatio`/`code`/`query` each having a stated effect, and `optimize` accepts only `budget` from the other fields. It also clarifies that `throttle` is CPU-only and separate from `network`.

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?

It names a concrete verb and resource: measures the open page's frame time, draw calls, triangles and asset size against a budget, and explicitly distinguishes the measurement role from the `optimize` mode in the same tool. An agent can tell this is the performance-measurement tool without opening the schema.

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?

It gives clear triggers: a frame a reply reports over budget, or a user asking about stutter or low fps, and it scopes `variants` to isolating the cost of a frame. No sibling alternative is named and no explicit when-not is stated, so it stops short of full routing guidance.

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