feat(client): add list_all_* helpers that drain pagination

Closed
SA
3mo ago
+350-0

Closes #2556.

The single-page list_tools / list_resources / list_resource_templates /
list_prompts methods on ClientSession return the server's first page plus
a next_cursor; callers that don't loop on the cursor silently see only
page zero. Four new list_all_* helpers drain the cursor until the server
stops sending one and return the flattened list:

list_all_tools() -> list[Tool]
list_all_resources() -> list[Resource]
list_all_resource_templates() -> list[ResourceTemplate]
list_all_prompts() -> list[Prompt]

Each helper reuses the existing public list_* method, so per-page
post-processing keeps running across the drain (notably the 2026
x-mcp-header filter inside _absorb_tool_listing). Single-page and
empty-list cases work without looping.

Tests cover multi-page drain, single-page short-circuit, empty
result, helpers-don't-share-cursor-state, terminal-empty-page-stops
the loop, and cursor-roundtrip (server's next_cursor comes back
unchanged as params.cursor on the next request). 9 new tests in
tests/client/test_client.py; full client test suite (121 tests) passes,
ruff lint + format clean.

Addresses the design sketch in @agaonker's earlier comment on #2556
(same return type, helper naming, cursor-drain loop, malformed-cursor
safety via None-termination).