From a08a6f95f1fa95fef8a1e3679d40c81ee6b729b1 Mon Sep 17 00:00:00 2001 From: lxcxjxhx Date: Wed, 11 Nov 2026 12:49:10 +0800 Subject: [PATCH] docs(client): complete the Args blocks in ClientSession MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `read_resource`, `send_request`, `call_tool` and `get_prompt` each document only the input-required kwargs. The block was written once and copied, so every one of them hides the parameters a caller has to pass: - `send_request` documented `metadata` and omitted `request`, `result_type`, `request_read_timeout_seconds`, `progress_callback`. - `read_resource` omitted `uri` — the only parameter without a default — and `meta`. - `call_tool` omitted `name`, `arguments`, `read_timeout_seconds`, `progress_callback`, `meta`. - `get_prompt` omitted `name`, `arguments`, `meta`. Docstrings only: an AST comparison against the previous head is identical once docstrings are excluded, and every parameter of the four methods now appears in its Args block. `pytest tests/client/test_session.py` -> 94 passed; `ruff check` and `ruff format --check` pass. --- src/mcp/client/session.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/mcp/client/session.py b/src/mcp/client/session.py index 35cae2d314..03c03efcfb 100644 --- a/src/mcp/client/session.py +++ b/src/mcp/client/session.py @@ -548,7 +548,11 @@ async def send_request( """Send a request and wait for its typed result. Args: + request: The request to send. + result_type: The expected result type, or a `TypeAdapter` for it. + request_read_timeout_seconds: Per-request read timeout in seconds. metadata: Streamable HTTP resumption hints. + progress_callback: Called with progress notifications for this request. Raises: MCPError: Error response, read timeout, or connection closed. @@ -942,8 +946,10 @@ async def read_resource( """Send a resources/read request. Args: + uri: The resource URI to read. input_responses: Responses to a prior `InputRequiredResult.input_requests`. request_state: Opaque state echoed from a prior `InputRequiredResult`. + meta: Request metadata, forwarded as `_meta`. allow_input_required: When `False` (default), an `InputRequiredResult` from the server raises `RuntimeError`; when `True`, it is returned so the caller can resolve the requests and retry. @@ -1070,8 +1076,13 @@ async def call_tool( the tool before calling it to enable header emission. Args: + name: The tool name. + arguments: The tool arguments, or `None` for a tool that takes none. + read_timeout_seconds: Per-request read timeout in seconds. + progress_callback: Called with progress notifications for this call. input_responses: Responses to a prior `InputRequiredResult.input_requests`. request_state: Opaque state echoed from a prior `InputRequiredResult`. + meta: Request metadata, forwarded as `_meta`. allow_input_required: When ``False`` (default), an `InputRequiredResult` from the server raises `RuntimeError`; when ``True``, it is returned so the caller can resolve the requests and retry. @@ -1227,8 +1238,11 @@ async def get_prompt( """Send a prompts/get request. Args: + name: The prompt name. + arguments: The prompt arguments, or `None` for a prompt that takes none. input_responses: Responses to a prior `InputRequiredResult.input_requests`. request_state: Opaque state echoed from a prior `InputRequiredResult`. + meta: Request metadata, forwarded as `_meta`. allow_input_required: When `False` (default), an `InputRequiredResult` from the server raises `RuntimeError`; when `True`, it is returned so the caller can resolve the requests and retry.