How to report to LLM progress by MCP tool (using http stream SSE transport), when a long operation requires time to complete #1154
Replies: 1 comment 1 reply
-
|
There are a few ways to do this. The one I usually prefer is a BeginOperation style tool and a PollOperationStatus type tool. If you look at Claude Code and how it implements long running bash, that's a good example. The tricky part, if your server needs to work with every client, is that you rely on the model polling at a reasonable interval. Some models are very bad at this. Having an option to let the model simply wait for the result is an option for such models. But generally I see tools as interactions that need to be fast, and an operation can be modelled using multiple tools if long running. There is an experimental task feature in MCP but the c# sdk doesn't currently support it, and there are also almost no clients supporting it. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Pre-submission Checklist
Question Category
Your Question
I have successfully implemented an HTTP based MCP server using this SDK.
Now i am facing this problem... suppose a simple task may require some time to complete (minutes).
Do exist any simple way or any guidelines to report back to LLM some progress indicator ?
Also, do exist a notion of "cancellation token" i can use in my tool to abort my long running operation ?
Basically, can i inform LLM back when i'm finished and result for the user is ready ?
Beta Was this translation helpful? Give feedback.
All reactions