MCPcopy Create free account
hub / github.com/Louisym/MiniCC / execute_write_file

Function execute_write_file

tutorials/03_tool_system.py:183–196  ·  view source on GitHub ↗

写入文件内容(简化版)。 对应源码: rust/crates/runtime/src/file_ops.rs

(params: dict)

Source from the content-addressed store, hash-verified

181
182
183def execute_write_file(params: dict) -> str:
184 """
185 写入文件内容(简化版)。
186 对应源码: rust/crates/runtime/src/file_ops.rs
187 """
188 path = params["path"]
189 content = params["content"]
190
191 try:
192 with open(path, "w", encoding="utf-8") as f:
193 f.write(content)
194 return f"Successfully wrote {len(content)} chars to {path}"
195 except Exception as e:
196 return f"[error] {e}"
197
198
199def execute_grep(params: dict) -> str:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected