Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

`ClientSessionGroup` has no routed `read_resource` / `get_prompt` (only `call_tool`)

Aberta
#3,579 2 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
65/100
Tipo de issue
Funcionalidade
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
python

Direção de pesquisa

Look at the ClientSessionGroup class to understand how call_tool works and the existing reverse indexes for tools. Identify where resources and prompts are aggregated. The new methods read_resource and get_prompt should follow the same routing pattern, using the component_name_hook. Check the disconnect_from_server method to ensure cleanup. Start by examining the session aggregation logic and the existing indexes.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

Description
### What I ran into

`ClientSessionGroup` aggregates tools, resources, and prompts into one view, and
`call_tool(name, ...)` routes to the session that owns the tool. But that routing
exists only for tools. There's no equivalent way to read an aggregated resource
or fetch an aggregated prompt through the group.

### Why it matters

To read a resource or get a prompt, a caller has to track the owning
`ClientSession` themselves and bypass the group, which defeats the "one object,
one view" purpose of the abstraction. The asymmetry is surprising given
`call_tool` is already there.

### Proposed change

Add `read_resource(name, ...)` and `get_prompt(name, arguments, ...)` mirroring
`call_tool`: resolve the aggregate key (honoring `component_name_hook`) to the
owning session via resource/prompt reverse indexes, forward the real wire
URI/name, carry the same `allow_input_required` overloads, and clean the indexes
up on `disconnect_from_server`.

### Example

```python
result = await group.read_resource("Library.hours")
prompt = await group.get_prompt("Greeter.greet", {"name": "Ada"})


Linguagem predominante
Python
Estrelas
24.3k
Forks
4k
Merge médio
1d 16h
PRs com merge (30d)
25

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de modelcontextprotocol/python-sdk

Todas as issues de modelcontextprotocol/python-sdk

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.