Skip to main content
Glama

script

Destructive

Read, write, edit, execute, test, and batch-replace GDScript files within Godot projects, integrating script operations into the assistant's workflow.

Instructions

脚本操作。读写: read_script, write_script。编辑: edit_script(行号/search_and_replace)。执行: execute_gdscript(⚠️ 沙箱仅防误操作,不可用于不可信输入。高安全场景请用 ALLOW_EXECUTE_GDSCRIPT=false 或容器隔离)。⚠️ write_script/edit_script 写入 .gd 前也走沙箱扫描(防 @tool 脚本加载即执行等已知危险 API 模式(清单不列举,防沙箱边界被侦察);与 execute_gdscript 同威胁面)。测试: generate_test, create_test_scene。批量替换: project_replace。💡 execute_gdscript 最佳实践:分步执行、每步验证(把复杂逻辑拆成小块逐一跑,每步用 read_script/edit_script 迭代,避免一次性大脚本出错难定位)。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeNoexecute_gdscript: 要执行的 GDScript 代码
actionYes操作类型
searchNoproject_replace: 搜索文本
contentNowrite_script: GDScript 内容
dry_runNoproject_replace: 仅预览不写入(默认 false)
replaceNoproject_replace: 替换文本
timeoutNoexecute_gdscript: 超时秒数(默认 30)
end_lineNoedit_script: 替换结束行(1-based,含)
overwriteNowrite_script: 覆盖已有文件(默认 false)
extensionsNoproject_replace: 文件扩展名(默认 [".gd"])
godot_pathNo覆盖 Godot 二进制路径(可选,优先于项目配置和环境变量)
start_lineNoedit_script: 替换起始行(1-based)
indent_modeNoedit_script: 缩进模式(默认 raw)raw
new_contentNoedit_script: 替换内容
script_pathNoread_script 用绝对路径;write_script/edit_script/generate_test 用绝对或相对项目路径
exclude_dirsNoproject_replace: 排除目录(默认 [".godot", ".import"])
project_pathNoGodot 项目目录路径(可选,默认使用 GODOT_PROJECT_PATH 环境变量或当前目录)
auto_validateNoedit_script: 自动验证语法并在失败时回滚(默认 true)
load_autoloadsNoexecute_gdscript: 省略时自动检测 autoload 引用;显式 true/false 覆盖自动检测
verify_contentNoedit_script: 期望内容守卫(不匹配则中止)
search_and_replaceNoedit_script: 内容搜索替换模式(提供时忽略 start_line/end_line)
Behavior4/5

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

Exposes significant behavioral traits beyond the false-boolean annotations: the sandbox is only protection against accidents, not against untrusted input; write_script/edit_script enter the same threat surface as execute_gdscript via pre-write scanning; the dangerous-pattern list is deliberately hidden to prevent sandbox-boundary probing. This gives agents the true security model and the reason for information withholding. Misses some specific write-behavior details (output/return behavior, confirmation flow), so not a 5.

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?

The description is dense and front-loaded: the action list appears in the first few words, and every sentence carries meaningful security or usage content. It loses a point for being one long flowing block — the two important caveats are embedded mid-sentence, and explicit line breaks or bullets would improve agent scanning.

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?

For a tool with 21 parameters, 7 actions, nested objects with no output schema, the description supplies the high-value operational context (security threat model, sandbox boundaries, execute best practices). The remaining gaps are noticeable but not blocking: no statement of return/output behavior, and no mention of whether destructive actions need additional confirmation or iterate (e.g., project_replace write visibility).

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 every parameter is already documented in the input schema. The description adds essentially nothing beyond the schema: it references edit_script's line-number/search_and_replace and project_replace's bulk replacement, which the schema already captures in parameter descriptions. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description gives 'script operations' as the domain and enumerates all seven actions with their verb categories: read/write (read_script, write_script), edit (edit_script), execute (execute_gdscript), test (generate_test, create_test_scene), bulk replace (project_replace). This clearly distinguishes the internal actions, though it stays a dispatcher-level description and does not differentiate from sibling tools like 'cpp' explicitly.

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?

Provides explicit routing guidance for every action family, and goes further: it says when NOT to trust execute_gdscript (untrusted input), when to use ALLOW_EXECUTE_GDSCRIPT=false, and recommends a step-by-step 'execute-verify-iterate' pattern for complex logic. Lacks explicit comparison to sibling tools, so it earns a 4 rather than a 5.

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/wgt19861219/godot-mcp-enhanced'

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