Skip to main content
Glama

Store Manager for WooCommerce

AddSynapse: draft a small custom script

plan_custom_script

AddSynapse: Prepare a DRAFT of a small custom JavaScript for the public pages (for example a sticky header, a back-to-top button, a notice bar) — ONLY when no design tool can do it, and never for measurement codes (plan_tracking_code does those). Works only when the site owner turned on «Allow the AI to add JavaScript» in WordPress (AddSynapse → Settings); otherwise the answer says how — tell the user and stop. Write plain readable code: one statement per line, lines up to 300 characters, at most 20 KB. The site refuses it, with the reason, for: eval / Function / timers with text / encoded or escaped text, cookies, localStorage / sessionStorage, reading form fields or what visitors type, location (redirects), window.open, document.write, script / iframe / form tags or elements, XMLHttpRequest / jQuery ajax / new Image, and fetch / sendBeacon / addresses other than a fixed address on this site or a domain the owner allowed in WordPress. It runs after the page has loaded, never on checkout, cart, my account, login or wp-admin pages. label = what it does in a few words; about = one or two plain sentences for the owner; pages = "all", "front_page" or a list of page / post ids. To change a script send its key (describe_tracking) with the new values; to remove: {"key": "...", "remove": true}. Changes nothing by itself: the card shows the whole code; nothing runs until the user presses Approve; Undo restores exactly. Before calling it, say in plain words what the script does and on which pages, and get the user's agreement.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "plan_custom_script"
  }
}

Input Schema

NameRequiredDescriptionDefault
keyNoan existing script (describe_tracking scripts)
codeNo
siteNoWhich connected site: its address or site_id from addsynapse_list_sites. Omit when the account has only one site.
aboutNo
labelNo
pagesNo"all" (default), "front_page" or page / post ids
removeNo

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?

Annotations only say readOnly=false, destructive=false, idempotent=false, openWorld=false; the description adds far more: it only drafts (nothing runs until the user presses Approve), Undo restores exactly, the site rejects a specific enumerated blocklist with a reason returned, code runs after page load and never on checkout/cart/account/login/wp-admin, and code size/line limits apply. The one gap is that it never says what a successful response looks like beyond 'the card shows the whole code', which is minor given there is no output schema.

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?

Purpose and the primary gate are front-loaded in the first two sentences, and nearly every later sentence carries actionable constraint information. It is dense and long — the refusal blocklist is a run-on enumeration and some clauses could break into bullets — but little of it is filler.

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 7-parameter mutation-adjacent tool with no output schema, the description covers the enabling prerequisite, the draft/approve/undo lifecycle, rejection behavior, execution scope and timing, update and removal paths, and the confirmation ritual. An agent has everything needed to call it correctly and to explain the outcome to a user.

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 only 43%, but the description compensates by explaining label ('what it does in a few words'), about ('one or two plain sentences for the owner'), pages ('"all", "front_page" or a list of page / post ids'), key for updating an existing script, and the remove flag pattern. It even adds style constraints on the undocumented 'code' parameter (one statement per line, lines up to 300 characters, 20 KB max). Only 'site' is left entirely to the schema.

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 — 'Prepare a DRAFT of a small custom JavaScript for the public pages' — with concrete examples (sticky header, back-to-top button, notice bar) and an explicit negative bound ('never for measurement codes (plan_tracking_code does those)'). An agent can separate this from plan_tracking_code and from the design-oriented plan_* siblings 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 when-to-use ('ONLY when no design tool can do it'), explicit when-not (measurement codes), a hard prerequisite (owner must have enabled «Allow the AI to add JavaScript», otherwise tell the user and stop), and a pre-call protocol (state in plain words what the script does and on which pages, then get agreement). Few definitions route this thoroughly.

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