Skip to main content
Glama

run_script

Destructive

Execute custom GDScript code in a live Godot project. Run scripts with full scene tree access and return JSON-serialized results.

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
successNo
resultNo
warningNo
warningsNo
tipNo
Behavior4/5

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

Describes behavior beyond destructiveHint annotation, including error handling (stderr escalation), debug output via print(), and return format. No contradiction with 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, covers multiple aspects efficiently. A bit dense but every sentence earns its place.

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?

Comprehensive for a complex tool: explains return format, debug output, error handling, and script requirements. No gaps given schema and annotations.

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 has 100% coverage, and description adds value by detailing script constraints (must extend RefCounted, execute function signature) and timeout default, enhancing understanding beyond 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?

Clearly states it executes a custom GDScript in a live running project with full scene tree access, distinguishing it from sibling tools like add_node or run_project.

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

Usage Guidelines3/5

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

Specifies requirement for active runtime session and script structure constraints, but lacks explicit guidance on when to use this tool over alternatives like run_project or adding a script through other means.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Erodenn/godot-mcp-runtime'

If you have feedback or need assistance with the MCP directory API, please join our Discord server