Skip to main content
Glama

Apply Layout

apply_layout
DestructiveIdempotent

Applies a LAYOUT (visual design: colors, fonts, buttons, CSS) to a survey — this does NOT copy survey content; use clone_survey for that. Pass any combination of templateID (from list_layout_templates), inlineTokens, customCSS, customJavascript, customLayout. inlineTokens restyle a survey: design tokens are merged BY NAME into the survey's token list (all other tokens of the base template are preserved) and stay editable in the QUESTIONSTAR Layout Editor; use customCSS/customJavascript/customLayout only for what tokens don't cover. Don't invent token names — call list_layout_tokens for the vocabulary; the result warns via tokensNotUiControlled/unknownTokens, and removeTokens cleans up typos or unwanted overrides (a name passed to both set and remove ends up removed and only counts in tokensRemoved). removeTokens removes your override for a token — the survey falls back to the base template's value for it, it is not blanked. All per-survey material lands on a survey-dedicated template copy named 'API Layout {code}', so shared and system templates are NEVER modified; repeated calls update the same dedicated template (idempotent). customJavascript is executed in respondents' browsers on the public survey page; customLayout replaces the HTML scaffold of that page. Both require confirm:true: a call that passes either of them without confirm writes nothing and returns a preview (which blocks would be written, their size, and that they land on the public page). Calls with only templateID, inlineTokens, removeTokens or customCSS apply directly. The layout is applied immediately to the running survey (it is served through the publication) and verified server-side by readback — the result's 'applied' flag reports it.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesSurvey publication code — the 8-character code from the survey's public link (e.g. 1a2b3c4d). Returned by list_surveys.
confirmNoRequired as true when customJavascript or customLayout is passed: without it the call writes nothing and returns a preview of the blocks that would be written to the public survey page. Not needed for templateID, inlineTokens, removeTokens or customCSS.
customCSSNoCustom CSS rules/selectors for what tokens don't cover. Omit to leave unchanged.
templateIDNoLayout template to apply, as returned by list_layout_templates. Omit to keep the current template (e.g. when only passing tokens or custom blocks).
customLayoutNoCustom HTML layout scaffold, replaces the HTML scaffold of the public survey page. Requires confirm:true. Omit to leave unchanged.
inlineTokensNoDesign tokens to set, e.g. [{"name":"--color-accent","value":"#e11d48"}]. Merged by name (case-sensitive) into the survey's token list; unnamed base tokens are preserved. Use known token names only (list_layout_tokens).
removeTokensNoToken NAMES whose override to remove (e.g. a typo written earlier) — the survey falls back to the base template's value, nothing is blanked. Omit to remove nothing.
customJavascriptNoCustom JavaScript, executed in respondents' browsers on the public survey page. Requires confirm:true. Omit to leave unchanged.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
appliedNo
messageNoPreview text: which blocks would be written and their size; empty when the layout was applied.
previewNotrue when the call was a preview (customJavascript or customLayout passed without confirm:true): nothing was written.
tokensSetNo
surveyCodeNo
templateIDNo
templateNameNo
tokensRemovedNo
unknownTokensNo
tokensNotUiControlledNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already flag destructiveHint/readOnly=false/idempotent, but the description goes well beyond them: per-survey material lands on a dedicated copy named 'API Layout {code}', shared/system templates are NEVER modified, repeated calls update the same dedicated template, customJavascript runs in respondents' browsers on the public page, and unconfirmed customJavascript/customLayout writes nothing and returns a preview. It also discloses server-side readback verification via the 'applied' flag.

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 critical routing and safety information (what it does, what it doesn't, confirm requirements) is front-loaded in the first sentences. The remaining text is dense with parenthetical asides that reward careful reading but make the block long and hard to scan in a single pass.

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?

For an 8-parameter, destructive, open-world mutation tool with an output schema, nothing an agent needs to call it safely is missing: prerequisites (confirm), token sourcing, idempotency, blast radius (public page, dedicated template copy), and the verification signal are all covered. Return-value details are correctly left to the output schema.

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 semantics: tokens merge BY NAME with unnamed base tokens preserved, a name passed to both set and remove ends up removed and counts only in tokensRemoved, and unknown/typo names surface as unknownTokens/tokensNotUiControlled. The confirm and removeTokens semantics overlap with the schema, so the added value is incremental rather than comprehensive.

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?

Starts with a specific verb+resource ('Applies a LAYOUT') and immediately disambiguates scope with a parenthetical definition of what a layout is (colors, fonts, buttons, CSS) plus an explicit negative boundary — 'this does NOT copy survey content; use clone_survey for that.' An agent can distinguish it from clone_survey and from list_layout_templates without opening any schema.

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?

Gives explicit routing rules: use clone_survey for content, list_layout_templates to source templateID, list_layout_tokens for token vocabulary, and 'use customCSS/customJavascript/customLayout only for what tokens don't cover.' It also states precisely when confirm:true is required versus when calls apply directly, and when removeTokens is appropriate (typos/unwanted overrides).

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