32 lines
898 B
Python
32 lines
898 B
Python
"""Tool registry tests."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from mcp_server import tools
|
|
|
|
MIN_TOOLS = 5
|
|
|
|
|
|
def test_tool_catalog_has_minimum_tools() -> None:
|
|
"""Catalog includes baseline tools."""
|
|
catalog = tools.tool_catalog()
|
|
assert len(catalog) >= MIN_TOOLS
|
|
names = {tool.name for tool in catalog}
|
|
assert "show-constitution" in names
|
|
assert "list-playbooks" in names
|
|
assert "show-reference" in names
|
|
|
|
|
|
def test_invoke_tool_handles_unknown() -> None:
|
|
"""Unknown tool returns unsupported guidance."""
|
|
result = tools.invoke_tool("missing-tool", {})
|
|
assert result["status"] == "unsupported"
|
|
assert "listTools" in result["actions"][0]
|
|
|
|
|
|
def test_list_tools_payload_shape() -> None:
|
|
"""Payload includes tools key."""
|
|
payload = tools.list_tools_payload()
|
|
assert "tools" in payload
|
|
assert all("name" in entry for entry in payload["tools"])
|