MCPcopy Create free account
hub / github.com/MiniMax-AI/Mini-Agent / execute

Method execute

mini_agent/tools/file_tools.py:195–209  ·  view source on GitHub ↗

Execute write file.

(self, path: str, content: str)

Source from the content-addressed store, hash-verified

193 }
194
195 async def execute(self, path: str, content: str) -> ToolResult:
196 """Execute write file."""
197 try:
198 file_path = Path(path)
199 # Resolve relative paths relative to workspace_dir
200 if not file_path.is_absolute():
201 file_path = self.workspace_dir / file_path
202
203 # Create parent directories if they don't exist
204 file_path.parent.mkdir(parents=True, exist_ok=True)
205
206 file_path.write_text(content, encoding="utf-8")
207 return ToolResult(success=True, content=f"Successfully wrote to {file_path}")
208 except Exception as e:
209 return ToolResult(success=False, content="", error=str(e))
210
211
212class EditTool(Tool):

Callers 2

test_write_toolFunction · 0.95
demo_write_toolFunction · 0.95

Calls 1

ToolResultClass · 0.85

Tested by 1

test_write_toolFunction · 0.76