Skip to content

Commit b35a4e2

Browse files
committed
Make height/width optional as well
1 parent 2eb6dc9 commit b35a4e2

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

specification/draft/apps.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -544,20 +544,20 @@ if (viewport) {
544544
// Handle height
545545
if ("height" in viewport) {
546546
// Fixed height: fill the container
547-
document.body.style.height = "100%";
547+
document.documentElement.style.height = "100vh";
548548
} else if (viewport.maxHeight) {
549549
// Flexible with max: let content determine size, up to max
550-
document.body.style.maxHeight = `${viewport.maxHeight}px`;
550+
document.documentElement.style.maxHeight = `${viewport.maxHeight}px`;
551551
}
552552
// If neither, height is unbounded
553553

554554
// Handle width
555555
if ("width" in viewport) {
556556
// Fixed width: fill the container
557-
document.body.style.width = "100%";
557+
document.documentElement.style.width = "100vw";
558558
} else if (viewport.maxWidth) {
559559
// Flexible with max: let content determine size, up to max
560-
document.body.style.maxWidth = `${viewport.maxWidth}px`;
560+
document.documentElement.style.maxWidth = `${viewport.maxWidth}px`;
561561
}
562562
// If neither, width is unbounded
563563
}

src/generated/schema.json

Lines changed: 0 additions & 3 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: 8 additions & 2 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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,9 @@ export interface McpUiHostContext {
316316
/** @description Current and maximum dimensions available to the UI. */
317317
viewport?: {
318318
/** @description Current viewport width in pixels. */
319-
width: number;
319+
width?: number;
320320
/** @description Current viewport height in pixels. */
321-
height: number;
321+
height?: number;
322322
/** @description Maximum available height in pixels (if constrained). */
323323
maxHeight?: number;
324324
/** @description Maximum available width in pixels (if constrained). */

0 commit comments

Comments
 (0)