-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_mcp_tools.py
62 lines (48 loc) · 2.15 KB
/
test_mcp_tools.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env python3
"""
Test script for MCP tools using the MCP client.
"""
import asyncio
import json
from src.mcp_agile_flow import call_tool, call_tool_sync
async def test_tools_async():
"""Test the tools using the async interface."""
print("Testing tools using async interface...")
# Clear any existing thoughts
clear_result = await call_tool("clear-thoughts")
print("Clear thoughts result:", json.dumps(clear_result, indent=2))
# Add a thought
think_result = await call_tool("think", {"thought": "This is a test thought from async."})
print("Think result:", json.dumps(think_result, indent=2))
# Get thoughts
get_result = await call_tool("get-thoughts")
print("Get thoughts result:", json.dumps(get_result, indent=2))
# Try with underscore version
get_result_underscore = await call_tool("get_thoughts")
print("Get thoughts result (underscore):", json.dumps(get_result_underscore, indent=2))
# Get stats
stats_result = await call_tool("get-thought-stats")
print("Get stats result:", json.dumps(stats_result, indent=2))
def test_tools_sync():
"""Test the tools using the sync interface."""
print("\nTesting tools using sync interface...")
# Clear any existing thoughts
clear_result = call_tool_sync("clear-thoughts")
print("Clear thoughts result:", json.dumps(clear_result, indent=2))
# Add a thought
think_result = call_tool_sync("think", {"thought": "This is a test thought from sync."})
print("Think result:", json.dumps(think_result, indent=2))
# Get thoughts
get_result = call_tool_sync("get-thoughts")
print("Get thoughts result:", json.dumps(get_result, indent=2))
# Try with underscore version
get_result_underscore = call_tool_sync("get_thoughts")
print("Get thoughts result (underscore):", json.dumps(get_result_underscore, indent=2))
# Get stats
stats_result = call_tool_sync("get-thought-stats")
print("Get stats result:", json.dumps(stats_result, indent=2))
if __name__ == "__main__":
# Run the async test
asyncio.run(test_tools_async())
# Run the sync test
test_tools_sync()