-
Notifications
You must be signed in to change notification settings - Fork 545
Open
Description
Hi, I'm trying to figure out the intended way to combine ListChanged
notifications with per-session tool collections. Specifically, I don't know how I can become aware that a session has ended.
I'll describe my use case in more detail, so that you can check my assumptions and correct me if I'm wrong:
- I'm implementing an MCP server. My Tools are inheriting from
Microsoft.Extensions.AI.AIFunction
. During tool invocation, I need to know which user/session this is, and therefore each tool must carry the user/session state it needs, and therefore I need to create a separate tool collection per user/session. Does any of that sound wrong so far? - On my MCP server program I have a way for tools to be enabled/disabled, which should send a list changed notification to clients. I have a collection of tool collections (one per session) which I can iterate over and update in order to automatically send those notifications.
- But here is the problem: Now a client disconnects. How can I be aware of this, so that I can forget that tool collection, and stop keeping it in memory and trying to update it?
I'm fairly inexperienced at this, so I don't know whether I should be considering things like "stateless" or whether it would help or what the tradeoffs would be.
Any advice would be appreciated, thank you.
Metadata
Metadata
Assignees
Labels
No labels