Skip to content

Commit 5369d33

Browse files
committed
CR
1 parent b848642 commit 5369d33

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

specification/draft/apps.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ Host SHOULD add the message to the conversation thread, preserving the specified
565565
}
566566
```
567567

568-
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).
568+
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).
569569

570570
Host behavior:
571571
- SHOULD store the context update in the conversation context

src/app-bridge.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -213,15 +213,15 @@ describe("App <-> AppBridge integration", () => {
213213
});
214214
});
215215

216-
it("app.sendContext triggers bridge.oncontext and returns result", async () => {
216+
it("app.sendUpdateContext triggers bridge.onupdatecontext and returns result", async () => {
217217
const receivedContexts: unknown[] = [];
218-
bridge.oncontext = async (params) => {
218+
bridge.onupdatecontext = async (params) => {
219219
receivedContexts.push(params);
220220
return {};
221221
};
222222

223223
await app.connect(appTransport);
224-
const result = await app.sendContext({
224+
const result = await app.sendUpdateContext({
225225
role: "user",
226226
content: [{ type: "text", text: "User selected 3 items" }],
227227
});
@@ -234,15 +234,15 @@ describe("App <-> AppBridge integration", () => {
234234
expect(result).toEqual({});
235235
});
236236

237-
it("app.sendContext works with multiple content blocks", async () => {
237+
it("app.sendUpdateContext works with multiple content blocks", async () => {
238238
const receivedContexts: unknown[] = [];
239-
bridge.oncontext = async (params) => {
239+
bridge.onupdatecontext = async (params) => {
240240
receivedContexts.push(params);
241241
return {};
242242
};
243243

244244
await app.connect(appTransport);
245-
const result = await app.sendContext({
245+
const result = await app.sendUpdateContext({
246246
role: "user",
247247
content: [
248248
{ type: "text", text: "Filter applied" },
@@ -261,13 +261,13 @@ describe("App <-> AppBridge integration", () => {
261261
expect(result).toEqual({});
262262
});
263263

264-
it("app.sendContext returns error result when handler indicates error", async () => {
265-
bridge.oncontext = async () => {
264+
it("app.sendUpdateContext returns error result when handler indicates error", async () => {
265+
bridge.onupdatecontext = async () => {
266266
return { isError: true };
267267
};
268268

269269
await app.connect(appTransport);
270-
const result = await app.sendContext({
270+
const result = await app.sendUpdateContext({
271271
role: "user",
272272
content: [{ type: "text", text: "Test" }],
273273
});

src/app-bridge.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ export class AppBridge extends Protocol<Request, Notification, Result> {
521521
*
522522
* @example
523523
* ```typescript
524-
* bridge.oncontext = async ({ role, content }, extra) => {
524+
* bridge.onupdatecontext = async ({ role, content }, extra) => {
525525
* try {
526526
* // Store context update for agent reasoning
527527
* conversationContext.push({
@@ -541,7 +541,7 @@ export class AppBridge extends Protocol<Request, Notification, Result> {
541541
* @see {@link McpUiUpdateContextRequest} for the request type
542542
* @see {@link McpUiUpdateContextResult} for the result type
543543
*/
544-
set oncontext(
544+
set onupdatecontext(
545545
callback: (
546546
params: McpUiUpdateContextRequest["params"],
547547
extra: RequestHandlerExtra,

src/app.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -680,22 +680,22 @@ export class App extends Protocol<Request, Notification, Result> {
680680
*
681681
* Unlike `sendLog` which is for debugging/telemetry, context updates are intended
682682
* to inform the agent about app state changes that should be available for future
683-
* reasoning without requiring a follow-up action (i.e., a prompt).
683+
* reasoning without requiring a follow-up action (like `sendMessage`).
684684
*
685685
* @param params - Context role and content (same structure as ui/message)
686686
* @param options - Request options (timeout, etc.)
687687
*
688688
* @example Notify agent of significant state change
689689
* ```typescript
690-
* await app.sendContext({
690+
* await app.sendUpdateContext({
691691
* role: "user",
692692
* content: [{ type: "text", text: "User selected 3 items totaling $150.00" }]
693693
* });
694694
* ```
695695
*
696696
* @returns Promise that resolves when the context update is acknowledged
697697
*/
698-
sendContext(
698+
sendUpdateContext(
699699
params: McpUiUpdateContextRequest["params"],
700700
options?: RequestOptions,
701701
) {

0 commit comments

Comments
 (0)