test_the_refresh_wrapper_preserves_every_tool_schema¶
Tests › tests/test_mcp_server.py
What this test is for
Why it exists
AN INVARIANCE, because the schema is the one served surface a client cannot truncate.
Verifies REQ-DDB-MCP-001 REQ-DDB-QUERY-006 REQ-DDB-QUERY-008 REQ-DDB-QUERY-009
Given
async def hook(target: str | None) -> None: return Nonetools = QueryTools(lambda: "/nonexistent.db", lambda: "/tmp", lambda: [], None)schemas: dict[bool, dict[str, dict]] = {}
When
for wrapped, before in ((False, None), (True, hook)): mcp = MCPServer("schema-probe") register_query_tools(mcp, tools, before) schemas[wrapped] = { name: mcp._tool_manager.get_tool(name).parameters or {} for name in TIER1_TOOLS }for name in TIER1_TOOLS: plain = schemas[False][name].get("properties", {}) hooked = schemas[True][name].get("properties", {}) assert hooked == plain, ( f"{name}'s schema changed when the refresh wrapper was attached, so the " f"parameter descriptions no longer reach the model: {len(plain)} properties " f"unwrapped vs {len(hooked)} wrapped" ) assert plain, f"{name} registered with no parameters at all in either shape"
Then
- —
What it exercises
The parts of the system's flows this test ran, measured by per-test coverage: lit steps ran in this test, dimmed ones did not, and ▶ marks where the test called in. Each title opens the whole flow with these steps lit.
Build, refresh and check the index · 8 of 153 steps
… 22 earlier steps
… 118 later steps
1 more
- clew-mcp — `main` (clew/mcp_server/server.py) · 3 of 17 steps
tests/test_mcp_server.py:3593 · its file's page
What it checks (2)
assert hooked == plain, ( f"{name}'s schema changed when the refresh wrapper was attached, so the " f"parameter descriptions no longer reach the model: {len(plain)} properties " f"unwrapped vs {len(hooked)} wrapped" )not attributedassert plain, f"{name} registered with no parameters at all in either shape"not attributed
Where the product reaches it
index→_index_action→build_or_refresh→_activate_tier1→register_query_tools(flow)
Call flow
What it reaches
Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.
Requirements it verifies (4)
| requirement | linked by | implementers exercised |
|---|---|---|
| REQ-DDB-MCP-001 | catalog | unknown |
| REQ-DDB-QUERY-006 | catalog | unknown |
| REQ-DDB-QUERY-008 | catalog | unknown |
| REQ-DDB-QUERY-009 | catalog | unknown |
Also reaches 3 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-MCP-003 measured
- REQ-DDB-MCP-004 measured
- REQ-DDB-WIKI-054 measured