docs(client): ClientSession documents only the input-required kwargs, not its mandatory parameters

オープン 初心者向け
#3,846 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

  • #3848 @lxcxjxhx による — マージされずにクローズ
  • #3960 @wangkangmao による — マージされずにクローズ

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
84/100
issue の種類
ドキュメント
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
documentation

調査の方向性

src/mcp/client/session.py にある ClientSession.send_request、call_tool、get_prompt、read_resource の Args ブロックを読み、各シグネチャを src/mcp/client/client.py に記載されたパラメーターと比較します。不足しているパラメーターの説明を追加し、可能な場合は Client レイヤーの表現を再利用します。4 つすべての Args ブロックに各メソッドが受け取るパラメーターが記載されたら完了です。

索引モデルが issue の本文から書いたものです。

説明

documentation

What is wrong

ClientSession.read_resource (src/mcp/client/session.py, docstring at 933) has a Google-style Args: block that lists only the three optional input-required kwargs:

documented in Args: ['input_responses', 'request_state', 'allow_input_required']
real parameters   : ['uri', 'input_responses', 'request_state', 'meta', 'allow_input_required']
UNDOCUMENTED      : ['uri', 'meta']

uri is the only parameter without a default, so the rendered API reference documents the optional arguments and hides the mandatory one. meta is undocumented as well.

The higher-level Client.read_resource (src/mcp/client/client.py:662,666) documents both correctly, so this looks like drift confined to the session layer rather than an intentional omission.

Minimal reproduction

import inspect
from mcp.client.session import ClientSession

print(inspect.signature(ClientSession.read_resource))
# (uri: AnyUrl, input_responses: ... = None, request_state: ... = None,
#  meta: ... = None, allow_input_required: bool = False) -> ReadResourceResult

Scope of the drift

The same pattern appears on three neighbouring methods in the same class, measured the same way on main — every one of them documents the input-required kwargs and nothing else, which suggests the block was written once and copied:

Method Documented in Args: Actually accepted
send_request (l. 540) metadata request, result_type, request_read_timeout_seconds, metadata, progress_callback
call_tool (l. 1052) input_responses, request_state, allow_input_required, allow_claimed name, arguments, read_timeout_seconds, progress_callback, input_responses, request_state, meta, allow_input_required, allow_claimed
get_prompt (l. 1217) input_responses, request_state, allow_input_required name, arguments, input_responses, request_state, meta, allow_input_required

call_tool is the most visible case: name and arguments are the two parameters every caller passes and neither is documented.

Proposed fix

Add the undocumented parameters to each Args: block, reusing the wording already used in the Client layer where the same parameter appears. Docstring-only, one file, no behaviour change; ruff check and ruff format --check pass on the file.

I am proposing this as one issue, because the four blocks share a cause and the fix is one file. Say the word if you would rather take read_resource alone and file the rest separately, and I will split it.

Willing to open a PR?

Yes — assign this to me (or label it help wanted) and I'll send it. I've read the intake gate and will include Fixes #<this> plus the AI-assistance disclosure the contributing guide asks for.

主要言語
Python
スター
25k
フォーク
4.2k
平均マージ
10分
マージ済み PR(30日)
1

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

modelcontextprotocol/python-sdk のほかの issue

modelcontextprotocol/python-sdk の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。