Skip to main content
Glama

mcp-server-public-transport

test_ch.py1.38 kB
import pytest from fastmcp import FastMCP from tools.ch import register_ch_tools @pytest.fixture def mcp(): return FastMCP("test-ch") @pytest.fixture(autouse=True) def mock_fetch_json(monkeypatch): async def dummy(url, params): return {"dummy": True} monkeypatch.setattr("tools.ch.fetch_json", dummy) return dummy class TestCHTools: @pytest.mark.unit async def test_ch_search_connections(self, mcp): tools = register_ch_tools(mcp) fn = next(t for t in tools if t.name == "ch_search_connections") result = await fn.fn("Bern", "Zurich") assert result == {"dummy": True} @pytest.mark.unit async def test_ch_search_stations(self, mcp): fn = next(t for t in register_ch_tools(mcp) if t.name == "ch_search_stations") result = await fn.fn("Bern") assert result == {"dummy": True} @pytest.mark.unit async def test_ch_get_departures(self, mcp): fn = next(t for t in register_ch_tools(mcp) if t.name == "ch_get_departures") result = await fn.fn("Zurich HB", limit=5) assert result == {"dummy": True} @pytest.mark.unit async def test_ch_nearby_stations(self, mcp): fn = next(t for t in register_ch_tools(mcp) if t.name == "ch_nearby_stations") result = await fn.fn(47.37, 8.54, distance=500) assert result == {"dummy": True}

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/mirodn/mcp-server-public-transport'

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