Skip to main content
Glama
customaise

customaise

Official

export_script

Destructive

Export a script from a local file into Customaise. The file will be validated through Customaise's sanitization pipeline (syntax checking, AST validation, security analysis).

Instructions

Export a script from a local file into Customaise. The file will be validated through Customaise's sanitization pipeline (syntax checking, AST validation, security analysis). If valid, the script is installed and ready to execute on matching pages. If invalid, detailed diagnostics explain exactly what to fix. Pass scriptId to update an existing script instead of creating a new one. Pass expectedCodeHash from import_script to reject stale edits. Save progress includes an operation ID and stage. A timeout may leave the outcome unknown: query get_bridge_status with the scriptId and operationId from the error before retrying. The extension enforces a 90-second save deadline and cancels work that has not reached persistence. A storage write already submitted cannot be recalled; its commit receipt resolves that uncertainty. For a script that uses CM_decisions, scriptDecisions in the result says whether its Script Decisions provider stays chosen for the new code, and if not, why and what to do. NOTE: You cannot overwrite a shared/subscribed script — they are read-only. If you need to edit a shared script, first call import_script with fork:true (creates an editable independent copy), then export to that copy's scriptId.

Reminder for new UserScripts: Prefer named functions in an IIFE for symbol-level editing; preserve valid imported source, `// @namespace https://customaise.com`, and standard directives (@name, @match, @grant).
Reminder for AgentScripts: MUST use `// ==AgentScript==` block, MUST explicitly declare tools via `// @webmcp <toolName> <permission>` (e.g. `// @webmcp my_tool prompt`). Permissions: allow (autonomous), prompt (interactive), deny (blocked). Prefer `prompt`: in a script you write, `allow` resolves as `prompt` before user grants are applied; a saved Allow rule or user-enabled Full access can permit it. Prefer named top-level functions and top-level tool registration for symbol editing; IIFEs are supported. CAN use GM_* APIs for persistence, networking, and observability alongside `document.modelContext.registerTool()`.

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": {
      "filePath": "<filePath>"
    },
    "name": "export_script"
  }
}

Input Schema

NameRequiredDescriptionDefault
filePathYesLocal file path containing the userscript source code
scriptIdNoID of an existing script to update. Omit to create a new script.
expectedCodeHashNoSHA-256 from import_script. Reject the save if the installed source has changed since that read.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv3.2.3
    • addedInput schema / properties / expectedCodeHash
      Added value: +{
      +  "description": "SHA-256 from import_script. Reject the save if the installed source has changed since that read.",
      +  "pattern": "^[a-f0-9]{64}$",
      +  "type": "string"
      +}
  2. First observedv3.2.0

TDQS

A4.7/5.0
Behavior5/5

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

Annotations only declare destructiveHint/readOnlyHint; the description goes well beyond by disclosing the sanitization pipeline stages (syntax, AST, security), the 90-second save deadline with cancellation, the fact that a submitted storage write cannot be recalled and resolves via commit receipt, and that a timeout may leave the outcome unknown. It also flags the shared-script overwrite prohibition, which is behavioral context annotations cannot express.

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

Conciseness3/5

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

The core purpose and the create/update/hash/timeout guidance are front-loaded and well ordered, but the trailing 'Reminder for new UserScripts' and 'Reminder for AgentScripts' blocks are lengthy authoring boilerplate appended to a save tool, diluting focus and making the definition far longer than the operation requires.

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?

With no output schema, the description carries the return-value burden itself: it explains diagnostics on failure, operation ID and stage in progress events, and the scriptDecisions field for CM_decisions scripts. Combined with the timeout and read-only-script edge cases, an agent has everything needed to call it and interpret the outcome.

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 genuine meaning: scriptId switches create-vs-update semantics, and expectedCodeHash is tied to its producer (import_script) and its purpose (reject stale edits). It does not describe the required filePath or the hash 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?

Opens with a specific verb and resource ('Export a script from a local file into Customaise') and immediately scopes it as either create or update. An agent can tell this apart from import_script (the reverse direction), delete_script, and sync_scripts without opening a 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?

Explicitly states when to pass scriptId (update vs create), when to pass expectedCodeHash (reject stale edits), and the exact recovery path on timeout (call get_bridge_status with scriptId and operationId before retrying). It also names the blocking case — shared/subscribed scripts are read-only — and prescribes the alternative workflow (import_script with fork:true, then export to the copy's scriptId).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.