@@ -60,6 +60,7 @@ import {
6060 McpUiSizeChangedNotificationSchema ,
6161} from "./types" ;
6262export * from "./types" ;
63+ export { RESOURCE_URI_META_KEY } from "./app" ;
6364export { PostMessageTransport } from "./message-transport" ;
6465
6566/**
@@ -153,8 +154,8 @@ type RequestHandlerExtra = Parameters<
153154 */
154155export class AppBridge extends Protocol < Request , Notification , Result > {
155156 private _appCapabilities ?: McpUiAppCapabilities ;
157+ private _hostContext : McpUiHostContext = { } ;
156158 private _appInfo ?: Implementation ;
157- private _hostContext : McpUiHostContext ;
158159
159160 /**
160161 * Create a new AppBridge instance.
@@ -625,13 +626,23 @@ export class AppBridge extends Protocol<Request, Notification, Result> {
625626 }
626627 if ( hasChanges ) {
627628 this . _hostContext = hostContext ;
628- this . notification ( ( < McpUiHostContextChangedNotification > {
629- method : "ui/notifications/host-context-changed" ,
630- params : changes ,
631- } ) as Notification ) ; // Cast needed because McpUiHostContext is a params type that doesn't allow arbitrary keys.
629+ this . sendHostContextChange ( changes ) ;
632630 }
633631 }
634632
633+ /**
634+ * Send a host context change notification to the app.
635+ * Only sends the fields that have changed (partial update).
636+ */
637+ sendHostContextChange (
638+ params : McpUiHostContextChangedNotification [ "params" ] ,
639+ ) : Promise < void > | void {
640+ return this . notification ( ( < McpUiHostContextChangedNotification > {
641+ method : "ui/notifications/host-context-changed" ,
642+ params,
643+ } ) as Notification ) ;
644+ }
645+
635646 /**
636647 * Send complete tool arguments to the Guest UI.
637648 *
0 commit comments