Skip to content

fix #516: follow tools/list pagination - #517

Open
AnKiT-GaRG2 wants to merge 1 commit into
CraftOS-dev:devfrom
AnKiT-GaRG2:fix/mcp-tool-errors-and-pagination
Open

AnKiT-GaRG2 wants to merge 1 commit into
CraftOS-dev:devfrom
AnKiT-GaRG2:fix/mcp-tool-errors-and-pagination

Conversation

@AnKiT-GaRG2

@AnKiT-GaRG2 AnKiT-GaRG2 commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

What

  • _discover_tools follows nextCursor across tools/list pages, with a guard against a repeated cursor.
  • Add tests/test_mcp_tools_list_pagination.py (2 tests).

Rebased onto current dev. The isError half of the original PR is dropped: dev already reports isError: true results as errors since v1.4.5 (#534), and its tests cover that.

Why

tools/list is paginated in the MCP spec, so servers with paged tool lists lost every tool after the first page.

Closes #516

How to test

pytest tests/test_mcp_tools_list_pagination.py tests/test_mcp_stdio_spawn.py
ruff format --check . && ruff check .

On current dev both new tests fail; with this change they pass, and the other MCP tests still pass. Ruff 0.16.1 (the CI pin) is clean on the changed files.

Screenshots / Logs

Earlier live check, same pagination code: a stdio server built on the official MCP Python SDK (mcp 2.3.0) that pages its 5 tools two at a time, driven through CraftBot's MCPServerConnection. On dev (af80866) it discovered t1, t2; with this change it discovered t1, t2, t3, t4, t5. Not re-run after this rebase.

@AnKiT-GaRG2

Copy link
Copy Markdown
Contributor Author

Rebased onto current dev, which fixes the merge conflicts. The branch had been cut from an older base and carried unrelated release commits. It is now a single commit touching server.py and tests/test_mcp_tool_results.py, and the code is unchanged. The new tests and the stdio spawn tests pass and Ruff is clean. It's ready for review whenever it fits the V1.4.5 cycle.

@ahmad-ajmal
ahmad-ajmal force-pushed the dev branch 2 times, most recently from c8365d2 to 57aed8d Compare November 20, 2026 10:15
tools/list is paginated by the MCP spec, but discovery stopped after the
first page, so every tool past it was lost. Follow nextCursor until the
server stops returning one, and stop on a repeated cursor.

Signed-off-by: Ankit Garg <146389256+AnKiT-GaRG2@users.noreply.github.com>
@AnKiT-GaRG2
AnKiT-GaRG2 force-pushed the fix/mcp-tool-errors-and-pagination branch from 125d9c1 to eba55ec Compare December 1, 2026 09:26
@AnKiT-GaRG2 AnKiT-GaRG2 changed the title fix #516: report MCP tool errors and follow tools/list pagination fix #516: follow tools/list pagination Dec 1, 2026
@AnKiT-GaRG2
AnKiT-GaRG2 marked this pull request as ready for review December 1, 2026 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant