Skip to main content
Glama

MCP Memory Server

by hannesnortje
test_tool_call.py2.16 kB
#!/usr/bin/env python3 """Test tool calls on the raw MCP server""" import json import subprocess def test_tool_call(): """Test a tool call on the server""" proc = subprocess.Popen( ["poetry", "run", "python", "server_raw.py"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True ) try: # Send initialization request init_request = { "jsonrpc": "2024-11-05", "id": 1, "method": "initialize", "params": { "protocolVersion": "2024-11-05", "capabilities": {} } } proc.stdin.write(json.dumps(init_request) + "\n") proc.stdin.flush() # Read initialization response init_response = proc.stdout.readline() print("Init Response:", json.loads(init_response)) # Send initialized notification initialized_notif = { "jsonrpc": "2024-11-05", "method": "notifications/initialized", "params": {} } proc.stdin.write(json.dumps(initialized_notif) + "\n") proc.stdin.flush() # Test set_agent_context tool tool_request = { "jsonrpc": "2024-11-05", "id": 2, "method": "tools/call", "params": { "name": "set_agent_context", "arguments": { "agent_name": "TestAgent" } } } proc.stdin.write(json.dumps(tool_request) + "\n") proc.stdin.flush() # Read tool response tool_response = proc.stdout.readline() if tool_response: response = json.loads(tool_response) print("✅ Tool Response:") print(json.dumps(response, indent=2)) else: print("❌ No tool response") except Exception as e: print(f"❌ Error: {e}") finally: proc.terminate() proc.wait() if __name__ == "__main__": test_tool_call()

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hannesnortje/MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server