-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_mcp_tool.py
More file actions
51 lines (42 loc) · 1.63 KB
/
test_mcp_tool.py
File metadata and controls
51 lines (42 loc) · 1.63 KB
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
#!/usr/bin/env python3
"""Test create_network_map MCP tool"""
import sys
import time
from mcp.types import ImageContent, TextContent
from lab_testing.server.tool_handlers import handle_tool
# Simulate MCP tool call
request_id = "test_123"
start_time = time.time()
arguments = {"quick_mode": True, "scan_networks": False, "test_configured_devices": True}
print("Calling create_network_map via MCP tool handler...")
print("=" * 70)
try:
result = handle_tool("create_network_map", arguments, request_id, start_time)
print(f"Returned {len(result)} content item(s):")
print()
for i, content in enumerate(result, 1):
if isinstance(content, TextContent):
print(f"Content {i}: TextContent")
text = content.text
if text.startswith("```mermaid"):
print(" Type: Mermaid Diagram (PRIMARY)")
print(f" Length: {len(text)} characters")
print("\n" + "=" * 70)
print("FULL MERMAID DIAGRAM:")
print("=" * 70)
print(text)
print("=" * 70)
else:
print(" Type: Text")
print(f" Length: {len(text)} characters")
print(f" Preview: {text[:200]}...")
elif isinstance(content, ImageContent):
print(f"Content {i}: ImageContent (FALLBACK)")
print(f" MIME Type: {content.mimeType}")
print(f" Data length: {len(content.data)} bytes (base64)")
print(f" Preview: {content.data[:100]}...")
print()
except Exception as e:
print(f"Error: {e}")
import traceback
traceback.print_exc()