@modelcontextprotocol/ext-apps 1.0.0 → 1.1.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 +158 -417
- package/dist/src/app-bridge.d.ts +14 -0
- package/dist/src/app-bridge.js +25 -8
- package/dist/src/app-with-deps.js +24 -7
- package/dist/src/app.d.ts +15 -21
- package/dist/src/app.js +26 -9
- package/dist/src/generated/schema.d.ts +9 -0
- package/dist/src/react/index.js +23 -6
- package/dist/src/react/react-with-deps.js +23 -6
- package/dist/src/react/useApp.d.ts +2 -2
- package/dist/src/server/index.d.ts +91 -18
- package/dist/src/server/index.js +25 -8
- package/dist/src/spec.types.d.ts +110 -13
- package/dist/src/styles.d.ts +12 -12
- package/package.json +3 -3
package/dist/src/app.d.ts
CHANGED
|
@@ -269,27 +269,20 @@ export declare class App extends Protocol<AppRequest, AppNotification, AppResult
|
|
|
269
269
|
*
|
|
270
270
|
* @example Progressive rendering of tool arguments
|
|
271
271
|
* ```ts source="./app.examples.ts#App_ontoolinputpartial_progressiveRendering"
|
|
272
|
-
*
|
|
273
|
-
*
|
|
272
|
+
* const codePreview = document.querySelector<HTMLPreElement>("#code-preview")!;
|
|
273
|
+
* const canvas = document.querySelector<HTMLCanvasElement>("#canvas")!;
|
|
274
274
|
*
|
|
275
275
|
* app.ontoolinputpartial = (params) => {
|
|
276
|
-
*
|
|
277
|
-
*
|
|
276
|
+
* codePreview.textContent = (params.arguments?.code as string) ?? "";
|
|
277
|
+
* codePreview.style.display = "block";
|
|
278
|
+
* canvas.style.display = "none";
|
|
278
279
|
* };
|
|
279
280
|
*
|
|
280
281
|
* app.ontoolinput = (params) => {
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
* render();
|
|
282
|
+
* codePreview.style.display = "none";
|
|
283
|
+
* canvas.style.display = "block";
|
|
284
|
+
* render(params.arguments?.code as string);
|
|
284
285
|
* };
|
|
285
|
-
*
|
|
286
|
-
* function render() {
|
|
287
|
-
* if (toolInputs) {
|
|
288
|
-
* renderFinalUI(toolInputs);
|
|
289
|
-
* } else {
|
|
290
|
-
* renderLoadingUI(toolInputsPartial); // e.g., shimmer with partial preview
|
|
291
|
-
* }
|
|
292
|
-
* }
|
|
293
286
|
* ```
|
|
294
287
|
*
|
|
295
288
|
* @see {@link setNotificationHandler `setNotificationHandler`} for the underlying method
|
|
@@ -376,8 +369,8 @@ export declare class App extends Protocol<AppRequest, AppNotification, AppResult
|
|
|
376
369
|
*
|
|
377
370
|
* @example Respond to theme changes
|
|
378
371
|
* ```ts source="./app.examples.ts#App_onhostcontextchanged_respondToTheme"
|
|
379
|
-
* app.onhostcontextchanged = (
|
|
380
|
-
* if (
|
|
372
|
+
* app.onhostcontextchanged = (ctx) => {
|
|
373
|
+
* if (ctx.theme === "dark") {
|
|
381
374
|
* document.body.classList.add("dark-theme");
|
|
382
375
|
* } else {
|
|
383
376
|
* document.body.classList.remove("dark-theme");
|
|
@@ -729,11 +722,12 @@ export declare class App extends Protocol<AppRequest, AppNotification, AppResult
|
|
|
729
722
|
*
|
|
730
723
|
* @example Toggle display mode
|
|
731
724
|
* ```ts source="./app.examples.ts#App_requestDisplayMode_toggle"
|
|
725
|
+
* const container = document.getElementById("main")!;
|
|
732
726
|
* const ctx = app.getHostContext();
|
|
733
|
-
*
|
|
734
|
-
*
|
|
735
|
-
* const result = await app.requestDisplayMode({ mode:
|
|
736
|
-
*
|
|
727
|
+
* const newMode = ctx?.displayMode === "inline" ? "fullscreen" : "inline";
|
|
728
|
+
* if (ctx?.availableDisplayModes?.includes(newMode)) {
|
|
729
|
+
* const result = await app.requestDisplayMode({ mode: newMode });
|
|
730
|
+
* container.classList.toggle("fullscreen", result.mode === "fullscreen");
|
|
737
731
|
* }
|
|
738
732
|
* ```
|
|
739
733
|
*
|