Clarify documentation

This commit is contained in:
martinalong 2025-12-17 21:36:35 -08:00
commit 06c0e08a17
No known key found for this signature in database
4 changed files with 46 additions and 38 deletions

View file

@ -463,14 +463,14 @@ interface HostContext {
availableDisplayModes?: string[]; availableDisplayModes?: string[];
/** Current and maximum dimensions available to the UI. */ /** Current and maximum dimensions available to the UI. */
viewport?: { viewport?: {
/** Current viewport width in pixels. */ /** Viewport width (if fixed). Only pass width or maxWidth, not both. */
width?: number; width?: number;
/** Current viewport height in pixels. */ /** Viewport height (if fixed). Only pass height or maxHeight, not both. */
height?: number; height?: number;
/** Maximum available height in pixels (if constrained). */ /** Maximum available viewport width in pixels (if constrained). */
maxHeight?: number;
/** Maximum available width in pixels (if constrained). */
maxWidth?: number; maxWidth?: number;
/** Maximum available viewport height in pixels (if constrained). */
maxHeight?: number;
}; };
/** User's language/region preference (BCP 47, e.g., "en-US") */ /** User's language/region preference (BCP 47, e.g., "en-US") */
locale?: string; locale?: string;

View file

@ -633,19 +633,19 @@
"type": "object", "type": "object",
"properties": { "properties": {
"width": { "width": {
"description": "Current viewport width in pixels.", "description": "Viewport width in pixels (if fixed). Only pass width or maxWidth, not both.",
"type": "number" "type": "number"
}, },
"height": { "height": {
"description": "Current viewport height in pixels.", "description": "Viewport height in pixels (if fixed). Only pass height or maxHeight, not both.",
"type": "number"
},
"maxHeight": {
"description": "Maximum available height in pixels (if constrained).",
"type": "number" "type": "number"
}, },
"maxWidth": { "maxWidth": {
"description": "Maximum available width in pixels (if constrained).", "description": "Maximum available viewport width in pixels (if constrained). Only pass width or maxWidth, not both.",
"type": "number"
},
"maxHeight": {
"description": "Maximum available viewport height in pixels (if constrained). Only pass height or maxHeight, not both.",
"type": "number" "type": "number"
} }
}, },
@ -1258,19 +1258,19 @@
"type": "object", "type": "object",
"properties": { "properties": {
"width": { "width": {
"description": "Current viewport width in pixels.", "description": "Viewport width in pixels (if fixed). Only pass width or maxWidth, not both.",
"type": "number" "type": "number"
}, },
"height": { "height": {
"description": "Current viewport height in pixels.", "description": "Viewport height in pixels (if fixed). Only pass height or maxHeight, not both.",
"type": "number"
},
"maxHeight": {
"description": "Maximum available height in pixels (if constrained).",
"type": "number" "type": "number"
}, },
"maxWidth": { "maxWidth": {
"description": "Maximum available width in pixels (if constrained).", "description": "Maximum available viewport width in pixels (if constrained). Only pass width or maxWidth, not both.",
"type": "number"
},
"maxHeight": {
"description": "Maximum available viewport height in pixels (if constrained). Only pass height or maxHeight, not both.",
"type": "number" "type": "number"
} }
}, },
@ -2416,19 +2416,19 @@
"type": "object", "type": "object",
"properties": { "properties": {
"width": { "width": {
"description": "Current viewport width in pixels.", "description": "Viewport width in pixels (if fixed). Only pass width or maxWidth, not both.",
"type": "number" "type": "number"
}, },
"height": { "height": {
"description": "Current viewport height in pixels.", "description": "Viewport height in pixels (if fixed). Only pass height or maxHeight, not both.",
"type": "number"
},
"maxHeight": {
"description": "Maximum available height in pixels (if constrained).",
"type": "number" "type": "number"
}, },
"maxWidth": { "maxWidth": {
"description": "Maximum available width in pixels (if constrained).", "description": "Maximum available viewport width in pixels (if constrained). Only pass width or maxWidth, not both.",
"type": "number"
},
"maxHeight": {
"description": "Maximum available viewport height in pixels (if constrained). Only pass height or maxHeight, not both.",
"type": "number" "type": "number"
} }
}, },

View file

@ -565,26 +565,34 @@ export const McpUiHostContextSchema = z.looseObject({
/** @description Current and maximum dimensions available to the UI. */ /** @description Current and maximum dimensions available to the UI. */
viewport: z viewport: z
.object({ .object({
/** @description Current viewport width in pixels. */ /** @description Viewport width in pixels (if fixed). Only pass width or maxWidth, not both. */
width: z width: z
.number() .number()
.optional() .optional()
.describe("Current viewport width in pixels."), .describe(
/** @description Current viewport height in pixels. */ "Viewport width in pixels (if fixed). Only pass width or maxWidth, not both.",
),
/** @description Viewport height in pixels (if fixed). Only pass height or maxHeight, not both. */
height: z height: z
.number() .number()
.optional() .optional()
.describe("Current viewport height in pixels."), .describe(
/** @description Maximum available height in pixels (if constrained). */ "Viewport height in pixels (if fixed). Only pass height or maxHeight, not both.",
maxHeight: z ),
.number() /** @description Maximum available viewport width in pixels (if constrained). Only pass width or maxWidth, not both.*/
.optional()
.describe("Maximum available height in pixels (if constrained)."),
/** @description Maximum available width in pixels (if constrained). */
maxWidth: z maxWidth: z
.number() .number()
.optional() .optional()
.describe("Maximum available width in pixels (if constrained)."), .describe(
"Maximum available viewport width in pixels (if constrained). Only pass width or maxWidth, not both.",
),
/** @description Maximum available viewport height in pixels (if constrained). Only pass height or maxHeight, not both. */
maxHeight: z
.number()
.optional()
.describe(
"Maximum available viewport height in pixels (if constrained). Only pass height or maxHeight, not both.",
),
}) })
.optional() .optional()
.describe("Current and maximum dimensions available to the UI."), .describe("Current and maximum dimensions available to the UI."),

View file

@ -326,14 +326,14 @@ export interface McpUiHostContext {
availableDisplayModes?: string[]; availableDisplayModes?: string[];
/** @description Current and maximum dimensions available to the UI. */ /** @description Current and maximum dimensions available to the UI. */
viewport?: { viewport?: {
/** @description Current viewport width in pixels. */ /** @description Viewport width in pixels (if fixed). Only pass width or maxWidth, not both. */
width?: number; width?: number;
/** @description Current viewport height in pixels. */ /** @description Viewport height in pixels (if fixed). Only pass height or maxHeight, not both. */
height?: number; height?: number;
/** @description Maximum available height in pixels (if constrained). */ /** @description Maximum available viewport width in pixels (if constrained). Only pass width or maxWidth, not both.*/
maxHeight?: number;
/** @description Maximum available width in pixels (if constrained). */
maxWidth?: number; maxWidth?: number;
/** @description Maximum available viewport height in pixels (if constrained). Only pass height or maxHeight, not both. */
maxHeight?: number;
}; };
/** @description User's language and region preference in BCP 47 format. */ /** @description User's language and region preference in BCP 47 format. */
locale?: string; locale?: string;