@@ -20,6 +20,8 @@ import { PostMessageTransport } from "./message-transport";
2020import {
2121 LATEST_PROTOCOL_VERSION ,
2222 McpUiAppCapabilities ,
23+ McpUiFollowUpMessageRequest ,
24+ McpUiFollowUpMessageResultSchema ,
2325 McpUiHostCapabilities ,
2426 McpUiHostContext ,
2527 McpUiHostContextChangedNotification ,
@@ -783,6 +785,48 @@ export class App extends Protocol<AppRequest, AppNotification, AppResult> {
783785 ) ;
784786 }
785787
788+ /**
789+ * Send a follow-up message to the host's chat.
790+ *
791+ * Use this to continue the conversation based on user interaction with the app.
792+ * For example, when a user clicks on a data point, the app can send a follow-up
793+ * message asking for more details about that item.
794+ *
795+ * @param params - Message role and content
796+ * @param options - Request options (timeout, etc.)
797+ * @returns Result indicating success or error
798+ *
799+ * @throws {Error } If the host rejects the request
800+ * @throws {Error } If the request times out or the connection is lost
801+ *
802+ * @example Send a follow-up question based on user interaction
803+ * ```typescript
804+ * try {
805+ * await app.sendFollowUpMessage({
806+ * role: "user",
807+ * content: [{ type: "text", text: "Tell me more about this item" }]
808+ * });
809+ * } catch (error) {
810+ * console.error("Failed to send message:", error);
811+ * }
812+ * ```
813+ *
814+ * @see {@link McpUiFollowUpMessageRequest } for request structure
815+ */
816+ sendFollowUpMessage (
817+ params : McpUiFollowUpMessageRequest [ "params" ] ,
818+ options ?: RequestOptions ,
819+ ) {
820+ return this . request (
821+ < McpUiFollowUpMessageRequest > {
822+ method : "ui/follow-up-message" ,
823+ params,
824+ } ,
825+ McpUiFollowUpMessageResultSchema ,
826+ options ,
827+ ) ;
828+ }
829+
786830 /**
787831 * Send log messages to the host for debugging and telemetry.
788832 *
0 commit comments