Document pydantic.ValidationError in client Raises sections (#3036)

This commit is contained in:
Max 2026-07-01 00:03:17 +01:00 • committed by GitHub
commit dcf8a6a0b5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View file

@ -629,6 +629,8 @@ class Client:
Raises:
InputRequiredRoundsExceededError: `input_required_max_rounds` exhausted.
MCPError: A callback returned `ErrorData` for an embedded input request.
pydantic.ValidationError: The server returned a result that does not
conform to the negotiated protocol version.
"""
async def retry(r: InputResponses | None, s: str | None) -> ReadResourceResult | InputRequiredResult:
@ -711,6 +713,8 @@ class Client:
Raises:
InputRequiredRoundsExceededError: `input_required_max_rounds` exhausted.
MCPError: A callback returned `ErrorData` for an embedded input request.
pydantic.ValidationError: The server returned a result that does not
conform to the negotiated protocol version.
"""
async def retry(r: InputResponses | None, s: str | None) -> CallToolResult | InputRequiredResult | Result:
@ -787,6 +791,8 @@ class Client:
Raises:
InputRequiredRoundsExceededError: `input_required_max_rounds` exhausted.
MCPError: A callback returned `ErrorData` for an embedded input request.
pydantic.ValidationError: The server returned a result that does not
conform to the negotiated protocol version.
"""
async def retry(r: InputResponses | None, s: str | None) -> GetPromptResult | InputRequiredResult:

View file

@ -452,6 +452,8 @@ class ClientSession:
MCPError: Error response, read timeout, or connection closed.
RuntimeError: Called before entering the context manager.
ValueError: The request declares `name_param` but its params carry no string name.
pydantic.ValidationError: The server returned a result that does not
conform to the negotiated protocol version.
"""
data = request.model_dump(by_alias=True, mode="json", exclude_none=True)
method: str = data["method"]