Skip to main content
Glama

run_script

Destructive

Execute custom GDScript in a live Godot project to inspect or manipulate the scene tree at runtime. Requires an active session and a RefCounted script with execute() method.

Instructions

Execute a custom GDScript in the live running project with full scene tree access. Requires an active runtime session. Script must extend RefCounted and define func execute(scene_tree: SceneTree) -> Variant. Return values are JSON-serialized (primitives, Vector2/3, Color, Dictionary, Array, and Node path strings). Use print() for debug output - it appears in get_debug_output, not in the result. In spawned mode, stderr runtime errors escalate to errors (when the script returns null) or surface as warnings. Returns: { success, result, warnings?, tip? } where result is the JSON-serialized return value of execute().

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scriptYesGDScript source code. Must contain "extends RefCounted" and "func execute(scene_tree: SceneTree) -> Variant".
timeoutNoTimeout in ms (default: 30000). Increase for long-running scripts.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
tipNo
resultNo
successNo
warningsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv3.2.0
    • removedOutput schema / properties / warning
      Removed value: -{
      -  "type": "string"
      -}
  2. Addedv3.1.1
  3. Removedv3.0.0
  4. Addedv1.0.0

TDQS

A4.6/5.0
Behavior5/5

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

With only destructiveHint=true given, the description carries real weight: it discloses the runtime-session requirement, that print() output is routed to get_debug_output rather than the result, that stderr errors escalate to errors or warnings depending on the return value, and the exact response envelope. This is unusually rich behavioral context that the annotation alone cannot convey.

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?

Information is front-loaded: purpose first, then precondition, then script contract, then output routing and envelope. It is dense but every sentence carries distinct payload; the only minor cost is a slightly long middle section on return-type serialization.

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 high-complexity tool that executes arbitrary code with full scene-tree access, the description covers the precondition, the script contract, side-channel output routing, error semantics, and the response shape. Even though an output schema exists, the added framing of success/result/warnings/tip is appropriate rather than redundant.

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 goes further by specifying the script's structural contract (extends RefCounted, func execute(scene_tree: SceneTree) -> Variant) and enumerating which return types survive JSON serialization. That adds genuine meaning for constructing a valid parameter.

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?

The opening sentence gives a precise verb+resource+scope: 'Execute a custom GDScript in the live running project with full scene tree access.' This clearly separates it from read/query siblings like get_scene_tree or get_debug_output and from static-analysis siblings like validate.

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?

It states a hard precondition ('Requires an active runtime session') and explains mode-specific behavior (spawned mode error escalation), which tells the agent when this tool is applicable. It does not name an explicit alternative tool for when no runtime session exists, so it stops short of a 5.

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