@modelcontextprotocol/ext-apps 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/dist/src/app-bridge.d.ts +48 -2
- package/dist/src/app-bridge.js +10 -10
- package/dist/src/app-with-deps.js +9 -9
- package/dist/src/app.d.ts +42 -1
- package/dist/src/app.js +18 -18
- package/dist/src/generated/schema.d.ts +221 -20
- package/dist/src/generated/schema.test.d.ts +5 -2
- package/dist/src/react/index.js +17 -17
- package/dist/src/react/react-with-deps.js +17 -17
- package/dist/src/server/index.js +18 -18
- package/dist/src/spec.types.d.ts +70 -6
- package/dist/src/types.d.ts +4 -4
- package/package.json +2 -2
package/dist/src/app.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type RequestOptions, Protocol, ProtocolOptions } from "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
2
2
|
import { CallToolRequest, CallToolResult, Implementation, ListToolsRequest, LoggingMessageNotification } from "@modelcontextprotocol/sdk/types.js";
|
|
3
3
|
import { AppNotification, AppRequest, AppResult } from "./types";
|
|
4
|
-
import { McpUiAppCapabilities, McpUiHostCapabilities, McpUiHostContext, McpUiHostContextChangedNotification, McpUiMessageRequest, McpUiOpenLinkRequest, McpUiResourceTeardownRequest, McpUiResourceTeardownResult, McpUiSizeChangedNotification, McpUiToolCancelledNotification, McpUiToolInputNotification, McpUiToolInputPartialNotification, McpUiToolResultNotification, McpUiRequestDisplayModeRequest } from "./types";
|
|
4
|
+
import { McpUiAppCapabilities, McpUiUpdateModelContextRequest, McpUiHostCapabilities, McpUiHostContext, McpUiHostContextChangedNotification, McpUiMessageRequest, McpUiOpenLinkRequest, McpUiResourceTeardownRequest, McpUiResourceTeardownResult, McpUiSizeChangedNotification, McpUiToolCancelledNotification, McpUiToolInputNotification, McpUiToolInputPartialNotification, McpUiToolResultNotification, McpUiRequestDisplayModeRequest } from "./types";
|
|
5
5
|
import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
|
|
6
6
|
export { PostMessageTransport } from "./message-transport";
|
|
7
7
|
export * from "./types";
|
|
@@ -608,6 +608,47 @@ export declare class App extends Protocol<AppRequest, AppNotification, AppResult
|
|
|
608
608
|
* @returns Promise that resolves when the log notification is sent
|
|
609
609
|
*/
|
|
610
610
|
sendLog(params: LoggingMessageNotification["params"]): Promise<void>;
|
|
611
|
+
/**
|
|
612
|
+
* Update the host's model context with app state.
|
|
613
|
+
*
|
|
614
|
+
* Unlike `sendLog`, which is for debugging/telemetry, context updates
|
|
615
|
+
* are intended to be available to the model in future reasoning,
|
|
616
|
+
* without requiring a follow-up action (like `sendMessage`).
|
|
617
|
+
*
|
|
618
|
+
* The host will typically defer sending the context to the model until the
|
|
619
|
+
* next user message (including `ui/message`), and will only send the last
|
|
620
|
+
* update received. Each call overwrites any previous context update.
|
|
621
|
+
*
|
|
622
|
+
* @param params - Context content and/or structured content
|
|
623
|
+
* @param options - Request options (timeout, etc.)
|
|
624
|
+
*
|
|
625
|
+
* @throws {Error} If the host rejects the context update (e.g., unsupported content type)
|
|
626
|
+
*
|
|
627
|
+
* @example Update model context with current app state
|
|
628
|
+
* ```typescript
|
|
629
|
+
* await app.updateModelContext({
|
|
630
|
+
* content: [{ type: "text", text: "User selected 3 items totaling $150.00" }]
|
|
631
|
+
* });
|
|
632
|
+
* ```
|
|
633
|
+
*
|
|
634
|
+
* @example Update with structured content
|
|
635
|
+
* ```typescript
|
|
636
|
+
* await app.updateModelContext({
|
|
637
|
+
* structuredContent: { selectedItems: 3, total: 150.00, currency: "USD" }
|
|
638
|
+
* });
|
|
639
|
+
* ```
|
|
640
|
+
*
|
|
641
|
+
* @returns Promise that resolves when the context update is acknowledged
|
|
642
|
+
*/
|
|
643
|
+
updateModelContext(params: McpUiUpdateModelContextRequest["params"], options?: RequestOptions): Promise<{
|
|
644
|
+
_meta?: {
|
|
645
|
+
[x: string]: unknown;
|
|
646
|
+
progressToken?: string | number | undefined;
|
|
647
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
648
|
+
taskId: string;
|
|
649
|
+
} | undefined;
|
|
650
|
+
} | undefined;
|
|
651
|
+
}>;
|
|
611
652
|
/**
|
|
612
653
|
* Request the host to open an external URL in the default browser.
|
|
613
654
|
*
|