Skip to main content
Glama

Set text background

set_text_background
Destructive

Add or update the rounded background box behind a TEXT layer (text.) in one call — sets the backdrop fill plus the box's padding, corner radius, and optional stroke. Pass only the fields you want to change. New text layers are already text_autofit "hug", so padding alone shrink-wraps the box to the text — ideal for caption / sticker chips; set_layer_text(text_autofit:"hug") is only needed when adding a box to an OLDER layer still on "wrap". THIS IS HOW YOU BUILD A BUTTON: a button / CTA / chip / tag / pill / labelled badge is ONE text layer with a native background, never a rounded-rect shape with a text layer parked on top — padding is what sizes the box around the label, so the two can't drift apart when the text or the scale changes and the user drags one layer instead of two. The one exception: the box is NOT painted on CURVED text (a straight box behind a bent line reads as broken), so an arc-shaped chip genuinely needs a shape behind it. Pass fill null to remove the box. Text layers only; for shapes/images/video use set_layer_fill. Returns text_box and fits for the padded box, with a warning when it runs past the canvas or the safe area.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fillNoBox fill: '#rrggbb' (promoted to solid) or a Fill object: {type:"solid",color} / {type:"linear",stops:[{pos:0..1,color}],angle?} / {type:"radial",stops:[{pos:0..1,color}],cx?,cy?,radius?} / {type:"mask",layer_id,color}. null clears the box; omit to leave the current fill.
paddingNoUniform inset (canvas px) between the box edge and the text. On a "hug" layer it is what sizes the box around the label; on a fixed-size layer ("wrap", "fit", "shrink") lines wrap inside the padded area, so padding narrows where they break. 0 / omitted ⇒ no explicit padding.
elementIdYestext.<id>.
projectIdYesOpaque project id (a v4 UUID, from list_projects/create_project). Selects which existing project this call mutates.
strokeColorNoBox outline colour as #rrggbb.
strokeWidthNoBox outline width in px. 0 / omitted ⇒ no outline.
cornerRadiusNoCorner radius of the box in px. 0 ⇒ square corners.
clear_animationNoOnly meaningful when `fill` is given AND the layer's backdrop fill is animated. true = the new fill REPLACES the colour animation. Omitted / false = the call is refused rather than writing a fill the animation would hide.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYesWhether the call succeeded.
dataNoThe payload, shaped by the tool.
noteNoWhat to do next when not ready.
errorNoWhy it failed.
statusNoFor cache-backed readers: whether the answer was ready.
editorUrlNoOpens this project in the editor.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • removedInput schema / properties / anonymousToken
      Removed value: -{
      -  "description": "The token create_anonymous_account returned. This connection has no Morpha key, so every call carries it.",
      -  "type": "string"
      -}
    • changedInput schema / required
      Previous value: -[
      -  "elementId",
      -  "projectId",
      -  "anonymousToken"
      -]New value: +[
      +  "elementId",
      +  "projectId"
      +]
  2. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "description": "The result envelope every Morpha tool returns.",
      +  "properties": {
      +    "data": {
      +      "description": "The payload, shaped by the tool.",
      +      "type": [
      +        "object",
      +        "array",
      +        "string",
      +        "number",
      +        "boolean",
      +        "null"
      +      ]
      +    },
      +    "editorUrl": {
      +      "description": "Opens this project in the editor.",
      +      "type": "string"
      +    },
      +    "error": {
      +      "description": "Why it failed.",
      +      "type": "string"
      +    },
      +    "note": {
      +      "description": "What to do next when not ready.",
      +      "type": "string"
      +    },
      +    "ok": {
      +      "description": "Whether the call succeeded.",
      +      "type": "boolean"
      +    },
      +    "status": {
      +      "description": "For cache-backed readers: whether the answer was ready.",
      +      "enum": [
      +        "ready",
      +        "not-ready"
      +      ],
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "ok"
      +  ],
      +  "type": "object"
      +}
  3. Changed1 schema field changed
    • changedInput schema / properties / padding / description
      Previous value: -"Uniform inset (canvas px) between the box edge and the text. 0 / omitted ⇒ no explicit padding."New value: +"Uniform inset (canvas px) between the box edge and the text. On a \"hug\" layer it is what sizes the box around the label; on a fixed-size layer (\"wrap\", \"fit\", \"shrink\") lines wrap inside the padded area, so padding narrows where they break. 0 / omitted ⇒ no explicit padding."
  4. Changed2 schema fields changed
    • addedInput schema / properties / anonymousToken
      Added value: +{
      +  "description": "The token create_anonymous_account returned. This connection has no Morpha key, so every call carries it.",
      +  "type": "string"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "elementId",
      -  "projectId"
      -]New value: +[
      +  "elementId",
      +  "projectId",
      +  "anonymousToken"
      +]
  5. Changed1 schema field changed
    • addedInput schema / properties / fill / type
      Added value: +[
      +  "string",
      +  "object",
      +  "null"
      +]
  6. First observed

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=false, destructiveHint=true, and openWorldHint=false, so the mutation/risk profile is covered. The description adds real context beyond that: partial-update semantics ('pass only the fields you want to change'), the removal path via fill null, and the return contract (text_box and fits, with a warning when the box runs past the canvas or safe area).

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 core action before the button-building rationale, and every sentence does work. It is dense and a bit long, with the THIS IS HOW YOU BUILD A BUTTON passage reading as persuasive rather than strictly necessary, but nothing is pure filler.

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?

An output schema exists, so the brief mention of text_box/fits is a bonus rather than a burden. For an 8-parameter mutation it covers the meaningful behaviors, the alternative tool, and the exception case; the only mild gap is that the animated-fill refusal path is documented in the schema rather than surfaced in the description.

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 carries conceptual meaning the schema does not: it explains that padding is what sizes a 'hug' box around the label while on fixed-size layers padding narrows where lines break, and that fill null clears whereas omitted leaves the current fill. This is additive semantics, not a restatement of field descriptions.

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 and resource (add/update the rounded background box behind a TEXT layer), names the identifier format (text.<id>), and enumerates the concrete fields it touches (fill, padding, corner radius, stroke). It explicitly distinguishes itself from the sibling set_layer_fill by declaring its scope is text layers only.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly routes the agent: use set_layer_fill for shapes/images/video, use set_layer_text(text_autofit:"hug") only for older 'wrap' layers, and pass fill null to remove the box. It even carves out a when-not case (curved text, where an arc-shaped chip genuinely needs a shape instead), which is unusually precise guidance.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources