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.

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.6/5.0
Behavior4/5

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

Annotations already mark the tool as destructive/mutating, and the description adds meaningful behavioral context: it is a partial update ('Pass only the fields you want to change'), fill null removes the box, and the box is deliberately not painted on curved text. This goes beyond the annotations without contradicting them.

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?

The description is longer than average, but most of the length carries high-value usage guidance: the button-building pattern, the curved-text exception, and the alternative tool. It is front-loaded with the core operation before diving into context, though the capitalized 'THIS IS HOW YOU BUILD A BUTTON' section is somewhat verbose.

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?

Given the output schema exists and the input schema covers all parameters, the description provides everything an agent needs to invoke this correctly: scope, update semantics, removal behavior, the button use case, and when to route to a different tool. No critical context 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 the baseline is 3, but the description adds extra semantic value by explaining how padding shrink-wraps the box on 'hug' layers and narrows line-wrap on 'wrap'/'fit'/'shrink' layers. It also clarifies that only provided fields are changed, which is not fully captured in 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?

The description opens with a specific verb+resource: 'Add or update the rounded background box behind a TEXT layer (text.<id>) in one call'. It also distinguishes itself from the sibling set_layer_fill by explicitly scoping to text layers and stating 'for shapes/images/video use set_layer_fill'.

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?

The description gives explicit when-to-use guidance, including the autofit 'hug' behavior for new layers, when set_layer_text(text_autofit:'hug') is needed for older 'wrap' layers, and the curved-text exception where a shape behind the text is required. It also names the alternative tool for non-text layers.

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