Skip to main content
Glama

run_script

Destructive

Run JavaScript on the account's computer with bun — no agent turn — and wait for its result. tools.<namespace>.<function>(args) calls anything list_integration_tools shows (every call returns its result and throws on failure; top-level await works), and the script's last expression is its result. Chain calls and transform data in one run, e.g. const { data } = await tools.crevioApi.listOrders({ status: "succeeded" }); data.length. Runs as you, and only for account admins. If the wait ends first the reply has wait_timed_out: true and the run id: continue with wait_for_script_run — calling run_script again runs it twice unless you reuse the idempotency_key. Run ids do not expire, and only the user who started a run can read it. At most 4 runs in flight per user.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesThe JavaScript to run.
wait_secondsNoHow long to wait for the script to finish before returning. Defaults to, and is capped at, 300 s when your client accepts a streamed reply (text/event-stream), 90 s otherwise. The script keeps going when the wait ends first.
idempotency_keyNoAlways pass one, unique to this request. Retrying with the same key within an hour returns the run the first call started instead of doing the job twice.
timeout_secondsNoHow long the script may run (default 300).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
callsYesEvery tool call the script made, in order.
errorNo
objectYes
outputNoWhat the script printed (the last 64,000 characters).
resultNoThe script's last expression, as JSON.
reusedNo
statusYes
next_stepNo
created_atYes
started_atNo
completed_atNo
wait_timed_outNoThe wait ended first. The work is still running: follow it with the tool next_step names.
timeout_secondsYes

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 beyond the annotations by disclosing execution identity ("runs as you"), authorization ("only for account admins"), concurrency limit ("At most 4 runs in flight per user"), visibility ("only the user who started a run can read it"), lifecycle ("Run ids do not expire"), and idempotency window semantics. These are exactly the traits an agent needs for a destructive, open-world operation and are not derivable from the annotations alone.

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 execution model are front-loaded, and the dense multi-clause sentences all carry operational payload (auth, limits, waiting, idempotency). It is on the long side and the mid-sentence aside about tools.<namespace>.<function> could be tightened, but no sentence 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 4-parameter script runner with an output schema, the description covers the otherwise-invisible contract: admin-only auth, in-flight limits, run-id persistence and ownership, timeout continuation, and the idempotency escape hatch. Return values are covered by the output schema, so nothing essential 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?

Schema coverage is 100%, so baseline is 3, but the description adds real semantics beyond the schema: it explains that the script's last expression is the result, that top-level await works, that every tool call throws on failure, and that the wait ending first yields wait_timed_out with a run id. It reinforces the idempotency-key reuse behavior with a concrete rationale.

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+resource ("Run JavaScript on the account's computer with bun") and immediately distinguishes the mode of operation ("no agent turn — and wait for its result"), which separates it from conversational siblings like ask_crevio and start_chat. An agent can identify the tool's role 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 Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Names the alternative for continuation ("continue with wait_for_script_run") and the exact condition that selects it (the wait ends first / wait_timed_out: true), plus the trap conditionally: calling run_script again reruns it unless the idempotency_key is reused. It also names list_integration_tools as the source of callable functions and states the admin-only precondition.

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