# App, assistant tool call

- **[Sections](/blocks/)**
- **[Application](/blocks/app/)**
- **App, assistant tool call**

One tool call in an assistant thread: name, one-line summary and status, with the arguments and result in a disclosure. Four states; duration is text you supply.

## Import

- **CLI**

  ```
  npx shadcn add @klarhimmel/app-assistant-tool-call
  ```
- **Import**

  ```
  import Block from '@/components/klarhimmel/blocks/app-assistant-tool-call';
  ```

Also called

- app/assistant-tool-call

- **Category**: Interface sections for signed-in products. New project? Set it up once: /get-started/installation.

## Notes

- **When to use it**: One line in an assistant thread saying which tool ran, with its arguments and result tucked into a disclosure. For something a person must allow first, use `app-assistant-approval`; this block only reports.
- **Writing for it**: - Use `name` (60 characters) for the tool as the person would know it, and `summary` (120) for what it did in one sentence. The summary is what stays visible when the card is closed.
- `args`, `result` and `error` each hold up to 20000 characters of plain text and keep their line breaks, so paste formatted JSON rather than a single long line.
- `duration` is free text you supply, such as 1.2 s. It only shows once the call has finished, so leave it out for pending and running.
- **Watch out for**: Which section opens depends on `state`: the result part exists only for succeeded and the error part only for failed. An empty `args` or `result` is replaced by the muted `labels.empty` text rather than hiding, so set that label to something that reads naturally.

## Pairs well with

- **[App, assistant thread](/blocks/app/assistant-thread)**
- **[App, assistant approval](/blocks/app/assistant-approval)**
- **[App, assistant composer](/blocks/app/assistant-composer)**

## Usage

The block in a page, with its default content (long lists shortened). Every prop is in the table below.

section.tsx

```
import { Theme } from '@/components/klarhimmel/theme/style';
import { BlockSurface } from '@/components/klarhimmel/blocks/surface';
import AppAssistantToolCall from '@/components/klarhimmel/blocks/app-assistant-tool-call';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <AppAssistantToolCall props={{
          "state": "succeeded",
          "open": true,
          "name": "tool.name_the_call",
          "summary": "Say in one line what the call asked for",
          "args": "{\n  \"first\": \"Name a setting\",\n  \"second\": \"Name a value\",\n  \"third\": \"Name an option\"\n}",
          "result": "{\n  \"first\": \"Name a count\",\n  \"second\": \"Name a total\",\n  \"third\": { \"key\": \"Name a part\", \"share\": 0.0 }\n}",
          "error": "{\n  \"status\": 000,\n  \"code\": \"name_the_error\",\n  \"message\": \"Say what went wrong and what to do.\"\n}",
          "duration": "0.0 s",
          "labels": {
            "pending": "Waiting",
            "running": "Running",
            "succeeded": "Done",
            "failed": "Failed",
            "args": "Arguments",
            "result": "Result",
            "error": "Error",
            "empty": "Nothing to show"
          }
        }} />
      </BlockSurface>
    </Theme>
  );
}
```

## Props

The type, default and text limit of every prop. On a real page, over-limit text is kept and checkSections flags it (Installation, Check a page before you ship); this live preview shows the default until it fits. The panel above edits all props.

- **state**: One of 'pending', 'running', 'succeeded', 'failed'.
- **open**: See the type.
- **name**: Text, up to 60 characters.
- **summary**: Text, up to 120 characters.
- **args**: Text, up to 20000 characters.
- **result**: Text, up to 20000 characters.
- **error**: Text, up to 20000 characters.
- **duration**: Text, up to 20 characters. Optional; empty is not rendered.
- **labels**: Fields: pending, running, succeeded, failed, args, result, error, empty.

[Previous](/blocks/app/assistant-thread)

[Next](/blocks/app/auth-code)
