Skip to main content
Glama

ts_execute

Destructive

Run JavaScript code in a Node sandbox to call allowed code-intelligence tools and return one value, combining symbol lookup, dependency checks, and edits in a single round-trip.

Instructions

Run a JS script in a Node sandbox with a typed facade. The script body executes as async () => { <body> }; use await tools.<name>(args) to call any allowed tool (find_symbol, get_function_source, get_dependents, search_codebase, replace_symbol_source, etc.). Return the final value. Collapses find->read->deps chains into one round-trip.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
jsNoAlias de `script`. JS function body. Use `await tools.foo(args)` then `return value`.
bodyNoAlias de `script`. JS function body. Use `await tools.foo(args)` then `return value`.
codeNoAlias de `script`. JS function body. Use `await tools.foo(args)` then `return value`.
scriptNoJS function body. Use `await tools.foo(args)` then `return value`.
timeout_msNoMax script wall-clock in ms (default 30000).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv4.24.0
    • addedInput schema / anyOf
      Added value: +[
      +  {
      +    "required": [
      +      "script"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "code"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "body"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "js"
      +    ]
      +  }
      +]
    • addedInput schema / properties / body
      Added value: +{
      +  "description": "Alias de `script`. JS function body. Use `await tools.foo(args)` then `return value`.",
      +  "type": "string"
      +}
    • addedInput schema / properties / code
      Added value: +{
      +  "description": "Alias de `script`. JS function body. Use `await tools.foo(args)` then `return value`.",
      +  "type": "string"
      +}
    • addedInput schema / properties / js
      Added value: +{
      +  "description": "Alias de `script`. JS function body. Use `await tools.foo(args)` then `return value`.",
      +  "type": "string"
      +}
    • removedInput schema / required
      Removed value: -[
      -  "script"
      -]
  2. Addedv4.0.0

TDQS

A4.3/5.0
Behavior4/5

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

Beyond the annotations (destructiveHint=true, readOnlyHint=false), the description discloses the sandbox, the `async () => { <body> }` wrapping, the `await tools.<name>(args)` facade, and the return-value convention. It does not warn about error propagation or the persistence of edits made through mutating tools like replace_symbol_source, and the word 'sandbox' sits in mild tension with destructiveHint=true, but the mechanical disclosure is substantial.

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?

Four dense sentences, purpose front-loaded, no filler. The allowed-tool list is the only slightly open-ended element ('etc.') and it still earns its place by showing the facade's reach.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

There is no output schema, so the description must carry the return contract, which it does minimally ('Return the final value'). For a tool that executes arbitrary JS with destructive potential, it omits error/failure behavior and whether edits persist, leaving an agent to infer some operational details.

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 the baseline is 3, but the description adds real meaning by specifying that the script string is a function body that uses `await tools.foo(args)` and must `return value`. It does not clarify the four alias parameters (script/code/body/js) or the timeout default, so it does not fully supersede 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 ('Run a JS script in a Node sandbox with a typed facade') and is instantly distinguishable from every sibling, none of which execute arbitrary code. The execution model is described concretely enough that an agent knows exactly what the tool does.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

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

The closing line 'Collapses find->read->deps chains into one round-trip' tells the agent when this tool is preferable to chaining individual calls, and the allowed-tool list shows what can be orchestrated. It stops short of naming explicit exclusions (e.g., when a single direct call is better), so it is strong but not fully prescriptive.

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