mattrguerra/meridian-crm-mcpmainPrivate on GitHub, published here in full

test_tool_api.py

Language Python804 B22 lines

tests/test_tool_api.py

  1. """The 30 tools' names, descriptions (docstrings) and parameter schemas are the
  2. model-facing API. tool_api.json is the recorded contract; a change here is a
  3. change to what the model sees and should be deliberate."""
  4. import asyncio
  5. import json
  6. from pathlib import Path
  7. import server
  8. CONTRACT = Path(__file__).with_name("tool_api.json")
  9. def test_tool_api_matches_recorded_contract():
  10. tools = asyncio.run(server.mcp.list_tools())
  11. current = {t.name: {"description": t.description,
  12. "inputSchema": json.loads(json.dumps(t.inputSchema))} for t in tools}
  13. recorded = json.loads(CONTRACT.read_text(encoding="utf-8"))
  14. assert len(current) == 30
  15. assert sorted(current) == sorted(recorded)
  16. for name in recorded:
  17. assert current[name] == recorded[name], name