Skip to main content
Glama

attach_script

Idempotent

Attach an existing GDScript file to a Godot scene node, replacing any prior script and saving automatically. Use after writing and validating the script.

Instructions

Attach an existing GDScript file to a node in a scene. Use after writing the script with the standard file tools and validating it via the validate tool. Replaces any previously attached script. Saves automatically. Returns: success with the resolved nodePath and scriptPath that were attached. Errors if scriptPath does not exist or nodePath is not found. Errors while a Godot runtime session is active on this project; stop_project (or detach_project) clears it.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nodePathYesNode path from scene root (e.g. "root/Player")
scenePathYesScene file path relative to the project
scriptPathYesPath to the GDScript file relative to the project (e.g. "scripts/player.gd")
projectPathYesPath to the Godot project directory

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
successNo
nodePathNo
scriptPathNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv3.1.1
  2. Removedv3.0.0
  3. Addedv1.0.0

TDQS

A4.5/5.0
Behavior5/5

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

Beyond the lone idempotentHint annotation, it discloses that the operation replaces any previously attached script, that it saves automatically, the resolution behavior of the returned nodePath/scriptPath, and two distinct error conditions (missing scriptPath, unknown nodePath). The runtime-session constraint and its remedy are exactly the kind of context annotations cannot carry.

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 short sentences, front-loaded with the action, then prerequisites, side effects, and errors, with zero filler. Every sentence contributes operational information.

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 mutation tool with an output schema, the description covers prerequisites, destructive behavior (script replacement), auto-save, return shape, and both failure modes plus the runtime blocker and its clear command. Nothing an agent needs to call it correctly is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so all four parameters are already documented with examples (nodePath, scenePath, scriptPath, projectPath). The description adds little parameter-level syntax beyond reiterating that nodePath and scriptPath are resolved on return, so the baseline of 3 applies.

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 names a specific verb (attach) and resource (an existing GDScript file) plus its target (a node in a scene), and the scope is unambiguous against siblings like validate or run_script. An agent can distinguish this tool's job 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 Guidelines4/5

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

It states the prerequisite workflow explicitly ('after writing the script with the standard file tools and validating it via the validate tool') and the blocking condition (runtime session active, cleared by stop_project/detach_project). It does not, however, point to an alternative for cases where attaching is the wrong choice versus run_script.

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