Skip to main content
Glama

Run a script

run_script
Destructive

Run a JavaScript script (body of an async function: use top-level await and return) against the user's ZapX services, in a sandbox without network or file access. Use it for everything that READS, and for file changes (mutate_file): one script can call many tools, loop, filter and combine results, and return only the answer. API: await tools.(args) for the tools listed below; each returns the tool's parsed JSON result and throws an Error with the tool's message when it fails (try/catch per item when you loop). await searchTools(query, { limit? }) and await describeTool(name | names) return declarations inside the script. console.log(...) and the returned value form the output. Hand data back with return, not with throw: a thrown error marks the whole call as failed. Tools that exist for several products are one tool that takes the serviceId of any of them (read_file, list_files, get_service, read_logs, get_schedules, ...); arguments of another product are refused. Limits: 45 s, 50 tool calls (max 5 at once), output 24000 characters (return counts or the relevant lines, not whole files). Results are strict: reading a field a result does not have throws and lists the real fields. Other tools that change something are not available here; use call_tool for them. There are no timers (setTimeout, setInterval), fetch or require: you cannot wait inside a script; to wait for an operation, end the script and poll it with a later call (e.g. get_operation_status). Changes inside a script: tools.mutate_file(args) with confirm: true (the client asks the user to approve each script; tell the user beforehand which files the script changes). Read a file first and send its revision as expectedRevision when you write it. Calls run in order and nothing is rolled back: stop at the first error and return what was already changed. Core declarations: /** List all accessible services (gameservers, VPS, dedicated servers, TeamSpeak servers, Discord bots, and domains) in one normalized response. Prefer this for discovery. Pass a service's "id" to the tools of its type (gameserver ids to gameserver tools, VPS ids to vserver tools, ...). / tools.list_account_services(args?: {}): Promise<Array<{ id: string; name: string; status: string; // Type-specific summary: numericId plus e.g. game/primaryEndpoint (gameserver), template/primaryIp (vserver), port/defaultDomain (teamspeak), primaryIp/region (dedicated), template/primaryEndpoint/region (discord_bot), dnsMode/autoRenew/expiresAt (domain) summary: { [key: string]: unknown; }; type: "gameserver" | "vserver" | "teamspeak" | "dedicated" | "discord_bot" | "domain"; }>>; // Read-only: usable inside run_script. /* Poll the status of an async public API operation. */ tools.get_operation_status(args: { // @minLength 1 operationId: string; }): Promise<{ operation: { action: string; // ISO 8601 timestamp createdAt: string; error: string | null; // Operation id (use with get_operation_status) id: string; // Always null (internal job id is not exposed) jobId: null; // Always null (internal queue is not exposed) queue: null; serviceId: string | null; serviceType: string | null; // queued, running, succeeded or failed status: string; // ISO 8601 timestamp updatedAt: string; }; }>; // Read-only: usable inside run_script. Read-only tools (81): list_account_services, list_incidents, list_orderable_products, list_orderable_plans, list_orderable_product_regions, list_order_regions, list_orderable_games, list_vserver_order_isos, list_domain_tlds, check_domain_availability, search_domain_name, list_domain_contact_profiles, list_dedicated_platforms, list_dedicated_ready_builds, get_dedicated_platform_options, preview_order, get_order_status, get_payment_setup_status, recommend_plan, create_checkout_link, get_vserver_traffic, list_vserver_outgoing_ddos, get_vserver_dns, list_vserver_account_ssh_keys, list_vserver_ssh_keys, list_vserver_isos, get_vserver_metrics, get_vserver_firewall, get_dedicated_metrics, get_dedicated_hardware, get_dedicated_traffic, get_dedicated_traffic_quota, get_dedicated_traffic_history, get_dedicated_installation, get_dedicated_installation_progress, get_dedicated_installation_options, get_dedicated_remote_management, list_teamspeak_tokens, get_gameserver_container_status, list_gameserver_databases, get_gameserver_external_access, list_gameserver_savegames, list_gameserver_mods, check_gameserver_addon_updates, list_gameserver_plugins, get_gameserver_rust_framework, list_gameserver_modpacks, get_gameserver_workshop, list_vserver_snapshots, get_teamspeak_metrics, list_teamspeak_clients, list_teamspeak_bans, list_domains, get_domain, get_domain_dns_records, get_domain_nameservers, get_domain_renewal, get_operation_status, get_plan_change_status, list_services, get_service, get_service_activity, get_service_status, list_files, read_file, read_logs, get_config, get_schedules, list_backups, get_daily_backup, get_ddos_status, list_ddos_rules, list_ddos_incidents, get_ddos_bandwidth, get_reverse_dns, list_custom_isos, list_reinstall_templates, apps_catalog, apps_state, get_plan_change_options, preview_plan_change

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": {
      "code": "<code>"
    },
    "name": "run_script"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesJavaScript: body of an async function (top-level await, return the result).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.8/5.0
Behavior5/5

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

Goes well past the annotations (destructiveHint=true, readOnlyHint=false) by disclosing the sandbox restrictions, hard limits (45s, 50 tool calls, 5 concurrent, 24000-char output), strict field-access errors, absence of timers/fetch/require, the confirm:true approval flow with expectedRevision, and the no-rollback ordering semantics. These are exactly the operational traits an agent cannot infer from the annotations.

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 purpose, usage, API shape, then limits and mutation caveats — every paragraph carries actionable information. It runs long and the embedded 'Core declarations' block partly duplicates what describeTool would return at runtime, which bloats an otherwise tight definition.

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 complex, high-risk execution tool with no output schema, the description covers invocation, in-script API, error semantics, resource limits, approval requirements, and output formation (return value plus console.log). Nothing an agent needs in order to call this correctly is missing.

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?

Only one parameter exists and the schema already describes it at 100% coverage, so the baseline is low-stakes; the description nevertheless adds real meaning about what the code body may contain (await tools.<name>, searchTools, describeTool, return vs throw, console.log). It stops short of full syntax specification, but the added value is well above baseline.

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 ('Run a JavaScript script ... against the user's ZapX services') plus the execution environment ('sandbox without network or file access'), and immediately scopes it against siblings ('use call_tool' for other mutating tools). An agent can distinguish it from call_tool and search_tools without inspecting 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?

Explicit routing rules: 'Use it for everything that READS, and for file changes (mutate_file)', and the exclusion 'Other tools that change something are not available here; use call_tool for them.' It also tells the agent how to handle waiting (end the script and poll with get_operation_status) rather than inventing a workaround.

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