React component for rendering AI tool invocations with state management.
npm install @slate71/tool-invocationimport { ToolInvocation } from '@slate71/tool-invocation'
import '@slate71/tool-invocation/styles.css'
function App() {
const invocation = {
id: '1',
name: 'fetchData',
status: 'running',
parameters: { url: 'https://api.example.com' },
startTime: Date.now()
}
return (
<ToolInvocation
invocation={invocation}
onRetry={(id) => console.log('Retry', id)}
onCancel={(id) => console.log('Cancel', id)}
/>
)
}invocation: Tool invocation object with status, parameters, and resultsclassName: Optional CSS class nameshowElapsedTime: Show elapsed time for running/completed tasks (default: true)onRetry: Callback for retry button (shown on error)onCancel: Callback for cancel button (shown when running)
MIT