From 8dbc950af7c76f76a169ed20c79dd008add0942a Mon Sep 17 00:00:00 2001 From: Solomon Wakhungu <65043605+1solomonwakhungu@users.noreply.github.com> Date: Thu, 16 Jul 2026 01:22:27 -0500 Subject: [PATCH] feat: add ServerSession.NotifyElicitationComplete for url-mode elicitation Add an exported method to allow servers to send notifications/elicitation/complete to clients, completing the url-mode elicitation flow. Mirrors the existing NotifyProgress pattern. Fixes #1091 --- mcp/elicitation_test.go | 4 ++-- mcp/server.go | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/mcp/elicitation_test.go b/mcp/elicitation_test.go index a20947fc..a5674b4b 100644 --- a/mcp/elicitation_test.go +++ b/mcp/elicitation_test.go @@ -194,9 +194,9 @@ func TestElicitationCompleteNotification(t *testing.T) { } // 2. Server sends elicitation complete notification (simulating out-of-band completion) - err = handleNotify(ctx, notificationElicitationComplete, newServerRequest(ss, &ElicitationCompleteParams{ + err = ss.NotifyElicitationComplete(ctx, &ElicitationCompleteParams{ ElicitationID: elicitID, - })) + }) if err != nil { t.Fatalf("failed to send elicitation complete notification: %v", err) } diff --git a/mcp/server.go b/mcp/server.go index 34cbf935..a4f2b6cb 100644 --- a/mcp/server.go +++ b/mcp/server.go @@ -1448,6 +1448,12 @@ func (ss *ServerSession) NotifyProgress(ctx context.Context, params *ProgressNot return handleNotify(ctx, notificationProgress, newServerRequest(ss, orZero[Params](params))) } +// NotifyElicitationComplete signals that an out-of-band (url-mode) +// elicitation identified by params.ElicitationID has completed. +func (ss *ServerSession) NotifyElicitationComplete(ctx context.Context, params *ElicitationCompleteParams) error { + return handleNotify(ctx, notificationElicitationComplete, newServerRequest(ss, orZero[Params](params))) +} + // notifySubscriptionAcked sends a "notifications/subscriptions/acknowledged" // notification on the listen stream represented by this session, indicating // the subscription filter the server accepted (SEP-2575).