Skip to main content
Glama

Add a third-party script to a page

add_script

Attach a third-party script to a page, either by URL or as inline code. Use this for analytics, pixels, chat widgets and similar integrations rather than editing the page HTML, so the script survives page edits. Scripts are injected when the page is next saved in the editor or published; the change is not live on an already-published page until then.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlNoURL of an external script to load. Give either this or code, not both.
codeNoInline JavaScript to embed. Give either this or url, not both. Paste the code itself; a wrapping <script> tag is unwrapped. Limit 64000 characters — host anything larger at a URL and use url instead.
labelYesWhat this script is, for the dashboard, e.g. "Meta Pixel". Not shown to visitors.
pageIdYesThe page to act on (id from list_pages / list_sites).
enabledNoWhether the script is active. Defaults to true.
placementNoWhere it goes: "head" for anything that must run before the page renders (most analytics), "body" for everything else, just before </body>. Defaults to "body".

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
noteYesStates when the script actually reaches the live page.
countYesScripts on the page after this one.
pageIdYes
scriptYes
verifiedYesFalse when the write reported success but the confirming read did not match. The change is probably saved; re-read with list_scripts to be sure.

TDQS

A4.7/5.0
Behavior5/5

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

Annotations only indicate readOnlyHint=false, so the description carries the burden of behavioral disclosure. It fully discloses that the script is injected when the page is next saved or published, not immediately on already-published pages, and notes the unwrapping of a script tag for inline code. This is transparent and goes beyond the annotation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences, front-loaded with the primary action and purpose, followed by usage context and a behavioral caveat. Every clause adds meaningful information without redundancy or fluff, making it highly concise and well-structured.

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 tool has 6 parameters and an output schema (which covers return values), the description sufficiently covers purpose, timing, and rationale. It references other tools in schema (list_pages/list_sites) and provides enough context for an agent to decide when to use it. The description is complete for a mutation tool with this complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all six parameters with detailed explanations (e.g., character limit, defaults, enum choices). The description adds minimal parameter-specific value; it mentions 'either by URL or as inline code' which aligns with url/code, but does not introduce new semantics. Baseline of 3 is appropriate.

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 clearly states the tool attaches a third-party script to a page via URL or inline code, with a specific resource (page) and action (add). It also differentiates from editing page HTML by emphasizing the script survives page edits, which distinguishes it from sibling tools like edit_page.

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?

Provides explicit when-to-use guidance: 'Use this for analytics, pixels, chat widgets and similar integrations rather than editing the page HTML' and clarifies that the change takes effect on next save or publish, so it's clear when live. It also implies a contraindication: not for scripts that need immediate effect or are too large, as the code param mentions hosting larger scripts via URL.

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.

TDQS

A4/5.0
Disambiguation5/5

Each tool has a distinct purpose, with clear differentiation between creating standalone pages vs. adding to sites, and separate analytics for pages, sites, and workspaces.

Naming Consistency4/5

Mostly follows verb_noun pattern, but uses both 'add' and 'create' for similar actions, and 'delete' vs 'remove' inconsistently.

Tool Count4/5

20 tools cover a broad range of functionality (pages, sites, redirects, scripts, webhooks, analytics, leads), which is reasonable but slightly on the higher side.

Completeness3/5

Covers CRUD for most entities, but lacks delete operations for pages, sites, scripts, and webhooks (except redirects), leaving notable gaps.

Resources