write_file:null内容双层拒防静默清空;目录目标中文预检;返回值区分新建/覆盖(原N字节);checkToolArgs缺参判定改为null判缺/空串放行;描述补覆盖与UTF-8边界

This commit is contained in:
2026-09-22 22:31:49 +08:00
parent 8d73f4cc55
commit 572107ac2b
3 changed files with 19 additions and 6 deletions
+3 -3
View File
@@ -166,18 +166,18 @@
"type": "function",
"function": {
"name": "write_file",
"description": "Creates a new file or overwrites an existing file with the given content.\n\nUse `edit_file` for targeted changes to existing files. Parent directories are created automatically as needed.",
"description": "Creates a new file or overwrites an existing file with the given content.\n\nParent directories are created automatically, so the path does not need to exist beforehand.\n\nOverwriting replaces the file's entire content irreversibly. If the file already exists, read it first, or use `edit_file` for targeted changes instead.\n\nText is written as UTF-8. To produce binary files, use `terminal` instead.",
"parameters": {
"type": "object",
"required": ["path", "content"],
"properties": {
"path": {
"type": "string",
"description": "Path of the file to create or overwrite, relative to the session working directory. Absolute paths are also accepted."
"description": "Path of the file to create or overwrite, relative to the session working directory. Absolute paths inside the working directory are also accepted."
},
"content": {
"type": "string",
"description": "The entire content to write to the file."
"description": "The entire content to write. Required — pass an empty string to create an empty file; omitting it is an error."
}
}
}