Skip to main content
Glama
test_tool_bridge_runtime.py1.08 kB
import aiohttp import pytest from mcp_code_mode.tool_bridge import MCPToolBridge class DummyTool: def __init__(self): self.name = "echo" self.calls = [] async def acall(self, **kwargs): self.calls.append(kwargs) return kwargs @pytest.mark.asyncio async def test_tool_bridge_handles_calls(): tool = DummyTool() bridge = MCPToolBridge([tool]) try: await bridge.start() except PermissionError as exc: # pragma: no cover - CI may restrict sockets pytest.skip(f"socket binding not permitted: {exc}") session = await bridge.create_session(timeout=10) async with aiohttp.ClientSession() as client: resp = await client.post( session["endpoint"], json={ "token": session["token"], "name": "echo", "params": {"value": 42}, }, ) data = await resp.json() await bridge.stop() assert data["success"] is True assert data["result"] == {"value": 42} assert tool.calls == [{"value": 42}]

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/draphonix/mcp-code-mode'

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