Skip to contentSkip to content

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.

Props

NameTypeDescription
index*number
message*{}
part*{ toolInvocation: { approval?: { approved: bool, reason?: string }, callProviderMetadata?: Record, errorText?: string, input?: any, output?: any, preliminary?: bool, providerExecuted?: bool, state: 'approval-requested'
| '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, errorText?: string, input?: any, output?: any, preliminary?: bool, providerExecuted?: bool, state: 'approval-requested'
| 'approval-responded'
| 'input-available'
| 'input-streaming'
| 'output-available'
| 'output-denied'
| 'output-error', title?: string, toolCallId: string, toolName: string }, type: 'tool' }
onToolCallfunc
Signature:function(payload: ChatOnToolCallPayload) => void | Promise<void>
    slotPropsToolPartSlotProps
    slotsPartial

    See Slots API below for more details.

    toolSlotPropsRecord

    Per-tool-name slotProps overrides, merged on top of slotProps. Keyed by toolInvocation.toolName.

    toolSlotsRecord>

    Per-tool-name slot overrides, merged on top of slots. Keyed by toolInvocation.toolName.

    The component cannot hold a ref.

    Slots

    Slot nameClass nameDefault componentDescription
    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.