Register React renderers for assistant-ui tool calls, tool results, and model data parts.
API Reference
DataRenderers
DataRenderers propslength: 0toString: () => stringtoLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string; }pop: () => undefinedpush: (...items: never[]) => numberconcat: { (...items: ConcatArray<never>[]): never[]; (...items: ConcatArray<never>[]): never[]; }join: (separator?: string) => stringreverse: () => never[]shift: () => undefinedslice: (start?: number, end?: number) => never[]sort: (compareFn?: ((a: never, b: never) => number) | undefined) => []splice: { (start: number, deleteCount?: number): never[]; (start: number, deleteCount: number, ...items: never[]): never[]; }unshift: (...items: never[]) => numberindexOf: (searchElement: never, fromIndex?: number) => numberlastIndexOf: (searchElement: never, fromIndex?: number) => numberevery: { <S>(predicate: (value: never, index: number, array: never[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: never, index: number, array: never[]) => unknown, thisArg?: any): boolean; }some: (predicate: (value: never, index: number, array: never[]) => unknown, thisArg?: any) => booleanforEach: (callbackfn: (value: never, index: number, array: never[]) => void, thisArg?: any) => voidmap: <U>(callbackfn: (value: never, index: number, array: never[]) => U, thisArg?: any) => U[]filter: { <S>(predicate: (value: never, index: number, array: never[]) => value is S, thisArg?: any): S[]; (predicate: (value: never, index: number, array: never[]) => unknown, thisArg?: any): never[]; }reduce: { (callbackfn: (previousValue: never, currentValue: never, currentIndex: number, array: never[]) => never): never; (callbackfn: (previousValue: never, currentValue: never, currentIndex: number, array: never[]) => never, initialValue: never): never; <U>(callbackfn: (previousValue: U, currentValue: never, currentIndex: number, array: never[]) => U, initialValue: U): U; }reduceRight: { (callbackfn: (previousValue: never, currentValue: never, currentIndex: number, array: never[]) => never): never; (callbackfn: (previousValue: never, currentValue: never, currentIndex: number, array: never[]) => never, initialValue: never): never; <U>(callbackfn: (previousValue: U, currentValue: never, currentIndex: number, array: never[]) => U, initialValue: U): U; }find: { <S>(predicate: (value: never, index: number, obj: never[]) => value is S, thisArg?: any): S | undefined; (predicate: (value: never, index: number, obj: never[]) => unknown, thisArg?: any): undefined; }findIndex: (predicate: (value: never, index: number, obj: never[]) => unknown, thisArg?: any) => numberfill: (value: never, start?: number, end?: number) => []copyWithin: (target: number, start: number, end?: number) => []entries: () => ArrayIterator<[number, never]>keys: () => ArrayIterator<number>values: () => ArrayIterator<never>includes: (searchElement: never, fromIndex?: number) => booleanflatMap: <U, This>(callback: (this: This, value: never, index: number, array: never[]) => U | readonly U[], thisArg?: This | undefined) => U[]flat: <A, D>(this: A, depth?: D | undefined) => FlatArray<A, D>[]at: (index: number) => undefinedfindLast: { <S>(predicate: (value: never, index: number, array: never[]) => value is S, thisArg?: any): S | undefined; (predicate: (value: never, index: number, array: never[]) => unknown, thisArg?: any): undefined; }findLastIndex: (predicate: (value: never, index: number, array: never[]) => unknown, thisArg?: any) => numbertoReversed: () => never[]toSorted: (compareFn?: ((a: never, b: never) => number) | undefined) => never[]toSpliced: { (start: number, deleteCount: number, ...items: never[]): never[]; (start: number, deleteCount?: number): never[]; }with: (index: number, value: never) => never[]
getMcpAppFromToolPart
Returns MCP app metadata for a tool-call part that points at a ui://
resource.
Returns undefined when the part has no MCP app metadata or the metadata
does not reference an assistant-ui MCP app resource.
getMcpAppFromToolPartpart: ToolPartLikemcp?: ToolCallMessagePartMcpMetadataMCP app metadata associated with this tool call, when present.
app?: McpAppMetadataresourceUri: stringmimeType?: stringvisibility?: readonly ("model" | "app")[]
makeAssistantDataUI
Creates a React component that registers a named data-part renderer when rendered.
type AssistantDataUIProps = {
/** Data part name this renderer handles. */
name: string;
/** Component rendered for matching data message parts. */
render: DataMessagePartComponent<T>;
};
const makeAssistantDataUI: <T = any>(dataUI: AssistantDataUIProps<T>) => AssistantDataUI;McpAppRenderer
McpAppRenderer props0: McpAppRendererOptionshost: ResourceElement<McpAppsHost>Provides the data-plane operations the widget can request (`loadResource`, `callTool`, `readResource`, `listResources`). Use `McpAppsRemoteHost({ url })` for the default HTTP-route convention.
hook: (...args: A) => Rargs: Readonly<A>key?: string | numberdeps?: readonly unknown[]
sandbox?: McpAppSandboxConfigSandbox + container styling. Passes through to SafeContentFrame.
sandbox?: SandboxOption[]useShadowDom?: booleanenableBrowserCaching?: booleansalt?: stringproduct?: stringclassName?: stringstyle?: CSSPropertiesunsafeDocumentWrite?: boolean
maxHeight?: numberUpper bound (in pixels) applied to the widget-driven auto-resize height. Defaults to 800.
hostInfo?: McpAppHostInfoIdentifies the host to the widget in the `ui/initialize` response.
name: stringversion: string
hostContext?: McpAppHostContextDelivered to the widget on initialize and pushed via `notifications/host_context/changed` on change.
theme?: "light" | "dark"displayMode?: McpAppDisplayModeavailableDisplayModes?: McpAppDisplayMode[]
fallback?: ReactNodeRendered when no MCP app is on the part, or while load is in flight / failed (unless overridden).
loadingFallback?: ReactNodeRendered while the resource is loading. Defaults to `fallback`.
errorFallback?: ReactNode | ((error: Error) => ReactNode)Rendered when the resource load rejects. Defaults to `fallback`.
length: 1toString: () => stringtoLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string; }pop: () => McpAppRendererOptionspush: (...items: McpAppRendererOptions[]) => numberconcat: { (...items: ConcatArray<McpAppRendererOptions>[]): McpAppRendererOptions[]; (...items: (McpAppRendererOptions | ConcatArray<McpAppRendererOptions>)[]): McpAppRendererOptions[]; }join: (separator?: string) => stringreverse: () => McpAppRendererOptions[]shift: () => McpAppRendererOptionsslice: (start?: number, end?: number) => McpAppRendererOptions[]sort: (compareFn?: ((a: McpAppRendererOptions, b: McpAppRendererOptions) => number) | undefined) => [options: McpAppRendererOptions]splice: { (start: number, deleteCount?: number): McpAppRendererOptions[]; (start: number, deleteCount: number, ...items: McpAppRendererOptions[]): McpAppRendererOptions[]; }unshift: (...items: McpAppRendererOptions[]) => numberindexOf: (searchElement: McpAppRendererOptions, fromIndex?: number) => numberlastIndexOf: (searchElement: McpAppRendererOptions, fromIndex?: number) => numberevery: { <S>(predicate: (value: McpAppRendererOptions, index: number, array: McpAppRendererOptions[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: McpAppRendererOptions, index: number, array: McpAppRendererOptions[]) => unknown, thisArg?: any): boolean; }some: (predicate: (value: McpAppRendererOptions, index: number, array: McpAppRendererOptions[]) => unknown, thisArg?: any) => booleanforEach: (callbackfn: (value: McpAppRendererOptions, index: number, array: McpAppRendererOptions[]) => void, thisArg?: any) => voidmap: <U>(callbackfn: (value: McpAppRendererOptions, index: number, array: McpAppRendererOptions[]) => U, thisArg?: any) => U[]filter: { <S>(predicate: (value: McpAppRendererOptions, index: number, array: McpAppRendererOptions[]) => value is S, thisArg?: any): S[]; (predicate: (value: McpAppRendererOptions, index: number, array: McpAppRendererOptions[]) => unknown, thisArg?: any): McpAppRendererOptions[]; }reduce: { (callbackfn: (previousValue: McpAppRendererOptions, currentValue: McpAppRendererOptions, currentIndex: number, array: McpAppRendererOptions[]) => McpAppRendererOptions): McpAppRendererOptions; (callbackfn: (previousValue: McpAppRendererOptions, currentValue: McpAppRendererOptions, currentIndex: number, array: McpAppRendererOptions[]) => McpAppRendererOptions, initialValue: McpAppRendererOptions): McpAppRendererOptions; <U>(callbackfn: (previousValue: U, currentValue: McpAppRendererOptions, currentIndex: number, array: McpAppRendererOptions[]) => U, initialValue: U): U; }reduceRight: { (callbackfn: (previousValue: McpAppRendererOptions, currentValue: McpAppRendererOptions, currentIndex: number, array: McpAppRendererOptions[]) => McpAppRendererOptions): McpAppRendererOptions; (callbackfn: (previousValue: McpAppRendererOptions, currentValue: McpAppRendererOptions, currentIndex: number, array: McpAppRendererOptions[]) => McpAppRendererOptions, initialValue: McpAppRendererOptions): McpAppRendererOptions; <U>(callbackfn: (previousValue: U, currentValue: McpAppRendererOptions, currentIndex: number, array: McpAppRendererOptions[]) => U, initialValue: U): U; }find: { <S>(predicate: (value: McpAppRendererOptions, index: number, obj: McpAppRendererOptions[]) => value is S, thisArg?: any): S | undefined; (predicate: (value: McpAppRendererOptions, index: number, obj: McpAppRendererOptions[]) => unknown, thisArg?: any): McpAppRendererOptions | undefined; }findIndex: (predicate: (value: McpAppRendererOptions, index: number, obj: McpAppRendererOptions[]) => unknown, thisArg?: any) => numberfill: (value: McpAppRendererOptions, start?: number, end?: number) => [options: McpAppRendererOptions]copyWithin: (target: number, start: number, end?: number) => [options: McpAppRendererOptions]entries: () => ArrayIterator<[number, McpAppRendererOptions]>keys: () => ArrayIterator<number>values: () => ArrayIterator<McpAppRendererOptions>includes: (searchElement: McpAppRendererOptions, fromIndex?: number) => booleanflatMap: <U, This>(callback: (this: This, value: McpAppRendererOptions, index: number, array: McpAppRendererOptions[]) => U | readonly U[], thisArg?: This | undefined) => U[]flat: <A, D>(this: A, depth?: D | undefined) => FlatArray<A, D>[]at: (index: number) => McpAppRendererOptionsfindLast: { <S>(predicate: (value: McpAppRendererOptions, index: number, array: McpAppRendererOptions[]) => value is S, thisArg?: any): S | undefined; (predicate: (value: McpAppRendererOptions, index: number, array: McpAppRendererOptions[]) => unknown, thisArg?: any): McpAppRendererOptions | undefined; }findLastIndex: (predicate: (value: McpAppRendererOptions, index: number, array: McpAppRendererOptions[]) => unknown, thisArg?: any) => numbertoReversed: () => McpAppRendererOptions[]toSorted: (compareFn?: ((a: McpAppRendererOptions, b: McpAppRendererOptions) => number) | undefined) => McpAppRendererOptions[]toSpliced: { (start: number, deleteCount: number, ...items: McpAppRendererOptions[]): McpAppRendererOptions[]; (start: number, deleteCount?: number): McpAppRendererOptions[]; }with: (index: number, value: McpAppRendererOptions) => McpAppRendererOptions[]
McpAppsRemoteHost
McpAppsRemoteHost props0: McpAppsRemoteHostOptionsurl: stringfetch?: typeof fetchheaders?: Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>)
length: 1toString: () => stringtoLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string; }pop: () => McpAppsRemoteHostOptionspush: (...items: McpAppsRemoteHostOptions[]) => numberconcat: { (...items: ConcatArray<McpAppsRemoteHostOptions>[]): McpAppsRemoteHostOptions[]; (...items: (McpAppsRemoteHostOptions | ConcatArray<McpAppsRemoteHostOptions>)[]): McpAppsRemoteHostOptions[]; }join: (separator?: string) => stringreverse: () => McpAppsRemoteHostOptions[]shift: () => McpAppsRemoteHostOptionsslice: (start?: number, end?: number) => McpAppsRemoteHostOptions[]sort: (compareFn?: ((a: McpAppsRemoteHostOptions, b: McpAppsRemoteHostOptions) => number) | undefined) => [options: McpAppsRemoteHostOptions]splice: { (start: number, deleteCount?: number): McpAppsRemoteHostOptions[]; (start: number, deleteCount: number, ...items: McpAppsRemoteHostOptions[]): McpAppsRemoteHostOptions[]; }unshift: (...items: McpAppsRemoteHostOptions[]) => numberindexOf: (searchElement: McpAppsRemoteHostOptions, fromIndex?: number) => numberlastIndexOf: (searchElement: McpAppsRemoteHostOptions, fromIndex?: number) => numberevery: { <S>(predicate: (value: McpAppsRemoteHostOptions, index: number, array: McpAppsRemoteHostOptions[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: McpAppsRemoteHostOptions, index: number, array: McpAppsRemoteHostOptions[]) => unknown, thisArg?: any): boolean; }some: (predicate: (value: McpAppsRemoteHostOptions, index: number, array: McpAppsRemoteHostOptions[]) => unknown, thisArg?: any) => booleanforEach: (callbackfn: (value: McpAppsRemoteHostOptions, index: number, array: McpAppsRemoteHostOptions[]) => void, thisArg?: any) => voidmap: <U>(callbackfn: (value: McpAppsRemoteHostOptions, index: number, array: McpAppsRemoteHostOptions[]) => U, thisArg?: any) => U[]filter: { <S>(predicate: (value: McpAppsRemoteHostOptions, index: number, array: McpAppsRemoteHostOptions[]) => value is S, thisArg?: any): S[]; (predicate: (value: McpAppsRemoteHostOptions, index: number, array: McpAppsRemoteHostOptions[]) => unknown, thisArg?: any): McpAppsRemoteHostOptions[]; }reduce: { (callbackfn: (previousValue: McpAppsRemoteHostOptions, currentValue: McpAppsRemoteHostOptions, currentIndex: number, array: McpAppsRemoteHostOptions[]) => McpAppsRemoteHostOptions): McpAppsRemoteHostOptions; (callbackfn: (previousValue: McpAppsRemoteHostOptions, currentValue: McpAppsRemoteHostOptions, currentIndex: number, array: McpAppsRemoteHostOptions[]) => McpAppsRemoteHostOptions, initialValue: McpAppsRemoteHostOptions): McpAppsRemoteHostOptions; <U>(callbackfn: (previousValue: U, currentValue: McpAppsRemoteHostOptions, currentIndex: number, array: McpAppsRemoteHostOptions[]) => U, initialValue: U): U; }reduceRight: { (callbackfn: (previousValue: McpAppsRemoteHostOptions, currentValue: McpAppsRemoteHostOptions, currentIndex: number, array: McpAppsRemoteHostOptions[]) => McpAppsRemoteHostOptions): McpAppsRemoteHostOptions; (callbackfn: (previousValue: McpAppsRemoteHostOptions, currentValue: McpAppsRemoteHostOptions, currentIndex: number, array: McpAppsRemoteHostOptions[]) => McpAppsRemoteHostOptions, initialValue: McpAppsRemoteHostOptions): McpAppsRemoteHostOptions; <U>(callbackfn: (previousValue: U, currentValue: McpAppsRemoteHostOptions, currentIndex: number, array: McpAppsRemoteHostOptions[]) => U, initialValue: U): U; }find: { <S>(predicate: (value: McpAppsRemoteHostOptions, index: number, obj: McpAppsRemoteHostOptions[]) => value is S, thisArg?: any): S | undefined; (predicate: (value: McpAppsRemoteHostOptions, index: number, obj: McpAppsRemoteHostOptions[]) => unknown, thisArg?: any): McpAppsRemoteHostOptions | undefined; }findIndex: (predicate: (value: McpAppsRemoteHostOptions, index: number, obj: McpAppsRemoteHostOptions[]) => unknown, thisArg?: any) => numberfill: (value: McpAppsRemoteHostOptions, start?: number, end?: number) => [options: McpAppsRemoteHostOptions]copyWithin: (target: number, start: number, end?: number) => [options: McpAppsRemoteHostOptions]entries: () => ArrayIterator<[number, McpAppsRemoteHostOptions]>keys: () => ArrayIterator<number>values: () => ArrayIterator<McpAppsRemoteHostOptions>includes: (searchElement: McpAppsRemoteHostOptions, fromIndex?: number) => booleanflatMap: <U, This>(callback: (this: This, value: McpAppsRemoteHostOptions, index: number, array: McpAppsRemoteHostOptions[]) => U | readonly U[], thisArg?: This | undefined) => U[]flat: <A, D>(this: A, depth?: D | undefined) => FlatArray<A, D>[]at: (index: number) => McpAppsRemoteHostOptionsfindLast: { <S>(predicate: (value: McpAppsRemoteHostOptions, index: number, array: McpAppsRemoteHostOptions[]) => value is S, thisArg?: any): S | undefined; (predicate: (value: McpAppsRemoteHostOptions, index: number, array: McpAppsRemoteHostOptions[]) => unknown, thisArg?: any): McpAppsRemoteHostOptions | undefined; }findLastIndex: (predicate: (value: McpAppsRemoteHostOptions, index: number, array: McpAppsRemoteHostOptions[]) => unknown, thisArg?: any) => numbertoReversed: () => McpAppsRemoteHostOptions[]toSorted: (compareFn?: ((a: McpAppsRemoteHostOptions, b: McpAppsRemoteHostOptions) => number) | undefined) => McpAppsRemoteHostOptions[]toSpliced: { (start: number, deleteCount: number, ...items: McpAppsRemoteHostOptions[]): McpAppsRemoteHostOptions[]; (start: number, deleteCount?: number): McpAppsRemoteHostOptions[]; }with: (index: number, value: McpAppsRemoteHostOptions) => McpAppsRemoteHostOptions[]
useAssistantDataUI
Registers a renderer for named data message parts while the component is
mounted.
useAssistantDataUIdataUI: AssistantDataUIProps<any> | nullname: stringData part name this renderer handles.
render: DataMessagePartComponent<T>Component rendered for matching data message parts.
makeAssistantToolUI
Deprecated. Put render/renderText on the matching toolkit entry, or use
MessagePrimitive.Parts inline tool render overrides for per-message UI.
See https://assistant-ui.com/docs/migrations/toolkit-tools.
Creates a React component that registers a tool-call renderer when rendered.
Use this to package reusable display components for tools whose definitions are registered elsewhere.
type AssistantToolUIProps = {
/** Name of the tool whose calls should use this renderer. */
toolName: string;
/** Component rendered for matching tool-call message parts. */
render: ToolCallMessagePartComponent<TArgs, TResult>;
/**
* How the UI is presented relative to the chain-of-thought trace. Set
* `"standalone"` to surface it on its own (e.g. human-in-the-loop or
* generative UI for a backend/MCP tool). Defaults to `"inline"`.
*/
display?: "standalone" | "inline";
};
const makeAssistantToolUI: <TArgs, TResult>(tool: AssistantToolUIProps<TArgs, TResult>) => AssistantToolUI;useAssistantToolUI
Deprecated. Put render/renderText on the matching toolkit entry, or use
MessagePrimitive.Parts inline tool render overrides for per-message UI.
See https://assistant-ui.com/docs/migrations/toolkit-tools.
Registers a tool-call renderer while the component is mounted.
This only affects rendering. Pair it with Tools or a backend tool registry to expose the actual tool definition to the model.
useAssistantToolUItool: AssistantToolUIProps<any, any> | nulltoolName: stringName of the tool whose calls should use this renderer.
render: ToolCallMessagePartComponent<TArgs, TResult>Component rendered for matching tool-call message parts.
display?: "standalone" | "inline"How the UI is presented relative to the chain-of-thought trace. Set `"standalone"` to surface it on its own (e.g. human-in-the-loop or generative UI for a backend/MCP tool). Defaults to `"inline"`.