Skip to main content
Glama

Run GDScript Expression

godot_run_script
Destructive

Execute GDScript code within the Godot editor to query engine state, access project settings, or perform quick operations using EditorScript functionality.

Instructions

Executes a GDScript expression or block in the Godot editor context (via EditorScript). Useful for querying engine state or performing quick operations.

Args:

  • code (string): GDScript code to execute. Should be a valid expression or a series of statements. Has access to: Engine, ProjectSettings, EditorInterface (in editor context).

  • timeout_ms (number, optional): Max execution time in milliseconds (default: 5000, max: 30000).

Returns: { success: boolean, output: string, error?: string }

Examples:

  • Use when: "What is the current project name?" -> code: "ProjectSettings.get_setting('application/config/name')"

  • Use when: "List all files in res://levels/" -> code: "DirAccess.get_files_at('res://levels/')"

Warning: This runs arbitrary code in the editor. Use with care.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesGDScript code to execute
timeout_msNoExecution timeout in ms
Behavior4/5

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

The description adds valuable behavioral context beyond annotations. Annotations indicate destructiveHint=true and non-idempotent, but the description elaborates with a 'Warning: This runs arbitrary code in the editor. Use with care.' It also mentions access to Engine, ProjectSettings, and EditorInterface, and specifies timeout behavior (default: 5000, max: 30000), enhancing transparency about risks and constraints.

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?

The description is well-structured and front-loaded with the core purpose. It uses sections (Args, Returns, Examples, Warning) efficiently, with each sentence adding value—no redundancy. The examples are concise and illustrative, and the warning is placed appropriately without verbosity.

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

Completeness4/5

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

Given the tool's complexity (executes arbitrary code, destructive) and lack of output schema, the description is mostly complete. It covers purpose, usage, parameters, returns, examples, and warnings. However, it could briefly mention error handling or typical output formats beyond the return structure, slightly limiting completeness for a high-risk tool.

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?

With 100% schema description coverage, the baseline is 3. The description adds meaningful semantics: it explains that 'code' should be 'a valid expression or a series of statements' and 'Has access to: Engine, ProjectSettings, EditorInterface (in editor context).' For 'timeout_ms', it clarifies 'Max execution time in milliseconds (default: 5000, max: 30000),' providing context beyond the schema's numeric constraints.

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 description clearly states the tool's purpose: 'Executes a GDScript expression or block in the Godot editor context (via EditorScript).' It specifies the action ('executes'), resource ('GDScript expression'), and context ('Godot editor context'), distinguishing it from siblings like godot_list_files or godot_set_node_property that perform different operations.

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?

The description provides explicit usage guidance: 'Useful for querying engine state or performing quick operations.' It includes examples with 'Use when:' scenarios (e.g., 'What is the current project name?'), offering clear context for when to apply this tool versus alternatives like godot_get_scene_tree for specific data retrieval.

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/ricky-yosh/godot-mcp-server'

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