Skip to content

Commit 10531c8

Browse files
committed
Replace viewport with maxheight
1 parent 372c241 commit 10531c8

File tree

4 files changed

+35
-108
lines changed

4 files changed

+35
-108
lines changed

specification/draft/apps.mdx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -408,13 +408,12 @@ interface HostContext {
408408
displayMode?: "inline" | "fullscreen" | "pip";
409409
/** Display modes the host supports */
410410
availableDisplayModes?: string[];
411-
/** Current and maximum dimensions available to the UI */
412-
viewport?: {
413-
width: number;
414-
height: number;
415-
maxHeight?: number;
416-
maxWidth?: number;
417-
};
411+
/**
412+
* Maximum height in pixels available to the UI.
413+
* When inline, this is undefined (unlimited).
414+
* When fullscreen or pip, this reflects the container constraints.
415+
*/
416+
maxHeight?: number;
418417
/** User's language/region preference (BCP 47, e.g., "en-US") */
419418
locale?: string;
420419
/** User's timezone (IANA, e.g., "America/New_York") */
@@ -453,13 +452,15 @@ Example:
453452
"hostInfo": { "name": "claude-desktop", "version": "1.0.0" },
454453
"hostContext": {
455454
"theme": "dark",
456-
"displayMode": "inline",
457-
"viewport": { "width": 400, "height": 300 }
455+
"displayMode": "inline"
458456
}
459457
}
460458
}
461459
```
462460

461+
Note: When `displayMode` is `"inline"`, `maxHeight` is omitted (undefined) indicating unlimited height. For fullscreen or pip modes, hosts SHOULD provide a `maxHeight` value.
462+
463+
463464
### MCP Apps Specific Messages
464465

465466
MCP Apps introduces additional JSON-RPC methods for UI-specific functionality:

src/generated/schema.json

Lines changed: 9 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -288,29 +288,9 @@
288288
"type": "string"
289289
}
290290
},
291-
"viewport": {
292-
"description": "Current and maximum dimensions available to the UI.",
293-
"type": "object",
294-
"properties": {
295-
"width": {
296-
"description": "Current viewport width in pixels.",
297-
"type": "number"
298-
},
299-
"height": {
300-
"description": "Current viewport height in pixels.",
301-
"type": "number"
302-
},
303-
"maxHeight": {
304-
"description": "Maximum available height in pixels (if constrained).",
305-
"type": "number"
306-
},
307-
"maxWidth": {
308-
"description": "Maximum available width in pixels (if constrained).",
309-
"type": "number"
310-
}
311-
},
312-
"required": ["width", "height"],
313-
"additionalProperties": false
291+
"maxHeight": {
292+
"description": "Maximum height in pixels available to the UI.\nWhen inline, this is undefined (unlimited). When fullscreen or pip,\nthis reflects the container constraints.",
293+
"type": "number"
314294
},
315295
"locale": {
316296
"description": "User's language and region preference in BCP 47 format.",
@@ -574,29 +554,9 @@
574554
"type": "string"
575555
}
576556
},
577-
"viewport": {
578-
"description": "Current and maximum dimensions available to the UI.",
579-
"type": "object",
580-
"properties": {
581-
"width": {
582-
"description": "Current viewport width in pixels.",
583-
"type": "number"
584-
},
585-
"height": {
586-
"description": "Current viewport height in pixels.",
587-
"type": "number"
588-
},
589-
"maxHeight": {
590-
"description": "Maximum available height in pixels (if constrained).",
591-
"type": "number"
592-
},
593-
"maxWidth": {
594-
"description": "Maximum available width in pixels (if constrained).",
595-
"type": "number"
596-
}
597-
},
598-
"required": ["width", "height"],
599-
"additionalProperties": false
557+
"maxHeight": {
558+
"description": "Maximum height in pixels available to the UI.\nWhen inline, this is undefined (unlimited). When fullscreen or pip,\nthis reflects the container constraints.",
559+
"type": "number"
600560
},
601561
"locale": {
602562
"description": "User's language and region preference in BCP 47 format.",
@@ -1042,29 +1002,9 @@
10421002
"type": "string"
10431003
}
10441004
},
1045-
"viewport": {
1046-
"description": "Current and maximum dimensions available to the UI.",
1047-
"type": "object",
1048-
"properties": {
1049-
"width": {
1050-
"description": "Current viewport width in pixels.",
1051-
"type": "number"
1052-
},
1053-
"height": {
1054-
"description": "Current viewport height in pixels.",
1055-
"type": "number"
1056-
},
1057-
"maxHeight": {
1058-
"description": "Maximum available height in pixels (if constrained).",
1059-
"type": "number"
1060-
},
1061-
"maxWidth": {
1062-
"description": "Maximum available width in pixels (if constrained).",
1063-
"type": "number"
1064-
}
1065-
},
1066-
"required": ["width", "height"],
1067-
"additionalProperties": false
1005+
"maxHeight": {
1006+
"description": "Maximum height in pixels available to the UI.\nWhen inline, this is undefined (unlimited). When fullscreen or pip,\nthis reflects the container constraints.",
1007+
"type": "number"
10681008
},
10691009
"locale": {
10701010
"description": "User's language and region preference in BCP 47 format.",

src/generated/schema.ts

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -363,26 +363,17 @@ export const McpUiHostContextSchema = z.looseObject({
363363
.array(z.string())
364364
.optional()
365365
.describe("Display modes the host supports."),
366-
/** @description Current and maximum dimensions available to the UI. */
367-
viewport: z
368-
.object({
369-
/** @description Current viewport width in pixels. */
370-
width: z.number().describe("Current viewport width in pixels."),
371-
/** @description Current viewport height in pixels. */
372-
height: z.number().describe("Current viewport height in pixels."),
373-
/** @description Maximum available height in pixels (if constrained). */
374-
maxHeight: z
375-
.number()
376-
.optional()
377-
.describe("Maximum available height in pixels (if constrained)."),
378-
/** @description Maximum available width in pixels (if constrained). */
379-
maxWidth: z
380-
.number()
381-
.optional()
382-
.describe("Maximum available width in pixels (if constrained)."),
383-
})
366+
/**
367+
* @description Maximum height in pixels available to the UI.
368+
* When inline, this is undefined (unlimited). When fullscreen or pip,
369+
* this reflects the container constraints.
370+
*/
371+
maxHeight: z
372+
.number()
384373
.optional()
385-
.describe("Current and maximum dimensions available to the UI."),
374+
.describe(
375+
"Maximum height in pixels available to the UI.\nWhen inline, this is undefined (unlimited). When fullscreen or pip,\nthis reflects the container constraints.",
376+
),
386377
/** @description User's language and region preference in BCP 47 format. */
387378
locale: z
388379
.string()

src/spec.types.ts

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -199,17 +199,12 @@ export interface McpUiHostContext {
199199
displayMode?: McpUiDisplayMode;
200200
/** @description Display modes the host supports. */
201201
availableDisplayModes?: string[];
202-
/** @description Current and maximum dimensions available to the UI. */
203-
viewport?: {
204-
/** @description Current viewport width in pixels. */
205-
width: number;
206-
/** @description Current viewport height in pixels. */
207-
height: number;
208-
/** @description Maximum available height in pixels (if constrained). */
209-
maxHeight?: number;
210-
/** @description Maximum available width in pixels (if constrained). */
211-
maxWidth?: number;
212-
};
202+
/**
203+
* @description Maximum height in pixels available to the UI.
204+
* When inline, this is undefined (unlimited). When fullscreen or pip,
205+
* this reflects the container constraints.
206+
*/
207+
maxHeight?: number;
213208
/** @description User's language and region preference in BCP 47 format. */
214209
locale?: string;
215210
/** @description User's timezone in IANA format. */

0 commit comments

Comments
 (0)