Skip to main content
Glama

Create a code template (HTML + CSS + Handlebars)

create_code_template

Creates a NEW code-kind template on the feed. Body is Handlebars: {{title}}, {{price}}, {{brand}}, etc. plus helpers from list_handlebars_helpers (formatPrice, truncate, stripHtml, …). Variable bag includes everything in product.rawData plus derived fields (sale_percentage etc.; sale_percentage already ends with "%", e.g. "20%", so write -{{sale_percentage}}, not -{{sale_percentage}}%). It goes live at once and replaces the always-on active template of the same placement. placement "4_5" or "9_16" makes a Meta aspect-ratio variant instead of the main image: Meta feeds then also carry a 4:5 (Feed) or 9:16 (Stories, Reels) image per product, tagged so Meta picks it per placement; the canvas must be exactly that ratio (default 1080×1350 / 1080×1920). The response repeats the placement's safe zones. After creation, call preview_render to see the result inline.

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": {
      "feedId": "<feedId>",
      "name": "<name>",
      "codeHtml": "<codeHtml>"
    },
    "name": "create_code_template"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameYes
widthNoOutput width in px. Default 1080 (1080×1080 is the standard square ad size).
feedIdYes
heightNoDefault: 1080, or 1350 / 1920 for placement 4_5 / 9_16.
codeCssNoCSS string. Will be inlined into the HTML via juice before satori-html parses it.
codeHtmlYesHandlebars-enabled HTML body. Will be wrapped in <html><body>… automatically by the renderer.
placementNo"default" = main image; "4_5" / "9_16" = Meta aspect-ratio variant.default
outputFormatNojpeg
backgroundColorNoHex like "#FF6600". Shown behind transparent areas.#FFFFFF

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.3/5.0
Behavior4/5

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

Beyond the annotations, the description discloses the crucial side effect that the template 'goes live at once and replaces the always-on active template of the same placement', plus what the response returns (safe zones) and that Meta tags the variant per placement. This is exactly the kind of write-impact context annotations cannot convey. Minor tension with destructiveHint=false given the live replacement, though no outright contradiction.

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-loads the core action and keeps every sentence substantive, but the single dense paragraph with stacked parentheticals and ellipses is harder to scan than it needs to be. Slight trimming or splitting would improve it without losing information.

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 non-idempotent, non-read-only tool with nine parameters and no output schema, the description covers the mutation's effect, the response contents, the body format, and the next step. It does not mention failure modes or validation/prerequisite checks (e.g., get_validation), which is the remaining gap.

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?

With schema coverage at 67%, the description still adds real meaning: the exact-ratio constraint for 4_5/9_16 canvases (1080×1350 / 1080×1920), the contents of the variable bag (product.rawData plus derived fields), and the non-obvious gotcha that sale_percentage already carries a '%' sign. Name, feedId, outputFormat, and backgroundColor are left to the schema, which documents them adequately.

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 ('Creates a NEW code-kind template on the feed') and immediately pins down the body language (Handlebars), distinguishing it from create_template_variant and update_code_template. The 'NEW' emphasis plus the replacement-of-active-template note makes the create semantics unmistakable.

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 conditional guidance for the placement parameter (default = main image, 4_5/9_16 = Meta aspect-ratio variant) and a mandatory follow-up ('After creation, call preview_render'), plus a routing pointer to list_handlebars_helpers. It stops short of stating when to prefer create_template_variant or update_code_template instead, so sibling selection is only partially covered.

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