python-sdk icon indicating copy to clipboard operation
python-sdk copied to clipboard

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

Open baselarw opened this issue 2 months ago • 3 comments

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"})

baselarw avatar Sep 24 '26 05:09 baselarw

Hi! I'd like to work on this issue if it's available. I'm interested in understanding the ClientSessionGroup routing/indexing design and implementing read_resource() and get_prompt() with the corresponding tests. Happy to take this up if no one else is working on it.

noctellee avatar Sep 24 '26 10:09 noctellee

Thanks for the interest! I actually already have this implemented and tested — PR #3577 has read_resource() and get_prompt() mirroring call_tool's routing, with unit tests, in-memory end-to-end tests, and docs. It's currently auto-closed by the repo's bot since I'm not yet assigned to this issue (not a linking problem — the PR does reference #3579 correctly), but it'll reopen automatically once a maintainer assigns me.

Since the work's already done, might be worth a maintainer taking a look at #3577 rather than starting a second implementation from scratch — happy to have you review it or help with anything else on this if you're interested in the area.

baselarw avatar Sep 24 '26 11:09 baselarw

Hi @baselarw! Happy to implement read_resource and get_prompt on ClientSessionGroup mirroring the call_tool reverse-index architecture. I'll ensure component naming hooks, reverse index lookups, and session disconnect cleanup are fully covered with unit tests.

Jaswanth1902 avatar Oct 02 '26 05:10 Jaswanth1902