From 52aa02b362579648e7f5ac6dd63ebadc7b59a02b Mon Sep 17 00:00:00 2001 From: David Soria Parra Date: Thu, 3 Oct 2024 19:32:26 +0100 Subject: [PATCH] feat: add prompts/list_changed notification Add a notification type that servers can use to inform clients when their list of available prompts has changed, similar to the existing notifications for tools and resources. This allows clients to stay in sync with the server's prompt offerings without polling. --- schema/schema.json | 27 +++++++++++++++++++++++++++ schema/schema.ts | 10 +++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/schema/schema.json b/schema/schema.json index a8f6a28..8f26b10 100644 --- a/schema/schema.json +++ b/schema/schema.json @@ -998,6 +998,30 @@ ], "type": "object" }, + "PromptListChangedNotification": { + "description": "An optional notification from the server to the client, informing it that the list of prompts it offers has changed. This may be issued by servers without any previous subscription from the client.", + "properties": { + "method": { + "const": "notifications/prompts/list_changed", + "type": "string" + }, + "params": { + "additionalProperties": {}, + "properties": { + "_meta": { + "additionalProperties": {}, + "description": "This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.", + "type": "object" + } + }, + "type": "object" + } + }, + "required": [ + "method" + ], + "type": "object" + }, "PromptReference": { "description": "Identifies a prompt.", "properties": { @@ -1337,6 +1361,9 @@ { "$ref": "#/definitions/ResourceUpdatedNotification" }, + { + "$ref": "#/definitions/PromptListChangedNotification" + }, { "$ref": "#/definitions/ToolListChangedNotification" }, diff --git a/schema/schema.ts b/schema/schema.ts index bc85a3b..b1fc350 100644 --- a/schema/schema.ts +++ b/schema/schema.ts @@ -494,6 +494,13 @@ export interface PromptArgument { required?: boolean; } +/** + * An optional notification from the server to the client, informing it that the list of prompts it offers has changed. This may be issued by servers without any previous subscription from the client. + */ +export interface PromptListChangedNotification extends Notification { + method: "notifications/prompts/list_changed"; +} + /* Tools */ /** * Sent from the client to request a list of tools the server has. @@ -771,7 +778,8 @@ export type ServerNotification = | LoggingMessageNotification | ResourceUpdatedNotification | ResourceListChangedNotification - | ToolListChangedNotification; + | ToolListChangedNotification + | PromptListChangedNotification; export type ServerResult = | EmptyResult