所有工具

file_write

文件与 Finder · macOS · Windows

效果: 写入. 状态: 受限可用.

“受限可用”表示工具可能取决于版本、平台、权限、账户或配置,并不表示它在所有安装中都已启用。

macOS

用途

将文本写入本地文件:创建、覆盖或追加。适用于 .txt/.md/.csv/.json/.log 及任何纯文本或代码文件。(Word 请使用 word_create,Excel 使用 excel_create,PowerPoint 使用 ppt_create。)可写入这台 Mac 上的任何位置,但有两个例外:机器自动执行的文件(shell 启动文件、LaunchAgents、git hooks、AI 客户端配置)和凭据位置绝不会被写入。覆盖现有文件需要 confirm=true(首次调用只返回预览);append=true 会在末尾追加且从不需要确认。缺失的父文件夹会自动创建。

必填输入

输入名称会严格保持工具要求的形式。下方可展开的架构中保留英文规范技术定义。

权限与确认

架构声明了明确的确认参数。请检查预览,并按此平台的契约授权实际操作。

英文规范技术架构macOS
{
  "properties": {
    "append": {
      "description": "Append to the end instead of overwriting (default false)",
      "type": "boolean"
    },
    "confirm": {
      "description": "Required (true) to OVERWRITE an existing file. Not needed to create a new file or to append.",
      "type": "boolean"
    },
    "content": {
      "description": "Text content to write",
      "type": "string"
    },
    "path": {
      "description": "Absolute path to the file to write",
      "type": "string"
    }
  },
  "required": [
    "path",
    "content"
  ],
  "type": "object"
}

文档示例

file_write 的文档示例。请勿执行此示例。所示参数属于虚构数据集;在实际调用前,请解析真实标识符并获得授权。

{
  "confirm": false,
  "content": "Meeting agenda: review the launch checklist.",
  "path": "/Users/demo/Documents/meeting-notes.txt"
}

Windows

用途

将文本写入本地文件:创建、覆盖或追加。路径必须位于允许的文件夹内(默认为主目录;可通过配置键 fs_allowed_roots 扩展)。缺失的父文件夹会自动创建。覆盖现有文件需要 confirm=true(首次调用只返回预览);创建新文件以及 append=true 均无需确认。

必填输入

输入名称会严格保持工具要求的形式。下方可展开的架构中保留英文规范技术定义。

权限与确认

架构声明了明确的确认参数。请检查预览,并按此平台的契约授权实际操作。

英文规范技术架构Windows
{
  "properties": {
    "append": {
      "description": "Append to the end instead of overwriting (default false).",
      "type": "boolean"
    },
    "confirm": {
      "description": "Required (true) to OVERWRITE an existing file. Not needed to create a new file or to append.",
      "type": "boolean"
    },
    "content": {
      "description": "Text content to write.",
      "type": "string"
    },
    "path": {
      "description": "Absolute path to the file to write.",
      "type": "string"
    }
  },
  "required": [
    "path",
    "content"
  ],
  "type": "object"
}

文档示例

file_write 的文档示例。请勿执行此示例。所示参数属于虚构数据集;在实际调用前,请解析真实标识符并获得授权。

{
  "confirm": false,
  "content": "Meeting agenda: review the launch checklist.",
  "path": "C:\\Users\\demo\\Documents\\meeting-notes.txt"
}