Skip to main content
Glama

Optimize a .riv file (lossless)

riv_optimize

Shrink a .riv file without changing visual output by removing unreferenced objects and thinning redundant keyframes on linear-only tracks, with dry-run planning.

Instructions

Shrink a .riv without changing its visual output: remove unreferenced objects (dangling easing interpolators, fired-events nothing points to, empty keyframe tracks left over from prior edits) and thin redundant keyframes on strictly-linear-interpolation runs within a tolerance. Only runs where every segment is linear are touched — any run touching hold/cubic easing is left alone, so no easing gets shifted (see keyed_property.cpp semantics: a KeyFrame's interpolationType applies to the segment going INTO the next frame). Colors and id-keyframes (soloActive) are never thinned, only numeric (KeyFrameDouble) tracks. Each step is a boolean that is on by default (set it to false to skip that step), and the run is idempotent/safe to repeat. Use dryRun=true to see the removal/thinning plan without writing anything. Run riv_lint afterwards if in doubt.

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": {
      "path": "<path>"
    },
    "name": "riv_optimize"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesSource .riv path
dryRunNoReport the plan only; don't write anything (default false)
outPathNoOutput path (default: overwrite source)
toleranceNoThinning tolerance as a ratio of each track's own value range (default 0.01 = 1%, conservative)
thinKeyframesNoDouglas-Peucker thin redundant keyframes on linear-only runs (default true)
removeUnreferencedNoRemove unreferenced interpolators/events/empty tracks (default true)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.5.0

TDQS

A4.6/5.0
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 meets it: it names precisely what is destroyed (dangling easing interpolators, fired-events with no referrers, empty keyframe tracks), what is explicitly protected (colors, soloActive id-keyframes, any run touching hold/cubic easing), and why no easing shifts. It also declares idempotency and safety to repeat, plus the dryRun non-destructive path.

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?

Front-loaded with the benefit and the mechanics, and every clause is load-bearing. It is dense and the parenthetical citation of keyed_property.cpp semantics is somewhat academic overhead, but it justifies the linear-run restriction rather than padding.

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?

For a mutating file-rewriting tool with no annotations, no output schema, and an overwrite-by-default outPath, the description covers safety, destructiveness, idempotency, preview mode, and a verification path via riv_lint. There is no output schema to explain, and nothing an agent needs before invoking it is missing.

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?

Schema coverage is 100%, so baseline is 3, but the description adds real semantics beyond the schema: the booleans are a uniform 'on by default, set false to skip' contract, and the tolerance is scoped to linear-only runs so an agent understands it cannot affect eased segments. It does not discuss outPath overwrite behavior or the interaction between thinKeyframes and removeUnreferenced when both are false.

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 concrete verb and resource ('Shrink a .riv') and immediately bounds the claim with 'without changing its visual output', then enumerates the two exact operations (removing unreferenced objects, thinning keyframes on linear runs). No sibling tool does lossless shrinking, and the description makes that unique role unambiguous.

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?

Gives clear operational guidance: each boolean is on by default, set to false to skip, use dryRun=true to preview, and 'Run riv_lint afterwards if in doubt' — an explicit follow-up with a named sibling. It does not name a condition under which a user should skip the tool entirely or prefer a different sibling, which keeps it just short of a 5.

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