Skip to content

Commit 87f6f3f

Browse files
committed
Update documentation and revert type change
1 parent 93b9da9 commit 87f6f3f

5 files changed

Lines changed: 108 additions & 200 deletions

File tree

specification/draft/apps.mdx

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -461,18 +461,17 @@ interface HostContext {
461461
displayMode?: "inline" | "fullscreen" | "pip";
462462
/** Display modes the host supports */
463463
availableDisplayModes?: string[];
464-
/**
465-
* Viewport dimensions available to the UI.
466-
*
467-
* The viewport has two independent dimension pairs:
468-
* - Height: Either `height` (fixed) or `maxHeight` (flexible), never both
469-
* - Width: Either `width` (fixed) or `maxWidth` (flexible), never both
470-
*
471-
* Fixed dimensions (height/width): The host controls the size. Set height: 100% (recommended) or use the pixel value directly.
472-
* Flexible dimensions (maxHeight/maxWidth or undefined): The app controls the size, up to the max if specified.
473-
*/
474-
viewport?: ({ height: number } | { maxHeight?: number }) &
475-
({ width: number } | { maxWidth?: number });
464+
/** Current and maximum dimensions available to the UI. */
465+
viewport?: {
466+
/** Current viewport width in pixels. */
467+
width: number;
468+
/** Current viewport height in pixels. */
469+
height: number;
470+
/** Maximum available height in pixels (if constrained). */
471+
maxHeight?: number;
472+
/** Maximum available width in pixels (if constrained). */
473+
maxWidth?: number;
474+
};
476475
/** User's language/region preference (BCP 47, e.g., "en-US") */
477476
locale?: string;
478477
/** 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
@@ -324,18 +324,17 @@ export interface McpUiHostContext {
324324
displayMode?: McpUiDisplayMode;
325325
/** @description Display modes the host supports. */
326326
availableDisplayModes?: string[];
327-
/**
328-
* @description Viewport dimensions available to the UI.
329-
*
330-
* The viewport has two independent dimension pairs:
331-
* - Height: Either `height` (fixed) or `maxHeight` (flexible), never both
332-
* - Width: Either `width` (fixed) or `maxWidth` (flexible), never both
333-
*
334-
* Fixed dimensions (height/width): The host controls the size. Set height: 100% (recommended) or use the pixel value directly.
335-
* Flexible dimensions (maxHeight/maxWidth or undefined): The app controls the size, up to the max if specified. If undefined, there is no limit.
336-
*/
337-
viewport?: ({ height: number } | { maxHeight?: number }) &
338-
({ width: number } | { maxWidth?: number });
327+
/** @description Current and maximum dimensions available to the UI. */
328+
viewport?: {
329+
/** @description Current viewport width in pixels. */
330+
width: number;
331+
/** @description Current viewport height in pixels. */
332+
height: number;
333+
/** @description Maximum available height in pixels (if constrained). */
334+
maxHeight?: number;
335+
/** @description Maximum available width in pixels (if constrained). */
336+
maxWidth?: number;
337+
};
339338
/** @description User's language and region preference in BCP 47 format. */
340339
locale?: string;
341340
/** @description User's timezone in IANA format. */

0 commit comments

Comments
 (0)