You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The progress value MUST increase with each notification, even if the total is
unknown.
The progress and the total values MAY be floating point.
Behavior Requirements
Progress notifications MUST only reference tokens that:
Were provided in an active request
Are associated with an in-progress operation
Receivers of progress requests MAY:
Choose not to send any progress notifications
Send notifications at whatever frequency they deem appropriate
Omit the total value if unknown
sequenceDiagram
participant Sender
participant Receiver
Note over Sender,Receiver: Request with progress token
Sender->>Receiver: Method request with progressToken
Note over Sender,Receiver: Progress updates
loop Progress Updates
Receiver-->>Sender: Progress notification (0.2/1.0)
Receiver-->>Sender: Progress notification (0.6/1.0)
Receiver-->>Sender: Progress notification (1.0/1.0)
end
Note over Sender,Receiver: Operation complete
Receiver->>Sender: Method response
Loading
Implementation Notes
Senders and receivers SHOULD track active progress tokens
Both parties SHOULD implement rate limiting to prevent flooding
Progress notifications MUST stop after completion
Suggestions for implementation
To implement, it seems that all operations need to be tracked with an Id so that progress notifications can be sent. This behavior likely needs to be implemented for all operations. Since the protocol allows for extensible operation definitions, there should likely be a central way to register tasks for execution that manages the core protocol behaviors (cancel & progress).
The text was updated successfully, but these errors were encountered:
I'm not clear on what's not implemented here. While we can find ways to make it easier, such as possibly making it possible to get an IProgress<T> injected (we'd need to figure out what the T would be), this should work fine today, e.g.
[McpServerTool]publicstaticasyncTask<string>MyTool(IMcpServerserver,RequestContext<CallToolRequestParams>context){object?progressToken=context.Params?.Meta?.ProgressToken;for(inti=1;i<=10;i++){awaitTask.Delay(1);if(progressTokenis not null){awaitserver.SendMessageAsync(newJsonRpcNotification(){Method="notifications/progress",Params=new{token=progressToken,progress=i,total=10},});}}return"done";}
According to the spec:
When a party wants to receive progress updates for a request, it includes a
progressToken
in the request metadata.across all active requests.
The receiver MAY then send progress notifications containing:
progress
value MUST increase with each notification, even if the total isunknown.
progress
and thetotal
values MAY be floating point.Behavior Requirements
Progress notifications MUST only reference tokens that:
Receivers of progress requests MAY:
Implementation Notes
Suggestions for implementation
To implement, it seems that all operations need to be tracked with an Id so that progress notifications can be sent. This behavior likely needs to be implemented for all operations. Since the protocol allows for extensible operation definitions, there should likely be a central way to register tasks for execution that manages the core protocol behaviors (cancel & progress).
The text was updated successfully, but these errors were encountered: