mcp-use TypeScript API
    Preparing search index...

    Interface ViewRendererProps

    Props accepted by ViewRenderer.

    interface ViewRendererProps {
        cancelled?: boolean;
        chromeless?: boolean;
        className?: string;
        cspMode?: ViewCspMode;
        customProps?: Record<string, string>;
        displayMode?: ViewDisplayMode;
        fullscreenHeader?: { iconUrl?: string | null; title: string };
        hostCapabilities?: Partial<McpUiHostCapabilities>;
        hostContext?: McpUiHostContext;
        hostInfo?: { name: string; version: string };
        inlineMaxWidth?: number;
        invoked?: string;
        invoking?: string;
        messageCapabilities?: McpUiSupportedContentBlockModalities;
        mockOpenAiFileApis?: boolean;
        modelContextCapabilities?: McpUiSupportedContentBlockModalities;
        onAppToolsChanged?: (connection: ViewAppToolConnection | null) => void;
        onCspViolation?: (violation: ViewCspViolation) => void;
        onDisplayModeChange?: (mode: ViewDisplayMode) => void;
        onDownloadFile?: (params: {}) => Promise<McpUiDownloadFileResult>;
        onError?: (message: string) => void;
        onInlineHeightChange?: (height: number) => void;
        onLifecycleChange?: (event: ViewLifecycleEvent) => void;
        onLog?: (entry: { data: unknown; level: string }) => void;
        onMessage?: (content: unknown[]) => void | Promise<void>;
        onModelContextUpdate?: (
            ctx: { content?: unknown; structuredContent?: unknown },
        ) => void | Promise<void>;
        onReady?: () => void;
        onResourceResolved?: (resolved: ResolvedViewResource) => void;
        onSamplingRequest?: (
            params: {},
        ) => Promise<{ [key: string]: unknown } | { [key: string]: unknown }>;
        partialToolInput?: Record<string, unknown>;
        renderFullscreenClose?: (
            props: {
                "aria-label": string;
                "data-testid": string;
                onClick: () => void;
            },
        ) => ReactNode;
        sandboxUrl?: URL
        | ((resolved: ResolvedViewResource) => URL);
        source: ViewRendererSource;
        testId?: string;
        toolCallTimeout?: number;
        toolInput?: Record<string, unknown>;
        toolName?: string;
        toolOutput?: unknown;
        viewId: string;
        wrapTransport?: (transport: Transport, viewId: string) => Transport;
    }
    Index
    cancelled?: boolean

    Whether the associated tool call was cancelled.

    chromeless?: boolean

    Whether to hide the built-in view chrome.

    className?: string

    Additional class name applied to the view container.

    cspMode?: ViewCspMode

    CSP enforcement mode. Defaults to "permissive".

    customProps?: Record<string, string>

    String-valued custom properties forwarded to the app.

    displayMode?: ViewDisplayMode

    Initial display mode. Defaults to "inline".

    fullscreenHeader?: { iconUrl?: string | null; title: string }

    Inspector-only chrome shown above the iframe in fullscreen display mode.

    Type Declaration

    • OptionaliconUrl?: string | null

      Optional header icon URL.

    • title: string

      Header title.

    hostCapabilities?: Partial<McpUiHostCapabilities>

    Explicit host capability overrides.

    hostContext?: McpUiHostContext

    Initial host context sent to the app.

    hostInfo?: { name: string; version: string }

    Host identity advertised to the app.

    Type Declaration

    • name: string

      Stable host name.

    • version: string

      Host version.

    inlineMaxWidth?: number

    Maximum inline view width in pixels.

    invoked?: string

    Status text shown after the associated tool completes.

    invoking?: string

    Status text shown while the associated tool is running.

    messageCapabilities?: McpUiSupportedContentBlockModalities

    Content modalities accepted by the host's message handler.

    mockOpenAiFileApis?: boolean

    Dev mock of ChatGPT file APIs for local hosts (inspector). Default false.

    modelContextCapabilities?: McpUiSupportedContentBlockModalities

    Content modalities accepted by the model-context handler.

    onAppToolsChanged?: (connection: ViewAppToolConnection | null) => void

    Receives the current app-visible tool connection.

    onCspViolation?: (violation: ViewCspViolation) => void

    Called when the browser reports a CSP violation.

    onDisplayModeChange?: (mode: ViewDisplayMode) => void

    Called when the app requests a supported display mode.

    onDownloadFile?: (params: {}) => Promise<McpUiDownloadFileResult>

    Handles file-download requests from the app.

    onError?: (message: string) => void

    Called when view initialization or runtime handling fails.

    onInlineHeightChange?: (height: number) => void

    Fired when the guest reports inline height via ui/notifications/size-changed.

    onLifecycleChange?: (event: ViewLifecycleEvent) => void

    Called for each view lifecycle transition.

    onLog?: (entry: { data: unknown; level: string }) => void

    Handles structured log entries from the app.

    onMessage?: (content: unknown[]) => void | Promise<void>

    Handles content the app sends to the conversation.

    onModelContextUpdate?: (
        ctx: { content?: unknown; structuredContent?: unknown },
    ) => void | Promise<void>

    Handles model-context updates from the app.

    onReady?: () => void

    Called when the app signals that it is ready.

    onResourceResolved?: (resolved: ResolvedViewResource) => void

    Called after a live or preloaded resource is normalized.

    onSamplingRequest?: (
        params: {},
    ) => Promise<{ [key: string]: unknown } | { [key: string]: unknown }>

    Handles sampling requests from the app.

    partialToolInput?: Record<string, unknown>

    Partial streaming tool input forwarded to the app.

    renderFullscreenClose?: (
        props: {
            "aria-label": string;
            "data-testid": string;
            onClick: () => void;
        },
    ) => ReactNode

    Optional host close control for fullscreen (e.g. shared Button + icon).

    sandboxUrl?: URL | ((resolved: ResolvedViewResource) => URL)

    Sandbox page URL or function that derives one from the resolved resource.

    Live resource or preloaded HTML to render.

    testId?: string

    Test identifier applied to the view container.

    toolCallTimeout?: number

    Timeout in milliseconds for app-initiated tool calls. Defaults to 600000.

    toolInput?: Record<string, unknown>

    Complete tool input forwarded to the app.

    toolName?: string

    Tool associated with the view.

    toolOutput?: unknown

    Tool result forwarded to the app.

    viewId: string

    Stable identifier for the view instance.

    wrapTransport?: (transport: Transport, viewId: string) => Transport

    Wraps the host transport before it is connected to the app bridge.