Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions mcp/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"path/filepath"
"reflect"
"slices"
"strings"
"sync"
"sync/atomic"
"time"
Expand Down Expand Up @@ -1082,6 +1083,16 @@ func (ss *ServerSession) callProgressNotificationHandler(ctx context.Context, p
return nil, nil
}

// Notify sends a notification with an arbitrary custom method name.
// method MUST start with "notifications/". Returns when the peer has
// acknowledged the write or the context is cancelled.
func (ss *ServerSession) Notify(ctx context.Context, method string, params any) error {
if !strings.HasPrefix(method, "notifications/") {
return fmt.Errorf("Notify: method must start with notifications/, got %q", method)
}
return ss.getConn().Notify(ctx, method, params)
}

// NotifyProgress sends a progress notification from the server to the client
// associated with this session.
// This is typically used to report on the status of a long-running request
Expand Down