Skip to main content
Glama

fit_box_to_text

Creates or updates a rounded-rectangle background behind a text layer, sized to its bounds plus padding; live-links to text edits in expression mode or bakes static values.

Instructions

Create (or update) a rounded-rectangle background shape that tracks a text layer's bounds + padding, placed directly BEHIND the text. mode="expression" (default) live-links the box Size + Position to the text's sourceRectAtTime every frame, so the box follows edits and animation; mode="bake" computes once at the current comp time and sets static values. padding is a number (all sides), [x,y], or [left,top,right,bottom] px. corner = rounded-corner radius. color (hex "#rrggbb"/"#rgb" or [r,g,b(,a)], 0–1 or 0–255, auto-normalized) + opacity (0–100) style the fill (default black). Pass boxLayer to update an existing box instead of creating a new one. Returns { boxLayer, mode, expressionError }.

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": {
      "textLayer": "<textLayer>"
    },
    "name": "fit_box_to_text"
  }
}

Input Schema

NameRequiredDescriptionDefault
compNoComp: name (string), or { id: N } for duplicate-name-safe stable-id addressing. Defaults to active comp.
modeNoexpression = live-linked; bake = static at current time.expression
nameNoName for a newly created box (default "<text> BG").
colorNoFill color: hex or [r,g,b(,a)]. Default black.
cornerNoRounded-corner radius (px).
opacityNoFill opacity %. Default 100.
paddingNopx: number (all sides), [x,y], or [left,top,right,bottom].
boxLayerNoExisting box layer to update (name, 1-based index, or { id: N }). Omit to create a new one.
instanceNoTarget a specific AE when more than one is connected (e.g. "2026", "2025", or a major like "26"). Omit when only one AE is open — see list_instances.
textLayerYesLayer: name (string), 1-based index (integer), or { id: N } for duplicate-name-safe stable-id addressing.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.0

TDQS

A4.3/5.0
Behavior4/5

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

No annotations are supplied, so the description carries the full burden and does substantial work: it discloses the live-link semantics of expression mode, the one-shot nature of bake, the create-vs-update branching on boxLayer, and the return shape { boxLayer, mode, expressionError }. It stops short of stating side effects on an existing box (whether styling/keyframes are overwritten on update) or what conditions produce expressionError.

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 purpose, then modes, then parameters, then return value – a sensible order. It is dense and mostly earns its length, though the padding-format and color-format sentences partially duplicate what the schema descriptions already state.

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 10-parameter tool with no output schema, the description covers modes, styling, update-vs-create, and the returned object, which is close to complete. Remaining gaps are edge-case behavior: missing/renamed text layers, existing effects on the updated box, and how expressionError should be handled.

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 the baseline is 3, but the description adds real meaning: color values are auto-normalized across 0–1 and 0–255 ranges and accept hex or array forms, padding accepts four shapes, default name is "<text> BG", and the fill defaults to black. This goes beyond restating the schema.

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+resource pair (create/update a rounded-rectangle background shape) plus the defining behavior: it tracks a text layer's bounds + padding and sits directly BEHIND the text. That is enough to separate it from generic shape-creation siblings like add_shape without opening either 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?

Gives explicit option-selection guidance: mode="expression" for live-following edits/animation vs mode="bake" for static values at current time, and 'Pass boxLayer to update an existing box instead of creating a new one.' Missing are explicit prerequisites (text layer must exist, what happens if it isn't found) and any direct comparison to sibling tools.

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

Deploy Server

Other Tools