ToolPart API
API reference docs for the React ToolPart component. Learn about the props, CSS, and other APIs of this exported module.
Demos
Import
import { ToolPart } from '@mui/x-chat-headless/message';
// or
import { ToolPart } from '@mui/x-chat-headless';
// or
import { ToolPart } from '@mui/x-chat';Learn about the difference by reading this guide on minimizing bundle size.
| Name | Type | Description |
|---|---|---|
| index* | number | |
| message* | {} | |
| part* | { toolInvocation: { approval?: { approved: bool, reason?: string }, callProviderMetadata?: Record | 'approval-responded' | 'input-available' | 'input-streaming' | 'output-available' | 'output-denied' | 'output-error', title?: string, toolCallId: string, toolName: string }, type: 'dynamic-tool' } | { toolInvocation: { approval?: { approved: bool, reason?: string }, callProviderMetadata?: Record | 'approval-responded' | 'input-available' | 'input-streaming' | 'output-available' | 'output-denied' | 'output-error', title?: string, toolCallId: string, toolName: string }, type: 'tool' } | |
| onToolCall | func | Signature: function(payload: ChatOnToolCallPayload) => void | Promise<void> |
| slotProps | ToolPartSlotProps | |
| slots | Partial | See Slots API below for more details. |
| toolSlotProps | Record | Per-tool-name slotProps overrides, merged on top of |
| toolSlots | Record | Per-tool-name slot overrides, merged on top of |
The component cannot hold a ref.
| Slot name | Class name | Default component | Description |
|---|---|---|---|
| actions | |||
| approveButton | |||
| denyButton | |||
| error | |||
| header | |||
| icon | |||
| root | |||
| section | |||
| sectionContent | |||
| state | |||
| title |
Source code
If you did not find the information in this page, consider having a look at the implementation of the component for more detail.