Skip to content
Focsd homeFocsd homeFocsd
Forms

Tool call

A disclosure for one tool call: its name and status, with its input and output as text.

  • Tag: focsd-tool-call
  • Pattern: Disclosure
  • Category: AI

Example

HTML
<focsd-tool-call id="tool-demo" name="search_docs" status="done"></focsd-tool-call>
<script type="module">
const tool = document.getElementById('tool-demo');
tool.input = { query: 'feed pattern', limit: 2 };
tool.output = { hits: 2 };
</script>

Usage

Import the module once, then use the tag like any HTML element. Every framework below renders the same element; see Frameworks for setup.

<script type="module">
import '@focsd-dev/ai';
</script>
<focsd-tool-call name="search_docs" status="done"></focsd-tool-call>

API

Attributes

AttributePropertyTypeDefault
namenamestring—
statusstatusToolStatusrunning
openopenbooleanfalse

Events

EventDescription
toggleFired when it opens or closes. Like <details>, it does not bubble.

CSS parts

Style the inside of the component with ::part(), for example focsd-tool-call::part(summary).

PartDescription
summaryThe button that opens and closes it.
statusThe status icon and word.
inputThe input (`pre`).
outputThe output (`pre`), when there is one.

Accessibility

  • A disclosure button named "search_docs, done": the status is a word as well as an icon (running, done or failed), never color alone.
  • Input and output are shown in pre blocks as text (JSON.stringify, never HTML), so they cannot inject markup. A block that scrolls is a region named "Input" or "Output" in the tab order; one that fits adds no tab stop.
  • It fires the toggle event when it opens or closes, like <details>, and does not bubble.
  • The running ring does not spin under reduced motion.

Keyboard

KeyAction
Enter / SpaceOpen or close the input and output