Skip to main content
Glama

set_custom_code

DestructiveIdempotent

Set site-wide custom code: head goes before and body before on every page, on every layout. It is saved as a draft and goes live with the next publish_site (on a live-mode site the dashboard publishes only the code). It never runs in the editor. Up to 20,000 characters per box, stored as sent; warnings flags likely mistakes (unclosed , // tags, a canonical or robots tag, GA4 already connected) without rejecting. Send only the boxes you change; "" clears a box. runOn ('live' = live site only, default; 'live-and-preview' = also in the editor's preview) applies at once — agents limited to drafts can't set it. Use for tag managers (GTM), Clarity, ads pixels, chat widgets and verification tags. For plain GA4, Plausible, Fathom or Umami prefer set_analytics_provider.

Input Schema

NameRequiredDescriptionDefault
bodyNoCode for before </body> on every page. "" clears it.
headNoCode for before </head> on every page. "" clears it.
siteYesSite slug, e.g. acme-studio
runOnNoWhere it runs: 'live' (live site only) or 'live-and-preview'. Applies at once.
contextYesOne sentence: why you are calling this tool and what you are trying to accomplish. Stored on the site's activity log and visible to everyone on the site — never put secrets or personal data here.
guestTokenNoGuest token from start_site. Send it on every call until claim_site. Omit when this chat is already signed in to Dotsy.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.6/5.0
Behavior4/5

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

Goes well past the annotations: draft-save semantics, that it goes live on next publish_site and on live-mode sites the dashboard publishes only the code, that it never runs in the editor, the 20,000-character cap, stored-as-sent behavior, non-rejecting warnings, and that runOn applies immediately. The only notable gap is no statement about how the previous code is replaced (full overwrite per box) beyond the "" clearing note.

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?

One dense paragraph that front-loads what the tool does and where the code goes, then layers caveats. Every clause carries information, though the heavy parenthetical packing and run-on structure make it harder to scan than a bulleted split into "what it does / publication lifecycle / limits".

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 a destructive, non-read-only mutation with no output schema, the description covers lifecycle (draft → publish), scope (all pages/layouts), limits, clearing, warnings, and the runOn permission constraint — everything an agent needs to call it correctly. The warnings return value is explained even though no output schema exists.

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 baseline is 3, but the description adds real semantics the schema lacks: only send the boxes you change, "" clears, runOn's default and immediate-application timing, and the agent permission restriction on runOn. It mostly complements rather than repeats the parameter docs.

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 (site-wide custom code) plus exact injection points: head before </head>, body before </body>, every page, every layout. It explicitly names the sibling it is not for (set_analytics_provider for plain GA4/Plausible/Fathom/Umami), so an agent can disambiguate without opening schemas.

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 positive use cases (tag managers, Clarity, ad pixels, chat widgets, verification tags) and an explicit alternative with condition: prefer set_analytics_provider for plain GA4/Plausible/Fathom/Umami. It also states partial-update behavior (send only the boxes you change, "" clears) and the permission constraint that draft-limited agents cannot set runOn.

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