Add ui/notifications/request-teardown notification for view-initiated termination (#215)

* Add ui/close-resource request for UI to initiate termination

* Add missing METHOD export

* Fix typo in remaining ui/request-close

* Align spec terminology to teardown/termination instead of close/clearnup

* Implement final comments

* Removing view behavior on initiation of request termination
This commit is contained in:
Frédéric Barthelet 2026-03-19 21:01:59 +01:00 • committed by GitHub
commit c026b398a1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -478,6 +478,19 @@ export const McpUiSupportedContentBlockModalitiesSchema = z.object({
.describe("Host supports structured content."),
});
/**
* @description Notification for app-initiated teardown request (View -> Host).
* Views send this to request that the host tear them down. The host decides
* whether to proceed - if approved, the host will send
* `ui/resource-teardown` to allow the view to perform cleanup before being
* unmounted.
* @see {@link app.App.requestTeardown} for the app method that sends this
*/
export const McpUiRequestTeardownNotificationSchema = z.object({
method: z.literal("ui/notifications/request-teardown"),
params: z.object({}).optional(),
});
/**
* @description Capabilities supported by the host application.
* @see {@link McpUiInitializeResult `McpUiInitializeResult`} for the initialization result that includes these capabilities