Skip to content

Commit 2eb6dc9

Browse files
committed
Update documentation and revert type change
1 parent c47b970 commit 2eb6dc9

File tree

5 files changed

+108
-200
lines changed

5 files changed

+108
-200
lines changed

specification/draft/apps.mdx

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -456,18 +456,17 @@ interface HostContext {
456456
displayMode?: "inline" | "fullscreen" | "pip";
457457
/** Display modes the host supports */
458458
availableDisplayModes?: string[];
459-
/**
460-
* Viewport dimensions available to the UI.
461-
*
462-
* The viewport has two independent dimension pairs:
463-
* - Height: Either `height` (fixed) or `maxHeight` (flexible), never both
464-
* - Width: Either `width` (fixed) or `maxWidth` (flexible), never both
465-
*
466-
* Fixed dimensions (height/width): The host controls the size. Set height: 100% (recommended) or use the pixel value directly.
467-
* Flexible dimensions (maxHeight/maxWidth or undefined): The app controls the size, up to the max if specified.
468-
*/
469-
viewport?: ({ height: number } | { maxHeight?: number }) &
470-
({ width: number } | { maxWidth?: number });
459+
/** Current and maximum dimensions available to the UI. */
460+
viewport?: {
461+
/** Current viewport width in pixels. */
462+
width: number;
463+
/** Current viewport height in pixels. */
464+
height: number;
465+
/** Maximum available height in pixels (if constrained). */
466+
maxHeight?: number;
467+
/** Maximum available width in pixels (if constrained). */
468+
maxWidth?: number;
469+
};
471470
/** User's language/region preference (BCP 47, e.g., "en-US") */
472471
locale?: string;
473472
/** User's timezone (IANA, e.g., "America/New_York") */

src/app-bridge.test.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ describe("App <-> AppBridge integration", () => {
113113
const testHostContext = {
114114
theme: "dark" as const,
115115
locale: "en-US",
116-
viewport: { width: 800, maxHeight: 600 },
116+
viewport: { width: 800, height: 600, maxHeight: 600 },
117117
};
118118
const newBridge = new AppBridge(
119119
createMockClient() as Client,
@@ -337,7 +337,7 @@ describe("App <-> AppBridge integration", () => {
337337
const initialContext = {
338338
theme: "light" as const,
339339
locale: "en-US",
340-
viewport: { width: 800, maxHeight: 600 },
340+
viewport: { width: 800, height: 600, maxHeight: 600 },
341341
};
342342
const newBridge = new AppBridge(
343343
createMockClient() as Client,
@@ -356,7 +356,7 @@ describe("App <-> AppBridge integration", () => {
356356

357357
// Send another partial update: only viewport changes
358358
newBridge.sendHostContextChange({
359-
viewport: { width: 1024, maxHeight: 768 },
359+
viewport: { width: 1024, height: 768, maxHeight: 768 },
360360
});
361361
await flush();
362362

@@ -367,7 +367,11 @@ describe("App <-> AppBridge integration", () => {
367367
const context = newApp.getHostContext();
368368
expect(context?.theme).toBe("dark");
369369
expect(context?.locale).toBe("en-US");
370-
expect(context?.viewport).toEqual({ width: 1024, maxHeight: 768 });
370+
expect(context?.viewport).toEqual({
371+
width: 1024,
372+
height: 768,
373+
maxHeight: 768,
374+
});
371375

372376
await newAppTransport.close();
373377
await newBridgeTransport.close();

src/generated/schema.json

Lines changed: 60 additions & 141 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/generated/schema.ts

Lines changed: 18 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/spec.types.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -313,18 +313,17 @@ export interface McpUiHostContext {
313313
displayMode?: McpUiDisplayMode;
314314
/** @description Display modes the host supports. */
315315
availableDisplayModes?: string[];
316-
/**
317-
* @description Viewport dimensions available to the UI.
318-
*
319-
* The viewport has two independent dimension pairs:
320-
* - Height: Either `height` (fixed) or `maxHeight` (flexible), never both
321-
* - Width: Either `width` (fixed) or `maxWidth` (flexible), never both
322-
*
323-
* Fixed dimensions (height/width): The host controls the size. Set height: 100% (recommended) or use the pixel value directly.
324-
* Flexible dimensions (maxHeight/maxWidth or undefined): The app controls the size, up to the max if specified. If undefined, there is no limit.
325-
*/
326-
viewport?: ({ height: number } | { maxHeight?: number }) &
327-
({ width: number } | { maxWidth?: number });
316+
/** @description Current and maximum dimensions available to the UI. */
317+
viewport?: {
318+
/** @description Current viewport width in pixels. */
319+
width: number;
320+
/** @description Current viewport height in pixels. */
321+
height: number;
322+
/** @description Maximum available height in pixels (if constrained). */
323+
maxHeight?: number;
324+
/** @description Maximum available width in pixels (if constrained). */
325+
maxWidth?: number;
326+
};
328327
/** @description User's language and region preference in BCP 47 format. */
329328
locale?: string;
330329
/** @description User's timezone in IANA format. */

0 commit comments

Comments
 (0)