test_stdio_run_advertises_tool_list_changed

Tests › tests/test_mcp_server.py

passed Passed in the packaged run.

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

  1. mcp_server, _state = server
  2. captured: dict[str, object] = {}
3 more
  1. async def _fake_stdio(): yield (None, None)
  2. async def _fake_run(_read, _write, options, *args, **kwargs): captured["options"] = options
  3. monkeypatch.setattr(stdio_mod, "stdio_server", _fake_stdio)
→

When

  1. monkeypatch.setattr(lowlevel(mcp_server), "run", _fake_run)
  2. await run_stdio(mcp_server)
  3. caps = captured["options"].capabilities
  4. spellings = [s for s in ("listChanged", "list_changed") if hasattr(caps.tools, s)]
→

Then

  1. ✓ caps.tools is not None
  2. ✓ spellings holds
  3. ✓ getattr(caps.tools, spellings[0]) is True

tests/test_mcp_server.py:869 · its file's page

What it checks (3)

  1. assert caps.tools is not None not attributed
  2. assert spellings, ( f"ToolsCapability has neither listChanged nor list_changed: {dir(caps.tools)} — " "the SDK renamed the tool-list-changed capability again" ) not attributed
  3. assert getattr(caps.tools, spellings[0]) is True not attributed

Where the product reaches it

  • main → build_server → lowlevel (flow)

Call flow

test_stdio_run_advertises_tool_list_changed→lowlevel→run_stdio

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.

test_stdio_run_advertises_tool_list_changed · 3 checkslowlevelREQ-DDB-MCP-001 · measuredrun_stdio_init_optionsREQ-DDB-WIKI-054 · measured

Requirements it verifies (4)

requirementlinked byimplementers exercised
REQ-DDB-MCP-003catalogunknown
REQ-DDB-QUERY-006catalogunknown
REQ-DDB-QUERY-008catalogunknown
REQ-DDB-QUERY-009catalogunknown
Also reaches 2 requirements

Its run touches their code; that is reach, not proof.