Skip to content
kitn AI/UI

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

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>
  • state drives the badge colour: input-streaming (blue) → input-available (amber) → output-available (green) / output-error (red).
  • open is a boolean attribute; set it to start the panel expanded.
  • The element renders nothing until tool is set and emits no events.

Amber badge — input sent, awaiting response.

Blue badge while the agent assembles arguments.

PropertyTypeDefaultNotes
theme'auto'Color mode (`auto` follows prefers-color-scheme).
toolThe tool-call to display. Set as a JS property.
openDrive/observe open state (Shoelace-style: settable + reflected to the `open` attribute; the element still self-manages on trigger click). Set `el.open = true`, or `<kai-tool open>`; listen for `kai-open-change`.
defaultOpenInitial open state on mount (uncontrolled seed).
disabledGate the disclosure trigger: programmatic `show()/hide()/toggle()` still work, but the trigger click no longer toggles.
MethodSignatureNotes
(): voidOpen it programmatically (no-op while disabled).
(): voidClose it programmatically.
(): voidFlip the open state (closes while disabled).

This element wraps these SolidJS components — reach for them directly when you need finer control than the props expose.

Tool