Skip to main content
Glama

script_patch

Replace exact text in a GDScript file and reload it to apply changes. Requires a unique match unless replace_all is set; fails if no match is found.

Instructions

Anchor-based string-replace edit on a .gd file.

Finds an exact old_text and replaces with new_text. Fails on multiple matches unless replace_all=True; fails on zero matches. Exact byte match (whitespace significant). Triggers filesystem scan and refreshes an already-loaded GDScript in place so the next call runs the new code (response reloaded=true; otherwise reload_reason says why). Not undoable via Ctrl+Z.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesres:// path ending in .gd.
new_textYesReplacement (empty deletes).
old_textYesExact substring to find. Must be unique unless replace_all.
session_idNoOptional Godot session to target. Empty = active session.
replace_allNoReplace every occurrence. Default False.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv3.1.4
  2. Removedv3.0.7
  3. First observedv2.9.1

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It explicitly states failure modes (multiple/zero matches), exact byte matching, whitespace significance, filesystem scan behavior, in-place reload of loaded scripts, the reloaded/reload_reason response signal, and non-undoability. This is exemplary transparency.

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 compact, front-loaded with the core purpose, and every sentence adds essential operational detail. There is no filler, repetition, or unnecessary context. It fits substantial behavioral information into a tight structure.

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?

Given the tool's modest complexity, full schema coverage, and an output schema, the description is complete. It covers matching behavior, failure conditions, side effects on loaded scripts, response hints, and undoability. An agent has enough context to invoke the tool correctly and anticipate outcomes.

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. The description adds meaning beyond the schema by explaining the uniqueness requirement for old_text, the replace_all fallback, the exact-match/whitespace-sensitive semantics, and the reload consequence of a patch. This exceeds the schema's simple property descriptions.

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 opens with a clear verb and resource: 'Anchor-based string-replace edit on a .gd file.' It further specifies the exact operation (find old_text, replace with new_text) and distinguishes this from siblings like script_create or script_manage by focusing on in-place patching.

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 description clearly situates the tool as an editing operation on existing GDScript files, with detailed constraints about matches and reload behavior. It does not explicitly name alternatives or exclusion conditions, but the intended use case is strongly implied and unlikely to be confused with creation or management tools.

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