rohitg00/ai-engineering-from-scratch · error · ContractViolation
tools/list page limit must be a positive integer
Error message
tools/list page limit must be a positive integer
What it means
Error "tools/list page limit must be a positive integer" thrown in rohitg00/ai-engineering-from-scratch.
Source
Thrown at phases/13-tools-and-protocols/28-mcp-tool-contracts-and-content/code/main.py:680
"error": {
"code": -32020,
"message": "parameter headers do not match request body",
"data": {"reason": str(exc)},
},
}
return 200, server.dispatch(request, principal=principal)
class ContractClient:
def __init__(
self,
server: ContractServer,
*,
principal: str = "analyst",
max_list_pages: int = MAX_TOOL_LIST_PAGES,
) -> None:
if type(max_list_pages) is not int or max_list_pages <= 0:
raise ContractViolation("tools/list page limit must be a positive integer")
self.server = server
self.principal = principal
self.max_list_pages = max_list_pages
self.rejections: list[dict[str, str]] = []
self.cursor_trace: list[str | None] = []
self.tools: dict[str, dict[str, Any]] = {}
def discover_tools(self) -> dict[str, dict[str, Any]]:
cursor: str | None = None
request_id = 1
seen_cursors: set[str] = set()
for _ in range(self.max_list_pages):
params: dict[str, Any] = {}
if cursor is not None:
params["cursor"] = cursor
self.cursor_trace.append(cursor)
response = self.server.dispatch(make_request(request_id, "tools/list", params))
if response is None or "error" in response:View on GitHub (pinned to 39ea8a1c6d)
When it happens
Trigger: Thrown at phases/13-tools-and-protocols/28-mcp-tool-contracts-and-content/code/main.py:680 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of rohitg00/ai-engineering-from-scratch@39ea8a1c6d (2026-08-26).
Data as JSON: /api/errors/42d4c22921a5959e.
Report an issue: GitHub.