From 67273903dbe6f33e46330b854f45e2d8a3a3c1a5 Mon Sep 17 00:00:00 2001 From: Ido Salomon Date: Wed, 10 Dec 2025 19:41:39 +0200 Subject: [PATCH 1/9] feat: add ui/update-context --- specification/draft/apps.mdx | 48 ++++- src/app-bridge.test.ts | 46 +++++ src/app-bridge.ts | 39 ++++ src/app.ts | 36 ++++ src/generated/schema.json | 360 +++++++++++++++++++++++++++++++++++ src/generated/schema.test.ts | 20 ++ src/generated/schema.ts | 44 +++++ src/spec.types.ts | 35 ++++ src/types.ts | 4 + 9 files changed, 629 insertions(+), 3 deletions(-) diff --git a/specification/draft/apps.mdx b/specification/draft/apps.mdx index 8ceae01d..7aeed253 100644 --- a/specification/draft/apps.mdx +++ b/specification/draft/apps.mdx @@ -379,7 +379,7 @@ UI iframes can use the following subset of standard MCP protocol messages: **Notifications:** -- `notifications/message` - Log messages to host +- `notifications/message` - Log messages to host (for logging) **Lifecycle:** @@ -533,6 +533,45 @@ Host SHOULD open the URL in the user's default browser or a new tab. Host SHOULD add the message to the conversation thread, preserving the specified role. +`ui/update-context` - Update the agent's conversation context + +```typescript +// Request +{ + jsonrpc: "2.0", + id: 3, + method: "ui/update-context", + params: { + role: "user", + content: ContentBlock[] + } +} + +// Success Response +{ + jsonrpc: "2.0", + id: 3, + result: {} // Empty result on success +} + +// Error Response (if denied or failed) +{ + jsonrpc: "2.0", + id: 3, + error: { + code: -32000, // Implementation-defined error + message: "Context update denied" | "Invalid content format" + } +} +``` + +Guest UI MAY send this request to inform the agent about app state changes that should be stored in the conversation context for future reasoning. This event serves a different use case from `notifications/message` (logging) and `ui/message` (which also trigger followups). + +Host behavior: +- SHOULD store the context update in the conversation context +- MAY display context updates to the user +- MAY filter or aggregate context updates + #### Notifications (Host → UI) `ui/notifications/tool-input` - Host MUST send this notification with the complete tool arguments after the Guest UI's initialize request completes. @@ -765,9 +804,12 @@ sequenceDiagram else Message UI ->> H: ui/message H -->> H: Process message and follow up - else Notify + else Context update + UI ->> H: ui/update-context + H ->> H: Process context update and store in conversation context + else Log UI ->> H: notifications/message - H ->> H: Process notification and store in context + H ->> H: Record log for debugging/telemetry else Resource read UI ->> H: resources/read H ->> S: resources/read diff --git a/src/app-bridge.test.ts b/src/app-bridge.test.ts index 0d9e9e5b..82e3b179 100644 --- a/src/app-bridge.test.ts +++ b/src/app-bridge.test.ts @@ -212,6 +212,52 @@ describe("App <-> AppBridge integration", () => { logger: "TestApp", }); }); + + it("app.sendContext triggers bridge.oncontext and returns result", async () => { + const receivedContexts: unknown[] = []; + bridge.oncontext = (params) => { + receivedContexts.push(params); + }; + + await app.connect(appTransport); + const result = await app.sendContext({ + role: "user", + content: [{ type: "text", text: "User selected 3 items" }], + }); + + expect(receivedContexts).toHaveLength(1); + expect(receivedContexts[0]).toMatchObject({ + role: "user", + content: [{ type: "text", text: "User selected 3 items" }], + }); + expect(result).toEqual({}); + }); + + it("app.sendContext works with multiple content blocks", async () => { + const receivedContexts: unknown[] = []; + bridge.oncontext = (params) => { + receivedContexts.push(params); + }; + + await app.connect(appTransport); + const result = await app.sendContext({ + role: "user", + content: [ + { type: "text", text: "Filter applied" }, + { type: "text", text: "Category: electronics" }, + ], + }); + + expect(receivedContexts).toHaveLength(1); + expect(receivedContexts[0]).toMatchObject({ + role: "user", + content: [ + { type: "text", text: "Filter applied" }, + { type: "text", text: "Category: electronics" }, + ], + }); + expect(result).toEqual({}); + }); }); describe("App -> Host requests", () => { diff --git a/src/app-bridge.ts b/src/app-bridge.ts index c4b2bdbd..6676e470 100644 --- a/src/app-bridge.ts +++ b/src/app-bridge.ts @@ -39,6 +39,8 @@ import { type McpUiToolResultNotification, LATEST_PROTOCOL_VERSION, McpUiAppCapabilities, + McpUiUpdateContextRequest, + McpUiUpdateContextRequestSchema, McpUiHostCapabilities, McpUiHostContext, McpUiHostContextChangedNotification, @@ -502,6 +504,43 @@ export class AppBridge extends Protocol { ); } + /** + * Register a handler for context updates from the Guest UI. + * + * The Guest UI sends `ui/update-context` requests to inform the agent + * about app state changes that should be stored in the conversation context for + * future reasoning. Unlike logging messages, context updates are intended to be + * available to the agent for decision making. + * + * @param callback - Handler that receives context update params + * - params.role - Message role (currently only "user") + * - params.content - Content blocks (text, image, etc.) + * + * @example + * ```typescript + * bridge.oncontext = ({ role, content }) => { + * // Store context update for agent reasoning + * conversationContext.push({ + * type: "app_context", + * role, + * content, + * timestamp: Date.now() + * }); + * }; + * ``` + */ + set oncontext( + callback: (params: McpUiUpdateContextRequest["params"]) => void, + ) { + this.setRequestHandler( + McpUiUpdateContextRequestSchema, + async (request) => { + callback(request.params); + return {}; + }, + ); + } + /** * Verify that the guest supports the capability required for the given request method. * @internal diff --git a/src/app.ts b/src/app.ts index 6813becb..dab840c9 100644 --- a/src/app.ts +++ b/src/app.ts @@ -21,6 +21,8 @@ import { import { LATEST_PROTOCOL_VERSION, McpUiAppCapabilities, + McpUiUpdateContextRequest, + McpUiUpdateContextResultSchema, McpUiHostCapabilities, McpUiHostContextChangedNotification, McpUiHostContextChangedNotificationSchema, @@ -673,6 +675,40 @@ export class App extends Protocol { }); } + /** + * Send context updates to the host for storage in the agent's conversation context. + * + * Unlike `sendLog` which is for debugging/telemetry, context updates are intended + * to inform the agent about app state changes that should be available for future + * reasoning without requiring a follow-up action (i.e., a prompt). + * + * @param params - Context role and content (same structure as ui/message) + * @param options - Request options (timeout, etc.) + * + * @example Notify agent of significant state change + * ```typescript + * await app.sendContext({ + * role: "user", + * content: [{ type: "text", text: "User selected 3 items totaling $150.00" }] + * }); + * ``` + * + * @returns Promise that resolves when the context update is acknowledged + */ + sendContext( + params: McpUiUpdateContextRequest["params"], + options?: RequestOptions + ) { + return this.request( + { + method: "ui/update-context", + params, + }, + McpUiUpdateContextResultSchema, + options + ); + } + /** * Request the host to open an external URL in the default browser. * diff --git a/src/generated/schema.json b/src/generated/schema.json index b51e23bc..935b8c30 100644 --- a/src/generated/schema.json +++ b/src/generated/schema.json @@ -89,6 +89,12 @@ "type": "object", "properties": {}, "additionalProperties": false + }, + "context": { + "description": "Host accepts context updates to be stored in the agent's conversation context.", + "type": "object", + "properties": {}, + "additionalProperties": false } }, "additionalProperties": false @@ -851,6 +857,12 @@ "type": "object", "properties": {}, "additionalProperties": false + }, + "context": { + "description": "Host accepts context updates to be stored in the agent's conversation context.", + "type": "object", + "properties": {}, + "additionalProperties": false } }, "additionalProperties": false @@ -2146,6 +2158,354 @@ }, "required": ["method", "params"], "additionalProperties": false + }, + "McpUiUpdateContextRequest": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "method": { + "type": "string", + "const": "ui/update-context" + }, + "params": { + "type": "object", + "properties": { + "role": { + "description": "Message role, currently only \"user\" is supported.", + "type": "string", + "const": "user" + }, + "content": { + "description": "Context content blocks (text, image, etc.).", + "type": "array", + "items": { + "anyOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "text" + }, + "text": { + "type": "string" + }, + "annotations": { + "type": "object", + "properties": { + "audience": { + "type": "array", + "items": { + "type": "string", + "enum": ["user", "assistant"] + } + }, + "priority": { + "type": "number", + "minimum": 0, + "maximum": 1 + }, + "lastModified": { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-]\\d{2}:\\d{2})))$" + } + }, + "additionalProperties": false + }, + "_meta": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + } + }, + "required": ["type", "text"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "image" + }, + "data": { + "type": "string" + }, + "mimeType": { + "type": "string" + }, + "annotations": { + "type": "object", + "properties": { + "audience": { + "type": "array", + "items": { + "type": "string", + "enum": ["user", "assistant"] + } + }, + "priority": { + "type": "number", + "minimum": 0, + "maximum": 1 + }, + "lastModified": { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-]\\d{2}:\\d{2})))$" + } + }, + "additionalProperties": false + }, + "_meta": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + } + }, + "required": ["type", "data", "mimeType"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "audio" + }, + "data": { + "type": "string" + }, + "mimeType": { + "type": "string" + }, + "annotations": { + "type": "object", + "properties": { + "audience": { + "type": "array", + "items": { + "type": "string", + "enum": ["user", "assistant"] + } + }, + "priority": { + "type": "number", + "minimum": 0, + "maximum": 1 + }, + "lastModified": { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-]\\d{2}:\\d{2})))$" + } + }, + "additionalProperties": false + }, + "_meta": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + } + }, + "required": ["type", "data", "mimeType"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "title": { + "type": "string" + }, + "icons": { + "type": "array", + "items": { + "type": "object", + "properties": { + "src": { + "type": "string" + }, + "mimeType": { + "type": "string" + }, + "sizes": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["src"], + "additionalProperties": false + } + }, + "uri": { + "type": "string" + }, + "description": { + "type": "string" + }, + "mimeType": { + "type": "string" + }, + "annotations": { + "type": "object", + "properties": { + "audience": { + "type": "array", + "items": { + "type": "string", + "enum": ["user", "assistant"] + } + }, + "priority": { + "type": "number", + "minimum": 0, + "maximum": 1 + }, + "lastModified": { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-]\\d{2}:\\d{2})))$" + } + }, + "additionalProperties": false + }, + "_meta": { + "type": "object", + "properties": {}, + "additionalProperties": {} + }, + "type": { + "type": "string", + "const": "resource_link" + } + }, + "required": ["name", "uri", "type"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "resource" + }, + "resource": { + "anyOf": [ + { + "type": "object", + "properties": { + "uri": { + "type": "string" + }, + "mimeType": { + "type": "string" + }, + "_meta": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "text": { + "type": "string" + } + }, + "required": ["uri", "text"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "uri": { + "type": "string" + }, + "mimeType": { + "type": "string" + }, + "_meta": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "blob": { + "type": "string" + } + }, + "required": ["uri", "blob"], + "additionalProperties": false + } + ] + }, + "annotations": { + "type": "object", + "properties": { + "audience": { + "type": "array", + "items": { + "type": "string", + "enum": ["user", "assistant"] + } + }, + "priority": { + "type": "number", + "minimum": 0, + "maximum": 1 + }, + "lastModified": { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-]\\d{2}:\\d{2})))$" + } + }, + "additionalProperties": false + }, + "_meta": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + } + }, + "required": ["type", "resource"], + "additionalProperties": false + } + ] + } + } + }, + "required": ["role", "content"], + "additionalProperties": false + } + }, + "required": ["method", "params"], + "additionalProperties": false + }, + "McpUiUpdateContextResult": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "isError": { + "description": "True if the host rejected or failed to store the context update.", + "type": "boolean" + } + }, + "additionalProperties": {} } } } diff --git a/src/generated/schema.test.ts b/src/generated/schema.test.ts index 5a2e3a60..1cb66756 100644 --- a/src/generated/schema.test.ts +++ b/src/generated/schema.test.ts @@ -51,6 +51,10 @@ export type McpUiToolInputPartialNotificationSchemaInferredType = z.infer< typeof generated.McpUiToolInputPartialNotificationSchema >; +export type McpUiUpdateContextResultSchemaInferredType = z.infer< + typeof generated.McpUiUpdateContextResultSchema +>; + export type McpUiResourceTeardownRequestSchemaInferredType = z.infer< typeof generated.McpUiResourceTeardownRequestSchema >; @@ -95,6 +99,10 @@ export type McpUiHostContextChangedNotificationSchemaInferredType = z.infer< typeof generated.McpUiHostContextChangedNotificationSchema >; +export type McpUiUpdateContextRequestSchemaInferredType = z.infer< + typeof generated.McpUiUpdateContextRequestSchema +>; + export type McpUiInitializeRequestSchemaInferredType = z.infer< typeof generated.McpUiInitializeRequestSchema >; @@ -151,6 +159,12 @@ expectType( expectType( {} as spec.McpUiToolInputPartialNotification, ); +expectType( + {} as McpUiUpdateContextResultSchemaInferredType, +); +expectType( + {} as spec.McpUiUpdateContextResult, +); expectType( {} as McpUiResourceTeardownRequestSchemaInferredType, ); @@ -205,6 +219,12 @@ expectType( expectType( {} as spec.McpUiHostContextChangedNotification, ); +expectType( + {} as McpUiUpdateContextRequestSchemaInferredType, +); +expectType( + {} as spec.McpUiUpdateContextRequest, +); expectType( {} as McpUiInitializeRequestSchemaInferredType, ); diff --git a/src/generated/schema.ts b/src/generated/schema.ts index 1b181afa..8c4baddf 100644 --- a/src/generated/schema.ts +++ b/src/generated/schema.ts @@ -160,6 +160,20 @@ export const McpUiToolInputPartialNotificationSchema = z.object({ }), }); +/** + * @description Result from updating the agent's context. + * @see {@link McpUiUpdateContextRequest} + */ +export const McpUiUpdateContextResultSchema = z.looseObject({ + /** @description True if the host rejected or failed to store the context update. */ + isError: z + .boolean() + .optional() + .describe( + "True if the host rejected or failed to store the context update.", + ), +}); + /** * @description Request for graceful shutdown of the Guest UI (Host -> Guest UI). * @see {@link app-bridge.AppBridge.sendResourceTeardown} for the host method that sends this @@ -217,6 +231,13 @@ export const McpUiHostCapabilitiesSchema = z.object({ .describe("Host can proxy resource reads to the MCP server."), /** @description Host accepts log messages. */ logging: z.object({}).optional().describe("Host accepts log messages."), + /** @description Host accepts context updates to be stored in the agent's conversation context. */ + context: z + .object({}) + .optional() + .describe( + "Host accepts context updates to be stored in the agent's conversation context.", + ), }); /** @@ -423,6 +444,29 @@ export const McpUiHostContextChangedNotificationSchema = z.object({ ), }); +/** + * @description Request to update the agent's context without requiring a follow-up action (Guest UI -> Host). + * + * Unlike `notifications/message` which is for debugging/logging, this request is intended + * to inform the agent about app-driven updates that should be stored in the conversation context + * for future reasoning. + * + * @see {@link app.App.sendUpdateContext} for the method that sends this request + */ +export const McpUiUpdateContextRequestSchema = z.object({ + method: z.literal("ui/update-context"), + params: z.object({ + /** @description Message role, currently only "user" is supported. */ + role: z + .literal("user") + .describe('Message role, currently only "user" is supported.'), + /** @description Context content blocks (text, image, etc.). */ + content: z + .array(ContentBlockSchema) + .describe("Context content blocks (text, image, etc.)."), + }), +}); + /** * @description Initialization request sent from Guest UI to Host. * @see {@link app.App.connect} for the method that sends this request diff --git a/src/spec.types.ts b/src/spec.types.ts index 2596bff5..5fa57308 100644 --- a/src/spec.types.ts +++ b/src/spec.types.ts @@ -233,6 +233,39 @@ export interface McpUiHostContextChangedNotification { params: McpUiHostContext; } +/** + * @description Request to update the agent's context without requiring a follow-up action (Guest UI -> Host). + * + * Unlike `notifications/message` which is for debugging/logging, this request is intended + * to inform the agent about app-driven updates that should be stored in the conversation context + * for future reasoning. + * + * @see {@link app.App.sendUpdateContext} for the method that sends this request + */ +export interface McpUiUpdateContextRequest { + method: "ui/update-context"; + params: { + /** @description Message role, currently only "user" is supported. */ + role: "user"; + /** @description Context content blocks (text, image, etc.). */ + content: ContentBlock[]; + }; +} + +/** + * @description Result from updating the agent's context. + * @see {@link McpUiUpdateContextRequest} + */ +export interface McpUiUpdateContextResult { + /** @description True if the host rejected or failed to store the context update. */ + isError?: boolean; + /** + * Index signature required for MCP SDK `Protocol` class compatibility. + * Note: The schema intentionally omits this to enforce strict validation. + */ + [key: string]: unknown; +} + /** * @description Request for graceful shutdown of the Guest UI (Host -> Guest UI). * @see {@link app-bridge.AppBridge.sendResourceTeardown} for the host method that sends this @@ -274,6 +307,8 @@ export interface McpUiHostCapabilities { }; /** @description Host accepts log messages. */ logging?: {}; + /** @description Host accepts context updates to be stored in the agent's conversation context. */ + context?: {}; } /** diff --git a/src/types.ts b/src/types.ts index 92bb8cf8..e5555509 100644 --- a/src/types.ts +++ b/src/types.ts @@ -18,6 +18,8 @@ export { type McpUiOpenLinkResult, type McpUiMessageRequest, type McpUiMessageResult, + type McpUiUpdateContextRequest, + type McpUiUpdateContextResult, type McpUiSandboxProxyReadyNotification, type McpUiSandboxResourceReadyNotification, type McpUiSizeChangedNotification, @@ -45,6 +47,8 @@ export { McpUiOpenLinkResultSchema, McpUiMessageRequestSchema, McpUiMessageResultSchema, + McpUiUpdateContextRequestSchema, + McpUiUpdateContextResultSchema, McpUiSandboxProxyReadyNotificationSchema, McpUiSandboxResourceReadyNotificationSchema, McpUiSizeChangedNotificationSchema, From 69b757013cc2381a1dd829bb54bbe88cdbf6b3fb Mon Sep 17 00:00:00 2001 From: Ido Salomon Date: Wed, 10 Dec 2025 19:42:09 +0200 Subject: [PATCH 2/9] lint --- src/app-bridge.ts | 11 ++++------- src/app.ts | 4 ++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/app-bridge.ts b/src/app-bridge.ts index 6676e470..04ca61c4 100644 --- a/src/app-bridge.ts +++ b/src/app-bridge.ts @@ -532,13 +532,10 @@ export class AppBridge extends Protocol { set oncontext( callback: (params: McpUiUpdateContextRequest["params"]) => void, ) { - this.setRequestHandler( - McpUiUpdateContextRequestSchema, - async (request) => { - callback(request.params); - return {}; - }, - ); + this.setRequestHandler(McpUiUpdateContextRequestSchema, async (request) => { + callback(request.params); + return {}; + }); } /** diff --git a/src/app.ts b/src/app.ts index dab840c9..2eb9baf9 100644 --- a/src/app.ts +++ b/src/app.ts @@ -697,7 +697,7 @@ export class App extends Protocol { */ sendContext( params: McpUiUpdateContextRequest["params"], - options?: RequestOptions + options?: RequestOptions, ) { return this.request( { @@ -705,7 +705,7 @@ export class App extends Protocol { params, }, McpUiUpdateContextResultSchema, - options + options, ); } From 0085768688cb43b58c41884e061832fe7e0c6f0c Mon Sep 17 00:00:00 2001 From: Ido Salomon Date: Wed, 10 Dec 2025 19:53:14 +0200 Subject: [PATCH 3/9] sequence diagram --- specification/draft/apps.mdx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/specification/draft/apps.mdx b/specification/draft/apps.mdx index 7aeed253..d816b7e6 100644 --- a/specification/draft/apps.mdx +++ b/specification/draft/apps.mdx @@ -803,10 +803,12 @@ sequenceDiagram H-->>UI: ui/notifications/tool-result else Message UI ->> H: ui/message + H -->> UI: ui/message response H -->> H: Process message and follow up else Context update UI ->> H: ui/update-context - H ->> H: Process context update and store in conversation context + H ->> H: Store in conversation context + H -->> UI: ui/update-context response else Log UI ->> H: notifications/message H ->> H: Record log for debugging/telemetry From b84864210d8bb9d312fd9bb7e58047048dea8da8 Mon Sep 17 00:00:00 2001 From: Ido Salomon Date: Wed, 10 Dec 2025 20:01:18 +0200 Subject: [PATCH 4/9] cr --- src/app-bridge.test.ts | 20 +++++++++++++++++-- src/app-bridge.ts | 45 +++++++++++++++++++++++++++++------------- 2 files changed, 49 insertions(+), 16 deletions(-) diff --git a/src/app-bridge.test.ts b/src/app-bridge.test.ts index 82e3b179..1ba07ffd 100644 --- a/src/app-bridge.test.ts +++ b/src/app-bridge.test.ts @@ -215,8 +215,9 @@ describe("App <-> AppBridge integration", () => { it("app.sendContext triggers bridge.oncontext and returns result", async () => { const receivedContexts: unknown[] = []; - bridge.oncontext = (params) => { + bridge.oncontext = async (params) => { receivedContexts.push(params); + return {}; }; await app.connect(appTransport); @@ -235,8 +236,9 @@ describe("App <-> AppBridge integration", () => { it("app.sendContext works with multiple content blocks", async () => { const receivedContexts: unknown[] = []; - bridge.oncontext = (params) => { + bridge.oncontext = async (params) => { receivedContexts.push(params); + return {}; }; await app.connect(appTransport); @@ -258,6 +260,20 @@ describe("App <-> AppBridge integration", () => { }); expect(result).toEqual({}); }); + + it("app.sendContext returns error result when handler indicates error", async () => { + bridge.oncontext = async () => { + return { isError: true }; + }; + + await app.connect(appTransport); + const result = await app.sendContext({ + role: "user", + content: [{ type: "text", text: "Test" }], + }); + + expect(result.isError).toBe(true); + }); }); describe("App -> Host requests", () => { diff --git a/src/app-bridge.ts b/src/app-bridge.ts index 04ca61c4..1deea433 100644 --- a/src/app-bridge.ts +++ b/src/app-bridge.ts @@ -41,6 +41,7 @@ import { McpUiAppCapabilities, McpUiUpdateContextRequest, McpUiUpdateContextRequestSchema, + McpUiUpdateContextResult, McpUiHostCapabilities, McpUiHostContext, McpUiHostContextChangedNotification, @@ -512,30 +513,46 @@ export class AppBridge extends Protocol { * future reasoning. Unlike logging messages, context updates are intended to be * available to the agent for decision making. * - * @param callback - Handler that receives context update params + * @param callback - Handler that receives context update params and returns a result * - params.role - Message role (currently only "user") * - params.content - Content blocks (text, image, etc.) + * - extra - Request metadata (abort signal, session info) + * - Returns: Promise with optional isError flag * * @example * ```typescript - * bridge.oncontext = ({ role, content }) => { - * // Store context update for agent reasoning - * conversationContext.push({ - * type: "app_context", - * role, - * content, - * timestamp: Date.now() - * }); + * bridge.oncontext = async ({ role, content }, extra) => { + * try { + * // Store context update for agent reasoning + * conversationContext.push({ + * type: "app_context", + * role, + * content, + * timestamp: Date.now() + * }); + * return {}; + * } catch (err) { + * // Handle error and signal failure to the app + * return { isError: true }; + * } * }; * ``` + * + * @see {@link McpUiUpdateContextRequest} for the request type + * @see {@link McpUiUpdateContextResult} for the result type */ set oncontext( - callback: (params: McpUiUpdateContextRequest["params"]) => void, + callback: ( + params: McpUiUpdateContextRequest["params"], + extra: RequestHandlerExtra, + ) => Promise, ) { - this.setRequestHandler(McpUiUpdateContextRequestSchema, async (request) => { - callback(request.params); - return {}; - }); + this.setRequestHandler( + McpUiUpdateContextRequestSchema, + async (request, extra) => { + return callback(request.params, extra); + }, + ); } /** From 5369d3346b60b37b3d5ff75793766924e2a43238 Mon Sep 17 00:00:00 2001 From: Ido Salomon Date: Wed, 10 Dec 2025 20:24:59 +0200 Subject: [PATCH 5/9] CR --- specification/draft/apps.mdx | 2 +- src/app-bridge.test.ts | 18 +++++++++--------- src/app-bridge.ts | 4 ++-- src/app.ts | 6 +++--- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/specification/draft/apps.mdx b/specification/draft/apps.mdx index d816b7e6..0601cc16 100644 --- a/specification/draft/apps.mdx +++ b/specification/draft/apps.mdx @@ -565,7 +565,7 @@ Host SHOULD add the message to the conversation thread, preserving the specified } ``` -Guest UI MAY send this request to inform the agent about app state changes that should be stored in the conversation context for future reasoning. This event serves a different use case from `notifications/message` (logging) and `ui/message` (which also trigger followups). +Guest UI MAY send this request to inform the agent about app state changes that should be stored in the conversation context for future reasoning. This event serves a different use case from `notifications/message` (logging) and `ui/message` (which also trigger follow-ups). Host behavior: - SHOULD store the context update in the conversation context diff --git a/src/app-bridge.test.ts b/src/app-bridge.test.ts index 1ba07ffd..96fc1566 100644 --- a/src/app-bridge.test.ts +++ b/src/app-bridge.test.ts @@ -213,15 +213,15 @@ describe("App <-> AppBridge integration", () => { }); }); - it("app.sendContext triggers bridge.oncontext and returns result", async () => { + it("app.sendUpdateContext triggers bridge.onupdatecontext and returns result", async () => { const receivedContexts: unknown[] = []; - bridge.oncontext = async (params) => { + bridge.onupdatecontext = async (params) => { receivedContexts.push(params); return {}; }; await app.connect(appTransport); - const result = await app.sendContext({ + const result = await app.sendUpdateContext({ role: "user", content: [{ type: "text", text: "User selected 3 items" }], }); @@ -234,15 +234,15 @@ describe("App <-> AppBridge integration", () => { expect(result).toEqual({}); }); - it("app.sendContext works with multiple content blocks", async () => { + it("app.sendUpdateContext works with multiple content blocks", async () => { const receivedContexts: unknown[] = []; - bridge.oncontext = async (params) => { + bridge.onupdatecontext = async (params) => { receivedContexts.push(params); return {}; }; await app.connect(appTransport); - const result = await app.sendContext({ + const result = await app.sendUpdateContext({ role: "user", content: [ { type: "text", text: "Filter applied" }, @@ -261,13 +261,13 @@ describe("App <-> AppBridge integration", () => { expect(result).toEqual({}); }); - it("app.sendContext returns error result when handler indicates error", async () => { - bridge.oncontext = async () => { + it("app.sendUpdateContext returns error result when handler indicates error", async () => { + bridge.onupdatecontext = async () => { return { isError: true }; }; await app.connect(appTransport); - const result = await app.sendContext({ + const result = await app.sendUpdateContext({ role: "user", content: [{ type: "text", text: "Test" }], }); diff --git a/src/app-bridge.ts b/src/app-bridge.ts index 1deea433..65e7b2ad 100644 --- a/src/app-bridge.ts +++ b/src/app-bridge.ts @@ -521,7 +521,7 @@ export class AppBridge extends Protocol { * * @example * ```typescript - * bridge.oncontext = async ({ role, content }, extra) => { + * bridge.onupdatecontext = async ({ role, content }, extra) => { * try { * // Store context update for agent reasoning * conversationContext.push({ @@ -541,7 +541,7 @@ export class AppBridge extends Protocol { * @see {@link McpUiUpdateContextRequest} for the request type * @see {@link McpUiUpdateContextResult} for the result type */ - set oncontext( + set onupdatecontext( callback: ( params: McpUiUpdateContextRequest["params"], extra: RequestHandlerExtra, diff --git a/src/app.ts b/src/app.ts index 2eb9baf9..92e4d668 100644 --- a/src/app.ts +++ b/src/app.ts @@ -680,14 +680,14 @@ export class App extends Protocol { * * Unlike `sendLog` which is for debugging/telemetry, context updates are intended * to inform the agent about app state changes that should be available for future - * reasoning without requiring a follow-up action (i.e., a prompt). + * reasoning without requiring a follow-up action (like `sendMessage`). * * @param params - Context role and content (same structure as ui/message) * @param options - Request options (timeout, etc.) * * @example Notify agent of significant state change * ```typescript - * await app.sendContext({ + * await app.sendUpdateContext({ * role: "user", * content: [{ type: "text", text: "User selected 3 items totaling $150.00" }] * }); @@ -695,7 +695,7 @@ export class App extends Protocol { * * @returns Promise that resolves when the context update is acknowledged */ - sendContext( + sendUpdateContext( params: McpUiUpdateContextRequest["params"], options?: RequestOptions, ) { From 0447af5d37f6dea57f13396a7bf9e2dff265298a Mon Sep 17 00:00:00 2001 From: Ido Salomon Date: Wed, 10 Dec 2025 22:21:17 +0200 Subject: [PATCH 6/9] comment --- specification/draft/apps.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/draft/apps.mdx b/specification/draft/apps.mdx index 0601cc16..1d9ca150 100644 --- a/specification/draft/apps.mdx +++ b/specification/draft/apps.mdx @@ -379,7 +379,7 @@ UI iframes can use the following subset of standard MCP protocol messages: **Notifications:** -- `notifications/message` - Log messages to host (for logging) +- `notifications/message` - Log messages to host **Lifecycle:** From 7392629f4c8f14724a812f4c5950cf149c4f008b Mon Sep 17 00:00:00 2001 From: Ido Salomon Date: Wed, 10 Dec 2025 22:26:42 +0200 Subject: [PATCH 7/9] rename capability --- src/generated/schema.json | 4 ++-- src/generated/schema.ts | 2 +- src/spec.types.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/generated/schema.json b/src/generated/schema.json index 935b8c30..dab2b073 100644 --- a/src/generated/schema.json +++ b/src/generated/schema.json @@ -90,7 +90,7 @@ "properties": {}, "additionalProperties": false }, - "context": { + "updateContext": { "description": "Host accepts context updates to be stored in the agent's conversation context.", "type": "object", "properties": {}, @@ -858,7 +858,7 @@ "properties": {}, "additionalProperties": false }, - "context": { + "updateContext": { "description": "Host accepts context updates to be stored in the agent's conversation context.", "type": "object", "properties": {}, diff --git a/src/generated/schema.ts b/src/generated/schema.ts index 8c4baddf..db242182 100644 --- a/src/generated/schema.ts +++ b/src/generated/schema.ts @@ -232,7 +232,7 @@ export const McpUiHostCapabilitiesSchema = z.object({ /** @description Host accepts log messages. */ logging: z.object({}).optional().describe("Host accepts log messages."), /** @description Host accepts context updates to be stored in the agent's conversation context. */ - context: z + updateContext: z .object({}) .optional() .describe( diff --git a/src/spec.types.ts b/src/spec.types.ts index 5fa57308..71757e1e 100644 --- a/src/spec.types.ts +++ b/src/spec.types.ts @@ -308,7 +308,7 @@ export interface McpUiHostCapabilities { /** @description Host accepts log messages. */ logging?: {}; /** @description Host accepts context updates to be stored in the agent's conversation context. */ - context?: {}; + updateContext?: {}; } /** From 9e920c926b087d78ef5b7b2dd3c0748a0932fcb2 Mon Sep 17 00:00:00 2001 From: Ido Salomon Date: Fri, 19 Dec 2025 00:30:57 +0200 Subject: [PATCH 8/9] Update to `update-model-context` --- specification/draft/apps.mdx | 17 +++++++------- src/app-bridge.test.ts | 18 +++++++-------- src/app-bridge.ts | 42 +++++++++++++++------------------- src/app.ts | 26 ++++++++++----------- src/generated/schema.json | 44 ++++++++++++++++++------------------ src/generated/schema.test.ts | 24 ++++++++++---------- src/generated/schema.ts | 22 +++++++++--------- src/spec.types.ts | 22 +++++++++--------- src/types.ts | 8 +++---- 9 files changed, 109 insertions(+), 114 deletions(-) diff --git a/specification/draft/apps.mdx b/specification/draft/apps.mdx index 1d9ca150..5193f18c 100644 --- a/specification/draft/apps.mdx +++ b/specification/draft/apps.mdx @@ -533,14 +533,14 @@ Host SHOULD open the URL in the user's default browser or a new tab. Host SHOULD add the message to the conversation thread, preserving the specified role. -`ui/update-context` - Update the agent's conversation context +`ui/update-model-context` - Update the model context ```typescript // Request { jsonrpc: "2.0", id: 3, - method: "ui/update-context", + method: "ui/update-model-context", params: { role: "user", content: ContentBlock[] @@ -565,12 +565,13 @@ Host SHOULD add the message to the conversation thread, preserving the specified } ``` -Guest UI MAY send this request to inform the agent about app state changes that should be stored in the conversation context for future reasoning. This event serves a different use case from `notifications/message` (logging) and `ui/message` (which also trigger follow-ups). +Guest UI MAY send this request to update the Host's model context. This context will be used in future turns. Each request overwrites the previous context sent by the Guest UI. +This event serves a different use case from `notifications/message` (logging) and `ui/message` (which also trigger follow-ups). Host behavior: -- SHOULD store the context update in the conversation context +- SHOULD store the context snapshot in the conversation context +- SHOULD overwrite the previous model context with the new update - MAY display context updates to the user -- MAY filter or aggregate context updates #### Notifications (Host → UI) @@ -806,9 +807,9 @@ sequenceDiagram H -->> UI: ui/message response H -->> H: Process message and follow up else Context update - UI ->> H: ui/update-context - H ->> H: Store in conversation context - H -->> UI: ui/update-context response + UI ->> H: ui/update-model-context + H ->> H: Store model context (overwrite existing) + H -->> UI: ui/update-model-context response else Log UI ->> H: notifications/message H ->> H: Record log for debugging/telemetry diff --git a/src/app-bridge.test.ts b/src/app-bridge.test.ts index 96fc1566..d1551d84 100644 --- a/src/app-bridge.test.ts +++ b/src/app-bridge.test.ts @@ -213,15 +213,15 @@ describe("App <-> AppBridge integration", () => { }); }); - it("app.sendUpdateContext triggers bridge.onupdatecontext and returns result", async () => { + it("app.sendUpdateModelContext triggers bridge.onupdatemodelcontext and returns result", async () => { const receivedContexts: unknown[] = []; - bridge.onupdatecontext = async (params) => { + bridge.onupdatemodelcontext = async (params) => { receivedContexts.push(params); return {}; }; await app.connect(appTransport); - const result = await app.sendUpdateContext({ + const result = await app.sendUpdateModelContext({ role: "user", content: [{ type: "text", text: "User selected 3 items" }], }); @@ -234,15 +234,15 @@ describe("App <-> AppBridge integration", () => { expect(result).toEqual({}); }); - it("app.sendUpdateContext works with multiple content blocks", async () => { + it("app.sendUpdateModelContext works with multiple content blocks", async () => { const receivedContexts: unknown[] = []; - bridge.onupdatecontext = async (params) => { + bridge.onupdatemodelcontext = async (params) => { receivedContexts.push(params); return {}; }; await app.connect(appTransport); - const result = await app.sendUpdateContext({ + const result = await app.sendUpdateModelContext({ role: "user", content: [ { type: "text", text: "Filter applied" }, @@ -261,13 +261,13 @@ describe("App <-> AppBridge integration", () => { expect(result).toEqual({}); }); - it("app.sendUpdateContext returns error result when handler indicates error", async () => { - bridge.onupdatecontext = async () => { + it("app.sendUpdateModelContext returns error result when handler indicates error", async () => { + bridge.onupdatemodelcontext = async () => { return { isError: true }; }; await app.connect(appTransport); - const result = await app.sendUpdateContext({ + const result = await app.sendUpdateModelContext({ role: "user", content: [{ type: "text", text: "Test" }], }); diff --git a/src/app-bridge.ts b/src/app-bridge.ts index 65e7b2ad..db0c1b85 100644 --- a/src/app-bridge.ts +++ b/src/app-bridge.ts @@ -39,9 +39,9 @@ import { type McpUiToolResultNotification, LATEST_PROTOCOL_VERSION, McpUiAppCapabilities, - McpUiUpdateContextRequest, - McpUiUpdateContextRequestSchema, - McpUiUpdateContextResult, + McpUiUpdateModelContextRequest, + McpUiUpdateModelContextRequestSchema, + McpUiUpdateModelContextResult, McpUiHostCapabilities, McpUiHostContext, McpUiHostContextChangedNotification, @@ -506,30 +506,24 @@ export class AppBridge extends Protocol { } /** - * Register a handler for context updates from the Guest UI. + * Register a handler for model context updates from the Guest UI. * - * The Guest UI sends `ui/update-context` requests to inform the agent - * about app state changes that should be stored in the conversation context for - * future reasoning. Unlike logging messages, context updates are intended to be - * available to the agent for decision making. - * - * @param callback - Handler that receives context update params and returns a result - * - params.role - Message role (currently only "user") - * - params.content - Content blocks (text, image, etc.) - * - extra - Request metadata (abort signal, session info) - * - Returns: Promise with optional isError flag + * The Guest UI sends `ui/update-model-context` requests to update the Host's + * model context. Each request overwrites the previous context stored by the Guest UI. + * Unlike logging messages, context updates are intended to be available to + * the model in future turns. Unlike messages, context updates do not trigger follow-ups * * @example * ```typescript - * bridge.onupdatecontext = async ({ role, content }, extra) => { + * bridge.onupdatemodelcontext = async ({ role, content }, extra) => { * try { - * // Store context update for agent reasoning - * conversationContext.push({ + * // Update the model context with the new snapshot + * modelContext = { * type: "app_context", * role, * content, * timestamp: Date.now() - * }); + * }; * return {}; * } catch (err) { * // Handle error and signal failure to the app @@ -538,17 +532,17 @@ export class AppBridge extends Protocol { * }; * ``` * - * @see {@link McpUiUpdateContextRequest} for the request type - * @see {@link McpUiUpdateContextResult} for the result type + * @see {@link McpUiUpdateModelContextRequest} for the request type + * @see {@link McpUiUpdateModelContextResult} for the result type */ - set onupdatecontext( + set onupdatemodelcontext( callback: ( - params: McpUiUpdateContextRequest["params"], + params: McpUiUpdateModelContextRequest["params"], extra: RequestHandlerExtra, - ) => Promise, + ) => Promise, ) { this.setRequestHandler( - McpUiUpdateContextRequestSchema, + McpUiUpdateModelContextRequestSchema, async (request, extra) => { return callback(request.params, extra); }, diff --git a/src/app.ts b/src/app.ts index 92e4d668..20007c02 100644 --- a/src/app.ts +++ b/src/app.ts @@ -21,8 +21,8 @@ import { import { LATEST_PROTOCOL_VERSION, McpUiAppCapabilities, - McpUiUpdateContextRequest, - McpUiUpdateContextResultSchema, + McpUiUpdateModelContextRequest, + McpUiUpdateModelContextResultSchema, McpUiHostCapabilities, McpUiHostContextChangedNotification, McpUiHostContextChangedNotificationSchema, @@ -676,18 +676,18 @@ export class App extends Protocol { } /** - * Send context updates to the host for storage in the agent's conversation context. + * Send context updates to the host to be included in the agent's context. * - * Unlike `sendLog` which is for debugging/telemetry, context updates are intended - * to inform the agent about app state changes that should be available for future - * reasoning without requiring a follow-up action (like `sendMessage`). + * Unlike `sendLog`, which is for debugging/telemetry, context updates + * are inteded to be available to the model in future reasoning, + * without requiring a follow-up action (like `sendMessage`). * * @param params - Context role and content (same structure as ui/message) * @param options - Request options (timeout, etc.) * - * @example Notify agent of significant state change + * @example Update model context with current app state * ```typescript - * await app.sendUpdateContext({ + * await app.sendUpdateModelContext({ * role: "user", * content: [{ type: "text", text: "User selected 3 items totaling $150.00" }] * }); @@ -695,16 +695,16 @@ export class App extends Protocol { * * @returns Promise that resolves when the context update is acknowledged */ - sendUpdateContext( - params: McpUiUpdateContextRequest["params"], + sendUpdateModelContext( + params: McpUiUpdateModelContextRequest["params"], options?: RequestOptions, ) { return this.request( - { - method: "ui/update-context", + { + method: "ui/update-model-context", params, }, - McpUiUpdateContextResultSchema, + McpUiUpdateModelContextResultSchema, options, ); } diff --git a/src/generated/schema.json b/src/generated/schema.json index dab2b073..24576374 100644 --- a/src/generated/schema.json +++ b/src/generated/schema.json @@ -90,8 +90,8 @@ "properties": {}, "additionalProperties": false }, - "updateContext": { - "description": "Host accepts context updates to be stored in the agent's conversation context.", + "updateModelContext": { + "description": "Host accepts context updates to be included in the model's context for future turns.", "type": "object", "properties": {}, "additionalProperties": false @@ -858,8 +858,8 @@ "properties": {}, "additionalProperties": false }, - "updateContext": { - "description": "Host accepts context updates to be stored in the agent's conversation context.", + "updateModelContext": { + "description": "Host accepts context updates to be included in the model's context for future turns.", "type": "object", "properties": {}, "additionalProperties": false @@ -1224,7 +1224,7 @@ "lastModified": { "type": "string", "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-]\\d{2}:\\d{2})))$" + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$" } }, "additionalProperties": false @@ -1271,7 +1271,7 @@ "lastModified": { "type": "string", "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-]\\d{2}:\\d{2})))$" + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$" } }, "additionalProperties": false @@ -1318,7 +1318,7 @@ "lastModified": { "type": "string", "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-]\\d{2}:\\d{2})))$" + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$" } }, "additionalProperties": false @@ -1392,7 +1392,7 @@ "lastModified": { "type": "string", "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-]\\d{2}:\\d{2})))$" + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$" } }, "additionalProperties": false @@ -1485,7 +1485,7 @@ "lastModified": { "type": "string", "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-]\\d{2}:\\d{2})))$" + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$" } }, "additionalProperties": false @@ -1861,7 +1861,7 @@ "lastModified": { "type": "string", "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-]\\d{2}:\\d{2})))$" + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$" } }, "additionalProperties": false @@ -1908,7 +1908,7 @@ "lastModified": { "type": "string", "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-]\\d{2}:\\d{2})))$" + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$" } }, "additionalProperties": false @@ -1955,7 +1955,7 @@ "lastModified": { "type": "string", "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-]\\d{2}:\\d{2})))$" + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$" } }, "additionalProperties": false @@ -2029,7 +2029,7 @@ "lastModified": { "type": "string", "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-]\\d{2}:\\d{2})))$" + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$" } }, "additionalProperties": false @@ -2122,7 +2122,7 @@ "lastModified": { "type": "string", "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-]\\d{2}:\\d{2})))$" + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$" } }, "additionalProperties": false @@ -2159,13 +2159,13 @@ "required": ["method", "params"], "additionalProperties": false }, - "McpUiUpdateContextRequest": { + "McpUiUpdateModelContextRequest": { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "method": { "type": "string", - "const": "ui/update-context" + "const": "ui/update-model-context" }, "params": { "type": "object", @@ -2208,7 +2208,7 @@ "lastModified": { "type": "string", "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-]\\d{2}:\\d{2})))$" + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$" } }, "additionalProperties": false @@ -2255,7 +2255,7 @@ "lastModified": { "type": "string", "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-]\\d{2}:\\d{2})))$" + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$" } }, "additionalProperties": false @@ -2302,7 +2302,7 @@ "lastModified": { "type": "string", "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-]\\d{2}:\\d{2})))$" + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$" } }, "additionalProperties": false @@ -2376,7 +2376,7 @@ "lastModified": { "type": "string", "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-]\\d{2}:\\d{2})))$" + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$" } }, "additionalProperties": false @@ -2469,7 +2469,7 @@ "lastModified": { "type": "string", "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-]\\d{2}:\\d{2})))$" + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$" } }, "additionalProperties": false @@ -2496,7 +2496,7 @@ "required": ["method", "params"], "additionalProperties": false }, - "McpUiUpdateContextResult": { + "McpUiUpdateModelContextResult": { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { diff --git a/src/generated/schema.test.ts b/src/generated/schema.test.ts index 1cb66756..3704764f 100644 --- a/src/generated/schema.test.ts +++ b/src/generated/schema.test.ts @@ -51,8 +51,8 @@ export type McpUiToolInputPartialNotificationSchemaInferredType = z.infer< typeof generated.McpUiToolInputPartialNotificationSchema >; -export type McpUiUpdateContextResultSchemaInferredType = z.infer< - typeof generated.McpUiUpdateContextResultSchema +export type McpUiUpdateModelContextResultSchemaInferredType = z.infer< + typeof generated.McpUiUpdateModelContextResultSchema >; export type McpUiResourceTeardownRequestSchemaInferredType = z.infer< @@ -99,8 +99,8 @@ export type McpUiHostContextChangedNotificationSchemaInferredType = z.infer< typeof generated.McpUiHostContextChangedNotificationSchema >; -export type McpUiUpdateContextRequestSchemaInferredType = z.infer< - typeof generated.McpUiUpdateContextRequestSchema +export type McpUiUpdateModelContextRequestSchemaInferredType = z.infer< + typeof generated.McpUiUpdateModelContextRequestSchema >; export type McpUiInitializeRequestSchemaInferredType = z.infer< @@ -159,11 +159,11 @@ expectType( expectType( {} as spec.McpUiToolInputPartialNotification, ); -expectType( - {} as McpUiUpdateContextResultSchemaInferredType, +expectType( + {} as McpUiUpdateModelContextResultSchemaInferredType, ); -expectType( - {} as spec.McpUiUpdateContextResult, +expectType( + {} as spec.McpUiUpdateModelContextResult, ); expectType( {} as McpUiResourceTeardownRequestSchemaInferredType, @@ -219,11 +219,11 @@ expectType( expectType( {} as spec.McpUiHostContextChangedNotification, ); -expectType( - {} as McpUiUpdateContextRequestSchemaInferredType, +expectType( + {} as McpUiUpdateModelContextRequestSchemaInferredType, ); -expectType( - {} as spec.McpUiUpdateContextRequest, +expectType( + {} as spec.McpUiUpdateModelContextRequest, ); expectType( {} as McpUiInitializeRequestSchemaInferredType, diff --git a/src/generated/schema.ts b/src/generated/schema.ts index db242182..f5341bc3 100644 --- a/src/generated/schema.ts +++ b/src/generated/schema.ts @@ -161,10 +161,10 @@ export const McpUiToolInputPartialNotificationSchema = z.object({ }); /** - * @description Result from updating the agent's context. - * @see {@link McpUiUpdateContextRequest} + * @description Result from setting the agent's model context. + * @see {@link McpUiUpdateModelContextRequest} */ -export const McpUiUpdateContextResultSchema = z.looseObject({ +export const McpUiUpdateModelContextResultSchema = z.looseObject({ /** @description True if the host rejected or failed to store the context update. */ isError: z .boolean() @@ -231,12 +231,12 @@ export const McpUiHostCapabilitiesSchema = z.object({ .describe("Host can proxy resource reads to the MCP server."), /** @description Host accepts log messages. */ logging: z.object({}).optional().describe("Host accepts log messages."), - /** @description Host accepts context updates to be stored in the agent's conversation context. */ - updateContext: z + /** @description Host accepts context updates to be included in the model's context for future turns. */ + updateModelContext: z .object({}) .optional() .describe( - "Host accepts context updates to be stored in the agent's conversation context.", + "Host accepts context updates to be included in the model's context for future turns.", ), }); @@ -448,13 +448,13 @@ export const McpUiHostContextChangedNotificationSchema = z.object({ * @description Request to update the agent's context without requiring a follow-up action (Guest UI -> Host). * * Unlike `notifications/message` which is for debugging/logging, this request is intended - * to inform the agent about app-driven updates that should be stored in the conversation context - * for future reasoning. * - * @see {@link app.App.sendUpdateContext} for the method that sends this request + * to update the Host's model context. Each request overwrites the previous context sent by the Guest UI. + * Unlike messages, context updates do not trigger follow-ups. + * @see {@link app.App.sendUpdateModelContext} for the method that sends this request */ -export const McpUiUpdateContextRequestSchema = z.object({ - method: z.literal("ui/update-context"), +export const McpUiUpdateModelContextRequestSchema = z.object({ + method: z.literal("ui/update-model-context"), params: z.object({ /** @description Message role, currently only "user" is supported. */ role: z diff --git a/src/spec.types.ts b/src/spec.types.ts index 71757e1e..6c193bc9 100644 --- a/src/spec.types.ts +++ b/src/spec.types.ts @@ -237,13 +237,13 @@ export interface McpUiHostContextChangedNotification { * @description Request to update the agent's context without requiring a follow-up action (Guest UI -> Host). * * Unlike `notifications/message` which is for debugging/logging, this request is intended - * to inform the agent about app-driven updates that should be stored in the conversation context - * for future reasoning. - * - * @see {@link app.App.sendUpdateContext} for the method that sends this request + * + * to update the Host's model context. Each request overwrites the previous context sent by the Guest UI. + * Unlike messages, context updates do not trigger follow-ups. + * @see {@link app.App.sendUpdateModelContext} for the method that sends this request */ -export interface McpUiUpdateContextRequest { - method: "ui/update-context"; +export interface McpUiUpdateModelContextRequest { + method: "ui/update-model-context"; params: { /** @description Message role, currently only "user" is supported. */ role: "user"; @@ -253,10 +253,10 @@ export interface McpUiUpdateContextRequest { } /** - * @description Result from updating the agent's context. - * @see {@link McpUiUpdateContextRequest} + * @description Result from setting the agent's model context. + * @see {@link McpUiUpdateModelContextRequest} */ -export interface McpUiUpdateContextResult { +export interface McpUiUpdateModelContextResult { /** @description True if the host rejected or failed to store the context update. */ isError?: boolean; /** @@ -307,8 +307,8 @@ export interface McpUiHostCapabilities { }; /** @description Host accepts log messages. */ logging?: {}; - /** @description Host accepts context updates to be stored in the agent's conversation context. */ - updateContext?: {}; + /** @description Host accepts context updates to be included in the model's context for future turns. */ + updateModelContext?: {}; } /** diff --git a/src/types.ts b/src/types.ts index e5555509..f4ea6723 100644 --- a/src/types.ts +++ b/src/types.ts @@ -18,8 +18,8 @@ export { type McpUiOpenLinkResult, type McpUiMessageRequest, type McpUiMessageResult, - type McpUiUpdateContextRequest, - type McpUiUpdateContextResult, + type McpUiUpdateModelContextRequest, + type McpUiUpdateModelContextResult, type McpUiSandboxProxyReadyNotification, type McpUiSandboxResourceReadyNotification, type McpUiSizeChangedNotification, @@ -47,8 +47,8 @@ export { McpUiOpenLinkResultSchema, McpUiMessageRequestSchema, McpUiMessageResultSchema, - McpUiUpdateContextRequestSchema, - McpUiUpdateContextResultSchema, + McpUiUpdateModelContextRequestSchema, + McpUiUpdateModelContextResultSchema, McpUiSandboxProxyReadyNotificationSchema, McpUiSandboxResourceReadyNotificationSchema, McpUiSizeChangedNotificationSchema, From 27f950a24ba5af16e37bc886aa67758798a7db23 Mon Sep 17 00:00:00 2001 From: Ido Salomon Date: Fri, 19 Dec 2025 00:31:56 +0200 Subject: [PATCH 9/9] clean up comment --- src/generated/schema.ts | 1 - src/spec.types.ts | 1 - 2 files changed, 2 deletions(-) diff --git a/src/generated/schema.ts b/src/generated/schema.ts index f5341bc3..e7d3b843 100644 --- a/src/generated/schema.ts +++ b/src/generated/schema.ts @@ -448,7 +448,6 @@ export const McpUiHostContextChangedNotificationSchema = z.object({ * @description Request to update the agent's context without requiring a follow-up action (Guest UI -> Host). * * Unlike `notifications/message` which is for debugging/logging, this request is intended - * * to update the Host's model context. Each request overwrites the previous context sent by the Guest UI. * Unlike messages, context updates do not trigger follow-ups. * @see {@link app.App.sendUpdateModelContext} for the method that sends this request diff --git a/src/spec.types.ts b/src/spec.types.ts index 6c193bc9..106c7e3d 100644 --- a/src/spec.types.ts +++ b/src/spec.types.ts @@ -237,7 +237,6 @@ export interface McpUiHostContextChangedNotification { * @description Request to update the agent's context without requiring a follow-up action (Guest UI -> Host). * * Unlike `notifications/message` which is for debugging/logging, this request is intended - * * to update the Host's model context. Each request overwrites the previous context sent by the Guest UI. * Unlike messages, context updates do not trigger follow-ups. * @see {@link app.App.sendUpdateModelContext} for the method that sends this request