@@ -548,3 +548,38 @@ export interface McpUiToolMeta {
548548 */
549549 visibility ?: McpUiToolVisibility [ ] ;
550550}
551+
552+ /**
553+ * Method string constants for MCP UI protocol messages.
554+ *
555+ * These constants provide a type-safe way to check message methods without
556+ * accessing internal Zod schema properties. External libraries should use
557+ * these constants instead of accessing `schema.shape.method._def.values[0]`.
558+ *
559+ * @example
560+ * ```typescript
561+ * import { MCP_UI_SANDBOX_PROXY_READY_METHOD } from '@modelcontextprotocol/ext-apps';
562+ *
563+ * if (event.data.method === MCP_UI_SANDBOX_PROXY_READY_METHOD) {
564+ * // Handle sandbox proxy ready notification
565+ * }
566+ * ```
567+ */
568+ export const MCP_UI_OPEN_LINK_METHOD = "ui/open-link" ;
569+ export const MCP_UI_MESSAGE_METHOD = "ui/message" ;
570+ export const MCP_UI_SANDBOX_PROXY_READY_METHOD =
571+ "ui/notifications/sandbox-proxy-ready" ;
572+ export const MCP_UI_SANDBOX_RESOURCE_READY_METHOD =
573+ "ui/notifications/sandbox-resource-ready" ;
574+ export const MCP_UI_SIZE_CHANGED_METHOD = "ui/notifications/size-changed" ;
575+ export const MCP_UI_TOOL_INPUT_METHOD = "ui/notifications/tool-input" ;
576+ export const MCP_UI_TOOL_INPUT_PARTIAL_METHOD =
577+ "ui/notifications/tool-input-partial" ;
578+ export const MCP_UI_TOOL_RESULT_METHOD = "ui/notifications/tool-result" ;
579+ export const MCP_UI_TOOL_CANCELLED_METHOD = "ui/notifications/tool-cancelled" ;
580+ export const MCP_UI_HOST_CONTEXT_CHANGED_METHOD =
581+ "ui/notifications/host-context-changed" ;
582+ export const MCP_UI_RESOURCE_TEARDOWN_METHOD = "ui/resource-teardown" ;
583+ export const MCP_UI_INITIALIZE_METHOD = "ui/initialize" ;
584+ export const MCP_UI_INITIALIZED_METHOD = "ui/notifications/initialized" ;
585+ export const MCP_UI_REQUEST_DISPLAY_MODE_METHOD = "ui/request-display-mode" ;
0 commit comments