This commit is contained in:
Danilo Reyes
2026-01-30 23:17:02 -06:00
parent 527fad8da0
commit 97053901c0
17 changed files with 646 additions and 26 deletions

View File

@@ -0,0 +1,25 @@
"""Performance tests for MCP server handlers."""
from __future__ import annotations
import time
from mcp_server.server import handle_request
MAX_LATENCY_SECONDS = 2
def test_list_tools_is_fast() -> None:
"""ListTools responds under the latency target."""
start = time.perf_counter()
handle_request({"method": "listTools", "params": {}})
duration = time.perf_counter() - start
assert duration < MAX_LATENCY_SECONDS
def test_invoke_tool_is_fast() -> None:
"""InvokeTool responds under the latency target."""
start = time.perf_counter()
handle_request({"method": "invokeTool", "params": {"name": "show-constitution", "args": {}}})
duration = time.perf_counter() - start
assert duration < MAX_LATENCY_SECONDS