test_stdio_run_advertises_tool_list_changed¶
Tests › tests/test_mcp_server.py
What this test is for
Why it exists
The stdio transport must advertise tools.listChanged=True — a client told otherwise has no reason to re-read tools/list when tier-1 appears.
Verifies REQ-DDB-MCP-003 REQ-DDB-QUERY-006 REQ-DDB-QUERY-008 REQ-DDB-QUERY-009
Given
mcp_server, _state = servercaptured: dict[str, object] = {}
3 more
async def _fake_stdio(): yield (None, None)async def _fake_run(_read, _write, options, *args, **kwargs): captured["options"] = optionsmonkeypatch.setattr(stdio_mod, "stdio_server", _fake_stdio)
When
monkeypatch.setattr(lowlevel(mcp_server), "run", _fake_run)await run_stdio(mcp_server)caps = captured["options"].capabilitiesspellings = [s for s in ("listChanged", "list_changed") if hasattr(caps.tools, s)]
Then
- ✓ caps.tools is not None
- ✓ spellings holds
- ✓ getattr(caps.tools, spellings[0]) is True
tests/test_mcp_server.py:869 · its file's page
What it checks (3)
assert caps.tools is not Nonenot attributedassert spellings, ( f"ToolsCapability has neither listChanged nor list_changed: {dir(caps.tools)} — " "the SDK renamed the tool-list-changed capability again" )not attributedassert getattr(caps.tools, spellings[0]) is Truenot attributed
Where the product reaches it
main→build_server→lowlevel(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-003 | catalog | unknown |
| REQ-DDB-QUERY-006 | catalog | unknown |
| REQ-DDB-QUERY-008 | catalog | unknown |
| REQ-DDB-QUERY-009 | catalog | unknown |
Also reaches 2 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-MCP-001 measured
- REQ-DDB-WIKI-054 measured