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

Function demo_write_tool

examples/01_basic_tools.py:19–37  ·  view source on GitHub ↗

Demo: Write a new file.

()

Source from the content-addressed store, hash-verified

17
18
19async def demo_write_tool():
20 """Demo: Write a new file."""
21 print("\n" + "=" * 60)
22 print("Demo 1: WriteTool - Create a new file")
23 print("=" * 60)
24
25 with tempfile.TemporaryDirectory() as tmpdir:
26 file_path = Path(tmpdir) / "hello.txt"
27
28 tool = WriteTool()
29 result = await tool.execute(
30 path=str(file_path), content="Hello, Mini Agent!\nThis is a test file."
31 )
32
33 if result.success:
34 print(f"✅ File created: {file_path}")
35 print(f"Content:\n{file_path.read_text()}")
36 else:
37 print(f"❌ Failed: {result.error}")
38
39
40async def demo_read_tool():

Callers 1

mainFunction · 0.85

Calls 2

executeMethod · 0.95
WriteToolClass · 0.90

Tested by

no test coverage detected