test_tool_api.py
Language Python804 B22 lines
"""The 30 tools' names, descriptions (docstrings) and parameter schemas are themodel-facing API. tool_api.json is the recorded contract; a change here is achange to what the model sees and should be deliberate."""import asyncioimport jsonfrom pathlib import Pathimport serverCONTRACT = Path(__file__).with_name("tool_api.json")def test_tool_api_matches_recorded_contract():tools = asyncio.run(server.mcp.list_tools())current = {t.name: {"description": t.description,"inputSchema": json.loads(json.dumps(t.inputSchema))} for t in tools}recorded = json.loads(CONTRACT.read_text(encoding="utf-8"))assert len(current) == 30assert sorted(current) == sorted(recorded)for name in recorded:assert current[name] == recorded[name], name