Spaces:
Sleeping
Sleeping
bigwolfe
commited on
Commit
Β·
9b0713d
1
Parent(s):
1cca192
Huge success
Browse files- inspect_mcp_types.py +9 -0
- test_remote_mcp.py +54 -0
inspect_mcp_types.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
from mcp.types import CallToolResult
|
| 3 |
+
import inspect
|
| 4 |
+
|
| 5 |
+
def inspect_call_tool_result():
|
| 6 |
+
print("Fields:", CallToolResult.model_fields.keys())
|
| 7 |
+
|
| 8 |
+
if __name__ == "__main__":
|
| 9 |
+
inspect_call_tool_result()
|
test_remote_mcp.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import requests
|
| 3 |
+
import json
|
| 4 |
+
import sys
|
| 5 |
+
|
| 6 |
+
# Use the public HF Space URL
|
| 7 |
+
BASE_URL = "https://bigwolfe-document-mcp.hf.space/mcp"
|
| 8 |
+
|
| 9 |
+
def test_search_notes():
|
| 10 |
+
print("--- Testing tools/call search_notes ---")
|
| 11 |
+
payload = {
|
| 12 |
+
"jsonrpc": "2.0",
|
| 13 |
+
"method": "tools/call",
|
| 14 |
+
"params": {
|
| 15 |
+
"name": "search_notes",
|
| 16 |
+
"arguments": {"query": "API"}
|
| 17 |
+
},
|
| 18 |
+
"id": 1
|
| 19 |
+
}
|
| 20 |
+
headers = {
|
| 21 |
+
"Content-Type": "application/json",
|
| 22 |
+
"Accept": "application/json, text/event-stream"
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
try:
|
| 26 |
+
response = requests.post(BASE_URL, json=payload, headers=headers, timeout=10)
|
| 27 |
+
print(f"Status: {response.status_code}")
|
| 28 |
+
try:
|
| 29 |
+
data = response.json()
|
| 30 |
+
# print(json.dumps(data, indent=2))
|
| 31 |
+
|
| 32 |
+
res = data.get("result", {})
|
| 33 |
+
if "structuredContent" in res:
|
| 34 |
+
print("β
structuredContent found in result")
|
| 35 |
+
print("Keys:", res["structuredContent"].keys())
|
| 36 |
+
else:
|
| 37 |
+
print("β structuredContent NOT found in result")
|
| 38 |
+
print(json.dumps(res, indent=2))
|
| 39 |
+
|
| 40 |
+
if "_meta" in res:
|
| 41 |
+
print("β
_meta found in result")
|
| 42 |
+
else:
|
| 43 |
+
print("β _meta NOT found in result")
|
| 44 |
+
|
| 45 |
+
except json.JSONDecodeError:
|
| 46 |
+
print("Response not JSON:", response.text)
|
| 47 |
+
|
| 48 |
+
except Exception as e:
|
| 49 |
+
print(f"Request failed: {e}")
|
| 50 |
+
|
| 51 |
+
if __name__ == "__main__":
|
| 52 |
+
# test_read_note()
|
| 53 |
+
test_search_notes()
|
| 54 |
+
# test_read_resource()
|