Allow undefined values

This commit is contained in:
martinalong 2025-12-18 00:01:34 -08:00
commit c22e86233b
No known key found for this signature in database
3 changed files with 106 additions and 20 deletions

View file

@ -330,6 +330,10 @@
"type": "string", "type": "string",
"const": "--color-text-inverse" "const": "--color-text-inverse"
}, },
{
"type": "string",
"const": "--color-text-ghost"
},
{ {
"type": "string", "type": "string",
"const": "--color-text-info" "const": "--color-text-info"
@ -634,19 +638,39 @@
"properties": { "properties": {
"width": { "width": {
"description": "Viewport width in pixels (if fixed). Only pass width or maxWidth, not both.", "description": "Viewport width in pixels (if fixed). Only pass width or maxWidth, not both.",
"type": "number" "anyOf": [
{
"type": "number"
},
{}
]
}, },
"height": { "height": {
"description": "Viewport height in pixels (if fixed). Only pass height or maxHeight, not both.", "description": "Viewport height in pixels (if fixed). Only pass height or maxHeight, not both.",
"type": "number" "anyOf": [
{
"type": "number"
},
{}
]
}, },
"maxWidth": { "maxWidth": {
"description": "Maximum available viewport width in pixels (if constrained). Only pass width or maxWidth, not both.", "description": "Maximum available viewport width in pixels (if constrained). Only pass width or maxWidth, not both.",
"type": "number" "anyOf": [
{
"type": "number"
},
{}
]
}, },
"maxHeight": { "maxHeight": {
"description": "Maximum available viewport height in pixels (if constrained). Only pass height or maxHeight, not both.", "description": "Maximum available viewport height in pixels (if constrained). Only pass height or maxHeight, not both.",
"type": "number" "anyOf": [
{
"type": "number"
},
{}
]
} }
}, },
"additionalProperties": false "additionalProperties": false
@ -955,6 +979,10 @@
"type": "string", "type": "string",
"const": "--color-text-inverse" "const": "--color-text-inverse"
}, },
{
"type": "string",
"const": "--color-text-ghost"
},
{ {
"type": "string", "type": "string",
"const": "--color-text-info" "const": "--color-text-info"
@ -1259,19 +1287,39 @@
"properties": { "properties": {
"width": { "width": {
"description": "Viewport width in pixels (if fixed). Only pass width or maxWidth, not both.", "description": "Viewport width in pixels (if fixed). Only pass width or maxWidth, not both.",
"type": "number" "anyOf": [
{
"type": "number"
},
{}
]
}, },
"height": { "height": {
"description": "Viewport height in pixels (if fixed). Only pass height or maxHeight, not both.", "description": "Viewport height in pixels (if fixed). Only pass height or maxHeight, not both.",
"type": "number" "anyOf": [
{
"type": "number"
},
{}
]
}, },
"maxWidth": { "maxWidth": {
"description": "Maximum available viewport width in pixels (if constrained). Only pass width or maxWidth, not both.", "description": "Maximum available viewport width in pixels (if constrained). Only pass width or maxWidth, not both.",
"type": "number" "anyOf": [
{
"type": "number"
},
{}
]
}, },
"maxHeight": { "maxHeight": {
"description": "Maximum available viewport height in pixels (if constrained). Only pass height or maxHeight, not both.", "description": "Maximum available viewport height in pixels (if constrained). Only pass height or maxHeight, not both.",
"type": "number" "anyOf": [
{
"type": "number"
},
{}
]
} }
}, },
"additionalProperties": false "additionalProperties": false
@ -1424,6 +1472,10 @@
"type": "string", "type": "string",
"const": "--color-text-inverse" "const": "--color-text-inverse"
}, },
{
"type": "string",
"const": "--color-text-ghost"
},
{ {
"type": "string", "type": "string",
"const": "--color-text-info" "const": "--color-text-info"
@ -2113,6 +2165,10 @@
"type": "string", "type": "string",
"const": "--color-text-inverse" "const": "--color-text-inverse"
}, },
{
"type": "string",
"const": "--color-text-ghost"
},
{ {
"type": "string", "type": "string",
"const": "--color-text-info" "const": "--color-text-info"
@ -2417,19 +2473,39 @@
"properties": { "properties": {
"width": { "width": {
"description": "Viewport width in pixels (if fixed). Only pass width or maxWidth, not both.", "description": "Viewport width in pixels (if fixed). Only pass width or maxWidth, not both.",
"type": "number" "anyOf": [
{
"type": "number"
},
{}
]
}, },
"height": { "height": {
"description": "Viewport height in pixels (if fixed). Only pass height or maxHeight, not both.", "description": "Viewport height in pixels (if fixed). Only pass height or maxHeight, not both.",
"type": "number" "anyOf": [
{
"type": "number"
},
{}
]
}, },
"maxWidth": { "maxWidth": {
"description": "Maximum available viewport width in pixels (if constrained). Only pass width or maxWidth, not both.", "description": "Maximum available viewport width in pixels (if constrained). Only pass width or maxWidth, not both.",
"type": "number" "anyOf": [
{
"type": "number"
},
{}
]
}, },
"maxHeight": { "maxHeight": {
"description": "Maximum available viewport height in pixels (if constrained). Only pass height or maxHeight, not both.", "description": "Maximum available viewport height in pixels (if constrained). Only pass height or maxHeight, not both.",
"type": "number" "anyOf": [
{
"type": "number"
},
{}
]
} }
}, },
"additionalProperties": false "additionalProperties": false
@ -3207,6 +3283,10 @@
"type": "string", "type": "string",
"const": "--color-text-inverse" "const": "--color-text-inverse"
}, },
{
"type": "string",
"const": "--color-text-ghost"
},
{ {
"type": "string", "type": "string",
"const": "--color-text-info" "const": "--color-text-info"
@ -3520,6 +3600,10 @@
"type": "string", "type": "string",
"const": "--color-text-inverse" "const": "--color-text-inverse"
}, },
{
"type": "string",
"const": "--color-text-ghost"
},
{ {
"type": "string", "type": "string",
"const": "--color-text-info" "const": "--color-text-info"

View file

@ -43,6 +43,7 @@ export const McpUiStyleVariableKeySchema = z
z.literal("--color-text-secondary"), z.literal("--color-text-secondary"),
z.literal("--color-text-tertiary"), z.literal("--color-text-tertiary"),
z.literal("--color-text-inverse"), z.literal("--color-text-inverse"),
z.literal("--color-text-ghost"),
z.literal("--color-text-info"), z.literal("--color-text-info"),
z.literal("--color-text-danger"), z.literal("--color-text-danger"),
z.literal("--color-text-success"), z.literal("--color-text-success"),
@ -567,28 +568,28 @@ export const McpUiHostContextSchema = z.looseObject({
.object({ .object({
/** @description Viewport width in pixels (if fixed). Only pass width or maxWidth, not both. */ /** @description Viewport width in pixels (if fixed). Only pass width or maxWidth, not both. */
width: z width: z
.number() .union([z.number(), z.undefined()])
.optional() .optional()
.describe( .describe(
"Viewport width in pixels (if fixed). Only pass width or maxWidth, not both.", "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. */ /** @description Viewport height in pixels (if fixed). Only pass height or maxHeight, not both. */
height: z height: z
.number() .union([z.number(), z.undefined()])
.optional() .optional()
.describe( .describe(
"Viewport height in pixels (if fixed). Only pass height or maxHeight, not both.", "Viewport height in pixels (if fixed). Only pass height or maxHeight, not both.",
), ),
/** @description Maximum available viewport width in pixels (if constrained). Only pass width or maxWidth, not both.*/ /** @description Maximum available viewport width in pixels (if constrained). Only pass width or maxWidth, not both.*/
maxWidth: z maxWidth: z
.number() .union([z.number(), z.undefined()])
.optional() .optional()
.describe( .describe(
"Maximum available viewport width in pixels (if constrained). Only pass width or maxWidth, not both.", "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. */ /** @description Maximum available viewport height in pixels (if constrained). Only pass height or maxHeight, not both. */
maxHeight: z maxHeight: z
.number() .union([z.number(), z.undefined()])
.optional() .optional()
.describe( .describe(
"Maximum available viewport height in pixels (if constrained). Only pass height or maxHeight, not both.", "Maximum available viewport height in pixels (if constrained). Only pass height or maxHeight, not both.",

View file

@ -56,6 +56,7 @@ export type McpUiStyleVariableKey =
| "--color-text-secondary" | "--color-text-secondary"
| "--color-text-tertiary" | "--color-text-tertiary"
| "--color-text-inverse" | "--color-text-inverse"
| "--color-text-ghost"
| "--color-text-info" | "--color-text-info"
| "--color-text-danger" | "--color-text-danger"
| "--color-text-success" | "--color-text-success"
@ -327,13 +328,13 @@ export interface McpUiHostContext {
/** @description Current and maximum dimensions available to the UI. */ /** @description Current and maximum dimensions available to the UI. */
viewport?: { viewport?: {
/** @description Viewport width in pixels (if fixed). Only pass width or maxWidth, not both. */ /** @description Viewport width in pixels (if fixed). Only pass width or maxWidth, not both. */
width?: number; width?: number | undefined;
/** @description Viewport height in pixels (if fixed). Only pass height or maxHeight, not both. */ /** @description Viewport height in pixels (if fixed). Only pass height or maxHeight, not both. */
height?: number; height?: number | undefined;
/** @description Maximum available viewport width in pixels (if constrained). Only pass width or maxWidth, not both.*/ /** @description Maximum available viewport width in pixels (if constrained). Only pass width or maxWidth, not both.*/
maxWidth?: number; maxWidth?: number | undefined;
/** @description Maximum available viewport height in pixels (if constrained). Only pass height or maxHeight, not both. */ /** @description Maximum available viewport height in pixels (if constrained). Only pass height or maxHeight, not both. */
maxHeight?: number; maxHeight?: number | undefined;
}; };
/** @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;