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. Saved as a draft; goes live with the next publish_site (on a live-mode site the dashboard publishes only the code). Never runs in the editor. ≤20,000 characters per box, stored as sent; warnings flags likely mistakes (unclosed , // tags, canonical or robots tag, GA4 already connected) without rejecting. Send only the boxes you change; "" clears one. runOn ('live' default; 'live-and-preview' adds the editor preview) applies at once — agents limited to drafts can't set it. For tag managers (GTM), Clarity, ads pixels, chat widgets, verification tags; plain GA4/Plausible/Fathom/Umami: set_analytics_provider.

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": {
      "site": "<site>"
    },
    "name": "set_custom_code"
  }
}

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.
contextNoWhy you're calling this (activity log).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • removedInput schema / $schema
      Removed value: -"http://json-schema.org/draft-07/schema#"
    • changedInput schema / properties / context / description
      Previous value: -"Optional: one sentence on why you are calling this (shown in the site's activity log; no personal data)."New value: +"Why you're calling this (activity log)."
  2. Changed3 schema fields changed
    • changedInput schema / properties / context / description
      Previous value: -"One 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."New value: +"Optional: one sentence on why you are calling this (shown in the site's activity log; no personal data)."
    • removedInput schema / properties / guestToken
      Removed value: -{
      -  "description": "Guest token from start_site. Send it on every call until claim_site. Omit when this chat is already signed in to Dotsy.",
      -  "minLength": 20,
      -  "type": "string"
      -}
    • changedInput schema / required
      Previous value: -[
      -  "site",
      -  "context"
      -]New value: +[
      +  "site"
      +]
  3. Added

TDQS

A4.4/5.0
Behavior4/5

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

Adds substantial behavior beyond the annotations: draft state until publish_site, live-mode dashboard publishes only the code, never executes in the editor, warnings are advisory and non-blocking, and draft-limited agents cannot set runOn. The destructiveHint=true implication (this overwrites existing code in that box) is only indirectly conveyed by 'stored as sent' and '"" clears one' rather than stated outright.

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 essential placement semantics and dense with useful detail; nearly every clause carries information (limits, warnings, alternatives). Structure is a single semicolon-chained block, which is slightly hard to scan but wastes little.

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?

Complete for a destructive draft-mutation tool: limits, draft/publish lifecycle, warning behavior, permission constraints, execution scope via runOn, and the sibling alternative are all present. No output schema exists, and the description adequately covers the warnings/result signal an agent needs.

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 meaning: '"" clears one', send only the boxes you change (patch semantics), runOn defaults to 'live' and applies at once, and the 20,000-character ceiling per box. It does not describe the 'context' parameter or the 'site' slug format, which the schema already covers.

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 ('Set site-wide custom code') and immediately defines the exact injection points (head before </head>, body before </body>) on every page and layout. An agent can distinguish this from set_analytics_provider without opening the schema.

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?

Explicitly routes analytics-vendor snippets to set_analytics_provider and reserves this tool for tag managers, ads pixels, chat widgets and verification tags, and it explains the publish_site relationship. It gives clear positive routing but no explicit 'don't use this for X' exclusion beyond the GA4 alternative.

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