Register assistant tools from mounted React components, scoped to the lifetime of part of the UI tree.
Warning
makeAssistantTool and useAssistantTool are deprecated compatibility
APIs, documented here for reference only. New code should define a toolkit —
see Defining Tools and Migrating Tools to
Toolkits.
API Reference
makeAssistantTool
Warning
Deprecated. Use a toolkit with Tools({ toolkit }) and register it via
AuiConfig({ tools: Tools({ toolkit }) }) on the provider's config prop instead. See
https://assistant-ui.com/docs/migrations/toolkit-tools.
Creates a React component that registers an assistant tool when rendered.
Use this when exporting reusable tool modules that can be included in JSX rather than calling useAssistantTool directly.
type AssistantToolProps = CoreAssistantToolProps<TArgs, TResult> & {
/** Component used to render calls to this tool in assistant messages. */
render?: ToolCallMessagePartComponent<TArgs, TResult> | undefined;
/** Lightweight text rendered while a tool call is running or complete. */
renderText?: ToolCallText<TArgs, TResult> | undefined;
};
const makeAssistantTool: <TArgs extends Record<string, unknown>, TResult>(tool: AssistantToolProps<TArgs, TResult>) => AssistantTool;useAssistantTool
Warning
Deprecated. Use a toolkit with Tools({ toolkit }) and register it via
AuiConfig({ tools: Tools({ toolkit }) }) on the provider's config prop instead. See
https://assistant-ui.com/docs/migrations/toolkit-tools.
Registers a tool with the assistant model context while the component is mounted.
If render is provided, it is also installed as the renderer for matching
tool-call message parts. The registration is removed automatically when the
component unmounts or the tool definition changes.
Pass a referentially stable tool object, such as one declared at module
scope or memoized with useMemo, to avoid re-registering on every render.
const weatherTool = {
toolName: "get_weather",
type: "frontend",
description: "Get the weather for a city.",
parameters: weatherSchema,
execute: async ({ city }: { city: string }) => fetchWeather(city),
render: WeatherToolUI,
} satisfies AssistantToolProps<{ city: string }, Weather>;
function WeatherToolRegistration() {
useAssistantTool(weatherTool);
return null;
}- toolAssistantToolProps<TArgs, TResult>
- AssistantToolProps
- streamCall?ToolStreamCallFunction<TArgs, TResult>deprecated
Deprecated: Experimental, API may change.
- display?ToolDisplay
How this tool's UI is presented relative to the chain-of-thought trace. Defaults to `"inline"` (folded into the chain-of-thought grouping). Set `"standalone"` to surface the tool call on its own. `human` tools are always `"standalone"` and cannot opt out.
- unstable_backendDefault?AssistantToolProps["unstable_backendDefault"]unstable
- AssistantToolProps["unstable_backendDefault"]
- parameters?boolean
- overwrite?boolean
Replaces an already-registered same-priority tool with the same name instead of throwing. Discouraged escape hatch — overwriting a same-priority tool is usually a design smell; prefer distinct names or priorities.
- type?"mcp"
Tools loaded from an MCP server by a server adapter.
- description?undefined
Natural-language description shown to the model when selecting tools.
- parameters?undefined
Schema for the arguments the model must provide when calling the tool.
- disabled?boolean
Prevents the tool from being exposed to the model while true.
- execute?undefined
Executes the tool after the model provides valid arguments.
- toModelOutput?undefined
Converts the execution result into model-visible output.
- experimental_onSchemaValidationError?undefined
Handles invalid tool arguments when schema validation fails.
- providerOptions?undefined
- toolNamestring
- render?unknown
Component used to render calls to this tool in assistant messages.
- renderText?ToolCallText<TArgs, TResult> | undefined
Lightweight text rendered while a tool call is running or complete.
AssistantToolProps["renderText"]- running?ToolCallRunningText<TArgs, TValue>
- complete?ToolCallCompleteText<TArgs, TResult, TValue> | undefined