Skip to content

Commit a08a6f9

Browse files
committed
docs(client): complete the Args blocks in ClientSession
`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.
1 parent 77001c9 commit a08a6f9

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎src/mcp/client/session.py‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,11 @@ async def send_request(
548548
"""Send a request and wait for its typed result.
549549
550550
Args:
551+
request: The request to send.
552+
result_type: The expected result type, or a `TypeAdapter` for it.
553+
request_read_timeout_seconds: Per-request read timeout in seconds.
551554
metadata: Streamable HTTP resumption hints.
555+
progress_callback: Called with progress notifications for this request.
552556
553557
Raises:
554558
MCPError: Error response, read timeout, or connection closed.
@@ -942,8 +946,10 @@ async def read_resource(
942946
"""Send a resources/read request.
943947
944948
Args:
949+
uri: The resource URI to read.
945950
input_responses: Responses to a prior `InputRequiredResult.input_requests`.
946951
request_state: Opaque state echoed from a prior `InputRequiredResult`.
952+
meta: Request metadata, forwarded as `_meta`.
947953
allow_input_required: When `False` (default), an `InputRequiredResult`
948954
from the server raises `RuntimeError`; when `True`, it is returned
949955
so the caller can resolve the requests and retry.
@@ -1070,8 +1076,13 @@ async def call_tool(
10701076
the tool before calling it to enable header emission.
10711077
10721078
Args:
1079+
name: The tool name.
1080+
arguments: The tool arguments, or `None` for a tool that takes none.
1081+
read_timeout_seconds: Per-request read timeout in seconds.
1082+
progress_callback: Called with progress notifications for this call.
10731083
input_responses: Responses to a prior `InputRequiredResult.input_requests`.
10741084
request_state: Opaque state echoed from a prior `InputRequiredResult`.
1085+
meta: Request metadata, forwarded as `_meta`.
10751086
allow_input_required: When ``False`` (default), an `InputRequiredResult`
10761087
from the server raises `RuntimeError`; when ``True``, it is returned
10771088
so the caller can resolve the requests and retry.
@@ -1227,8 +1238,11 @@ async def get_prompt(
12271238
"""Send a prompts/get request.
12281239
12291240
Args:
1241+
name: The prompt name.
1242+
arguments: The prompt arguments, or `None` for a prompt that takes none.
12301243
input_responses: Responses to a prior `InputRequiredResult.input_requests`.
12311244
request_state: Opaque state echoed from a prior `InputRequiredResult`.
1245+
meta: Request metadata, forwarded as `_meta`.
12321246
allow_input_required: When `False` (default), an `InputRequiredResult`
12331247
from the server raises `RuntimeError`; when `True`, it is returned
12341248
so the caller can resolve the requests and retry.

0 commit comments

Comments
 (0)