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

Aperta Adatta ai principianti
#3,846 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

  • #3848 di @lxcxjxhx — chiusa senza merge
  • #3960 di @wangkangmao — chiusa senza merge

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
84/100
Tipo di issue
Documentazione
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
documentation

Direzione di ricerca

Leggi i blocchi Args di ClientSession.send_request, call_tool, get_prompt e read_resource in src/mcp/client/session.py, quindi confronta le relative firme con i parametri documentati in src/mcp/client/client.py. Aggiungi le descrizioni dei parametri mancanti, riutilizzando la formulazione del livello Client quando disponibile. Il lavoro è completato quando tutti e quattro i blocchi Args documentano i parametri accettati da ciascun metodo.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Python
Stelle
25k
Fork
4.2k
Merge medio
10m
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di modelcontextprotocol/python-sdk

Tutte le issue di modelcontextprotocol/python-sdk

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.