Tool
kai-tool
A collapsible panel for a single agent tool call — colour-coded state badge, expandable input/output inspector. Drop one after each tool invocation to give users transparency into what the agent did.
- Shadow DOM
- 4 states
- Collapsible inspector
- Colour-coded badge
- Property-driven API
Preview
Section titled “Preview”Set the call via the tool property — it’s an object, so assign it in JavaScript.
<kai-tool id="tool" open></kai-tool>
<script type="module"> import '@kitn.ai/ui/elements';
document.getElementById('tool').tool = { type: 'database_query', state: 'output-available', input: { table: 'users', limit: 10 }, output: { rows: 10, ms: 42 }, };</script>statedrives the badge colour:input-streaming(blue) →input-available(amber) →output-available(green) /output-error(red).openis a boolean attribute; set it to start the panel expanded.- The element renders nothing until
toolis set and emits no events.
Examples
Section titled “Examples”Completed Call
Section titled “Completed Call”Running Call
Section titled “Running Call”Amber badge — input sent, awaiting response.
Error State
Section titled “Error State”Input Streaming
Section titled “Input Streaming”Blue badge while the agent assembles arguments.
| Property | Type | Default | Notes |
|---|---|---|---|
| tool | ToolPart | — | The tool-call to display. Set as a JS property. |
| open | boolean | false | Start expanded. |
Composed from
Section titled “Composed from”This element wraps these SolidJS components — reach for them directly when you need finer control than the props expose.
Tool