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:
parent
296b5921fb
commit
c026b398a1
3 changed files with 195 additions and 5 deletions
17
src/generated/schema.json
generated
17
src/generated/schema.json
generated
|
|
@ -4074,6 +4074,23 @@
|
|||
"required": ["mode"],
|
||||
"additionalProperties": {}
|
||||
},
|
||||
"McpUiRequestTeardownNotification": {
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"method": {
|
||||
"type": "string",
|
||||
"const": "ui/notifications/request-teardown"
|
||||
},
|
||||
"params": {
|
||||
"type": "object",
|
||||
"properties": {},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"required": ["method"],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"McpUiResourceCsp": {
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"type": "object",
|
||||
|
|
|
|||
10
src/generated/schema.test.ts
generated
10
src/generated/schema.test.ts
generated
|
|
@ -91,6 +91,10 @@ export type McpUiSupportedContentBlockModalitiesSchemaInferredType = z.infer<
|
|||
typeof generated.McpUiSupportedContentBlockModalitiesSchema
|
||||
>;
|
||||
|
||||
export type McpUiRequestTeardownNotificationSchemaInferredType = z.infer<
|
||||
typeof generated.McpUiRequestTeardownNotificationSchema
|
||||
>;
|
||||
|
||||
export type McpUiHostCapabilitiesSchemaInferredType = z.infer<
|
||||
typeof generated.McpUiHostCapabilitiesSchema
|
||||
>;
|
||||
|
|
@ -255,6 +259,12 @@ expectType<spec.McpUiSupportedContentBlockModalities>(
|
|||
expectType<McpUiSupportedContentBlockModalitiesSchemaInferredType>(
|
||||
{} as spec.McpUiSupportedContentBlockModalities,
|
||||
);
|
||||
expectType<spec.McpUiRequestTeardownNotification>(
|
||||
{} as McpUiRequestTeardownNotificationSchemaInferredType,
|
||||
);
|
||||
expectType<McpUiRequestTeardownNotificationSchemaInferredType>(
|
||||
{} as spec.McpUiRequestTeardownNotification,
|
||||
);
|
||||
expectType<spec.McpUiHostCapabilities>(
|
||||
{} as McpUiHostCapabilitiesSchemaInferredType,
|
||||
);
|
||||
|
|
|
|||
13
src/generated/schema.ts
generated
13
src/generated/schema.ts
generated
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue