Skip to content
kitn AI/UI

Tool

kai-tool

Takes its badge colour from the call’s state, so a running call reads at a glance.

  • 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/web-components';
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).
tool—The tool-call to display. Set as a JS property.
open—Drive/observe the open state: `el.open = true` or the bare `open` attribute. Listen for `kai-open-change`.
defaultOpen—Initial open state on mount (uncontrolled seed).
disabled—Gate 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