internal/mcp: add NotifyProgress

This CL adds a NotifyProgress function and a ProgressNotificationHandler
to enable progress sending and handling.
Subsequent CL's to follow to handle progress updates for other methods such as list or readresource.

Change-Id: Ifcc422e6f6231d7d773d5432c1cf64032d796709
Reviewed-on: https://go-review.googlesource.com/c/tools/+/681116
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Sam Thanawalla <samthanawalla@google.com>
This commit is contained in:
Sam Thanawalla 2025-06-12 14:55:39 +00:00 • committed by Gopher Robot
commit 11b17f5858

View file

@ -431,6 +431,24 @@ type PingParams struct {
func (x *PingParams) GetMeta() *Meta { return &x.Meta }
type ProgressNotificationParams struct {
// This property is reserved by the protocol to allow clients and servers to
// attach additional metadata to their responses.
Meta Meta `json:"_meta,omitempty"`
// An optional message describing the current progress.
Message string `json:"message,omitempty"`
// The progress thus far. This should increase every time progress is made, even
// if the total is unknown.
Progress float64 `json:"progress"`
// The progress token which was given in the initial request, used to associate
// this notification with the request that is proceeding.
ProgressToken any `json:"progressToken"`
// Total number of items to process (or total progress required), if known.
Total float64 `json:"total,omitempty"`
}
func (x *ProgressNotificationParams) GetMeta() *Meta { return &x.Meta }
// A prompt or prompt template that the server offers.
type Prompt struct {
// A list of arguments to use for templating the prompt.