@@ -43,6 +43,28 @@ type VerifySchemaMatches<TSchema extends z.ZodTypeAny, TInterface> =
4343 */
4444export const LATEST_PROTOCOL_VERSION = "2025-11-21" ;
4545
46+ /**
47+ * Color theme preference for the host environment.
48+ * @see {@link McpUiHostContext.theme }
49+ */
50+ export type McpUiTheme = "light" | "dark" ;
51+
52+ /** Runtime validation schema for {@link McpUiTheme}. */
53+ export const McpUiThemeSchema = z . enum ( [ "light" , "dark" ] ) ;
54+
55+ /**
56+ * Display mode for UI presentation.
57+ * - `inline`: Embedded within the conversation flow
58+ * - `fullscreen`: Expanded to fill the available viewport
59+ * - `pip`: Picture-in-picture floating window
60+ *
61+ * @see {@link McpUiHostContext.displayMode }
62+ */
63+ export type McpUiDisplayMode = "inline" | "fullscreen" | "pip" ;
64+
65+ /** Runtime validation schema for {@link McpUiDisplayMode}. */
66+ export const McpUiDisplayModeSchema = z . enum ( [ "inline" , "fullscreen" , "pip" ] ) ;
67+
4668/**
4769 * Request to open an external URL in the host's default browser.
4870 *
@@ -425,12 +447,12 @@ export interface McpUiHostContext {
425447 * Current color theme preference.
426448 * @example "dark"
427449 */
428- theme ?: "light" | "dark" ;
450+ theme ?: McpUiTheme ;
429451 /**
430452 * How the UI is currently displayed.
431453 * @example "inline"
432454 */
433- displayMode ?: "inline" | "fullscreen" | "pip" ;
455+ displayMode ?: McpUiDisplayMode ;
434456 /**
435457 * Display modes the host supports.
436458 * Apps can use this to offer mode-switching UI if applicable.
@@ -501,8 +523,8 @@ export const McpUiHostContextSchema: z.ZodType<McpUiHostContext> = z.object({
501523 tool : ToolSchema ,
502524 } )
503525 . optional ( ) ,
504- theme : z . enum ( [ "light" , "dark" ] ) . optional ( ) ,
505- displayMode : z . enum ( [ "inline" , "fullscreen" , "pip" ] ) . optional ( ) ,
526+ theme : McpUiThemeSchema . optional ( ) ,
527+ displayMode : McpUiDisplayModeSchema . optional ( ) ,
506528 availableDisplayModes : z . array ( z . string ( ) ) . optional ( ) ,
507529 viewport : z
508530 . object ( {
0 commit comments