Skip to main content
Glama

Fit text to size

fit_text_to_width

Scale a static text layer's font size until its bounds fit a target width and/or height in pixels, with optional min/max limits and anchor re-centering.

Instructions

Scale the font size so the text's bounds fit 'width' and/or 'height' (px, layer space; scale is ignored). Works on static (non-keyframed) text; mixed sizes become one size. Optionally re-centers the anchor point.

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": {
      "layer": "<layer>"
    },
    "name": "fit_text_to_width"
  }
}

Input Schema

NameRequiredDescriptionDefault
compNoComposition name, 'Folder/Name' path, or item id. Omit to use the active composition.
layerYesText layer: 1-based index, name, or {id}.
widthNoTarget width in px.
heightNoTarget height in px (the smaller fit wins when both are given).
maxFontSizeNoUpper limit (default 2000).
minFontSizeNoLower limit (default 1).
centerAnchorNoRe-center the anchor point afterwards.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.2/5.0
Behavior4/5

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

Annotations only declare that this is a non-read-only, non-destructive, closed-world mutation. The description adds meaningful behavior beyond that: the layer scale is ignored, mixed font sizes collapse into a single size, and the anchor can be optionally re-centered — the mixed-size collapse in particular is a side effect an agent must know about before calling.

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?

Three short sentences, front-loaded with the core scaling behavior, followed by constraints and the optional side effect. No filler and no repetition of schema content.

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 mutation with full schema coverage and no output schema, the description covers the essential constraints and side effects. The one gap is that it doesn't say what happens with keyframed layers (error vs. silent ignore) or what the call returns, such as the resulting font size.

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?

Schema coverage is 100%, so every parameter (comp, layer, width, height, maxFontSize, minFontSize, centerAnchor) is already documented, including the 'smaller fit wins' rule. The description only reinforces the fitting behavior and re-centering, adding little beyond the structured fields, so the baseline of 3 applies.

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 states a specific verb and resource ('Scale the font size so the text's bounds fit...') and pins down the unit and coordinate space ('px, layer space'). It is clearly distinguishable from sibling text tools like set_text_style or get_text_info, which read or style text rather than resizing it to a box.

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 applicability conditions: static (non-keyframed) text only, and either width or height may drive the fit. It does not name an alternative tool or say what to do instead when the layer is keyframed, so it stops short of explicit when-not/alternative guidance.

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