Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,28 @@ type VerifySchemaMatches<TSchema extends z.ZodTypeAny, TInterface> =
*/
export const LATEST_PROTOCOL_VERSION = "2025-11-21";

/**
* Color theme preference for the host environment.
* @see {@link McpUiHostContext.theme}
*/
export type McpUiTheme = "light" | "dark";

/** Runtime validation schema for {@link McpUiTheme}. */
export const McpUiThemeSchema = z.enum(["light", "dark"]);

/**
* Display mode for UI presentation.
* - `inline`: Embedded within the conversation flow
* - `fullscreen`: Expanded to fill the available viewport
* - `pip`: Picture-in-picture floating window
*
* @see {@link McpUiHostContext.displayMode}
*/
export type McpUiDisplayMode = "inline" | "fullscreen" | "pip";

/** Runtime validation schema for {@link McpUiDisplayMode}. */
export const McpUiDisplayModeSchema = z.enum(["inline", "fullscreen", "pip"]);

/**
* Request to open an external URL in the host's default browser.
*
Expand Down Expand Up @@ -425,12 +447,12 @@ export interface McpUiHostContext {
* Current color theme preference.
* @example "dark"
*/
theme?: "light" | "dark";
theme?: McpUiTheme;
/**
* How the UI is currently displayed.
* @example "inline"
*/
displayMode?: "inline" | "fullscreen" | "pip";
displayMode?: McpUiDisplayMode;
/**
* Display modes the host supports.
* Apps can use this to offer mode-switching UI if applicable.
Expand Down Expand Up @@ -501,8 +523,8 @@ export const McpUiHostContextSchema: z.ZodType<McpUiHostContext> = z.object({
tool: ToolSchema,
})
.optional(),
theme: z.enum(["light", "dark"]).optional(),
displayMode: z.enum(["inline", "fullscreen", "pip"]).optional(),
theme: McpUiThemeSchema.optional(),
displayMode: McpUiDisplayModeSchema.optional(),
availableDisplayModes: z.array(z.string()).optional(),
viewport: z
.object({
Expand Down
Loading