Skip to content

edit

用途

在现有文件中做精确文本替换。

常见参数

参数说明
path / file_path目标文件
oldText / old_string要匹配的原文本,必须精确匹配
newText / new_string替换后的新文本

请求示例

json
{
  "path": "/workspace/docs/index.md",
  "oldText": "旧标题",
  "newText": "新标题"
}

返回示例

成功时通常表示替换已完成;失败时多半是未找到精确匹配文本。

常见误用

  • oldText 写得太短或太模糊
  • 不考虑空格和换行
  • 文件已变更却继续用旧片段替换

聚焦 OpenClaw、tool_calls、function calling 与 agent 实战。