Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
35 changes: 35 additions & 0 deletions src/spec.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -548,3 +548,38 @@ export interface McpUiToolMeta {
*/
visibility?: McpUiToolVisibility[];
}

/**
* Method string constants for MCP UI protocol messages.
*
* These constants provide a type-safe way to check message methods without
* accessing internal Zod schema properties. External libraries should use
* these constants instead of accessing `schema.shape.method._def.values[0]`.
*
* @example
* ```typescript
* import { MCP_UI_SANDBOX_PROXY_READY_METHOD } from '@modelcontextprotocol/ext-apps';
*
* if (event.data.method === MCP_UI_SANDBOX_PROXY_READY_METHOD) {
* // Handle sandbox proxy ready notification
* }
* ```
*/
export const MCP_UI_OPEN_LINK_METHOD = "ui/open-link";
export const MCP_UI_MESSAGE_METHOD = "ui/message";
export const MCP_UI_SANDBOX_PROXY_READY_METHOD =
"ui/notifications/sandbox-proxy-ready";
export const MCP_UI_SANDBOX_RESOURCE_READY_METHOD =
"ui/notifications/sandbox-resource-ready";
export const MCP_UI_SIZE_CHANGED_METHOD = "ui/notifications/size-changed";
export const MCP_UI_TOOL_INPUT_METHOD = "ui/notifications/tool-input";
export const MCP_UI_TOOL_INPUT_PARTIAL_METHOD =
"ui/notifications/tool-input-partial";
export const MCP_UI_TOOL_RESULT_METHOD = "ui/notifications/tool-result";
export const MCP_UI_TOOL_CANCELLED_METHOD = "ui/notifications/tool-cancelled";
export const MCP_UI_HOST_CONTEXT_CHANGED_METHOD =
"ui/notifications/host-context-changed";
export const MCP_UI_RESOURCE_TEARDOWN_METHOD = "ui/resource-teardown";
export const MCP_UI_INITIALIZE_METHOD = "ui/initialize";
export const MCP_UI_INITIALIZED_METHOD = "ui/notifications/initialized";
export const MCP_UI_REQUEST_DISPLAY_MODE_METHOD = "ui/request-display-mode";
14 changes: 14 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@
// Re-export all types from spec.types.ts
export {
LATEST_PROTOCOL_VERSION,
MCP_UI_OPEN_LINK_METHOD,
MCP_UI_MESSAGE_METHOD,
MCP_UI_SANDBOX_PROXY_READY_METHOD,
MCP_UI_SANDBOX_RESOURCE_READY_METHOD,
MCP_UI_SIZE_CHANGED_METHOD,
MCP_UI_TOOL_INPUT_METHOD,
MCP_UI_TOOL_INPUT_PARTIAL_METHOD,
MCP_UI_TOOL_RESULT_METHOD,
MCP_UI_TOOL_CANCELLED_METHOD,
MCP_UI_HOST_CONTEXT_CHANGED_METHOD,
MCP_UI_RESOURCE_TEARDOWN_METHOD,
MCP_UI_INITIALIZE_METHOD,
MCP_UI_INITIALIZED_METHOD,
MCP_UI_REQUEST_DISPLAY_MODE_METHOD,
type McpUiTheme,
type McpUiDisplayMode,
type McpUiStyleVariableKey,
Expand Down
Loading