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

Function demo_read_tool

examples/01_basic_tools.py:40–60  ·  view source on GitHub ↗

Demo: Read a file.

()

Source from the content-addressed store, hash-verified

38
39
40async def demo_read_tool():
41 """Demo: Read a file."""
42 print("\n" + "=" * 60)
43 print("Demo 2: ReadTool - Read file contents")
44 print("=" * 60)
45
46 with tempfile.NamedTemporaryFile(mode="w", delete=False, suffix=".txt") as f:
47 f.write("Line 1: Hello\nLine 2: World\nLine 3: Mini Agent")
48 temp_path = f.name
49
50 try:
51 tool = ReadTool()
52 result = await tool.execute(path=temp_path)
53
54 if result.success:
55 print(f"✅ File read successfully")
56 print(f"Content:\n{result.content}")
57 else:
58 print(f"❌ Failed: {result.error}")
59 finally:
60 Path(temp_path).unlink()
61
62
63async def demo_edit_tool():

Callers 1

mainFunction · 0.85

Calls 2

executeMethod · 0.95
ReadToolClass · 0.90

Tested by

no test coverage detected