---
## ToolCallCard
Collapsible card that renders one agent tool-call part (`type: 'tool-call'`)
— a status indicator + monospaced tool name in the header, and the JSON input/output (or an
error message) in the expandable body. It is the default renderer ChatMessage reaches for on
`tool-call` parts (wire it in via `partRenderers`). Opens itself when a call fails so the error
is visible without a click; a manual toggle always wins afterwards. Pass a `children` snippet to
replace the default JSON body with a domain-specific view of the same part.
**Import:** `import { ToolCallCard } from '@urbicon-ui/blocks';`
### Examples
```svelte
```
```svelte
{#snippet children(call)}
{/snippet}
```
### Api
| Prop | Type | Required | Default | Description |
| --- | --- | :---: | --- | --- |
| toolCall | `ChatToolCallPart` | yes | | The tool-call part to render. Required. |
| ...HTMLAttributes | `HTMLAttributes` | no | | HTML attributes (excluding: 'class' | 'children') |
| children | `Snippet<[ChatToolCallPart]>` | no | | Replace the default JSON input/output body with a custom rendering of the tool-call part. Receives the same `toolCall`. When provided, the built-in error line + input/output sections are not rendered. |
| class | `string` | no | | Extra classes merged onto the root card element. |
| completeLabel | `string` | no | 'Done' | Header badge label for the `complete` state. |
| defaultOpen | `boolean` | no | | Initial expanded state for uncontrolled usage. Defaults to `true` when the call is already in the `error` state, `false` otherwise. |
| errorLabel | `string` | no | 'Failed' | Header badge label for the `error` state. |
| inputLabel | `string` | no | 'Input' | Heading above the input code block. |
| onOpenChange | `(open: boolean) => void` | no | | Fired once per toggle, after the new open state is applied. |
| open | `boolean` | no | | Whether the card is expanded. Supports `bind:open`. Left uncontrolled, the card starts collapsed for `pending` / `running` / `complete` and expanded for `error`. |
| outputLabel | `string` | no | 'Output' | Heading above the output code block. |
| pendingLabel | `string` | no | 'Pending' | Header badge label for the `pending` state. |
| preset | `string` | no | | Apply a named preset registered via ``. Prefer this over `class` overrides when the requested look falls outside the semantic intent palette. |
| runningLabel | `string` | no | 'Running' | Header badge label for the `running` state. |
| slotClasses | `Partial>` | no | | Per-slot class overrides. Slots: `trigger` (header button), `triggerLeft`, `triggerRight`, `spinner`, `toolName`, `chevron`, `body`, `section`, `sectionLabel`, `errorMessage`. |
| unstyled | `boolean` | no | | Strip the component's default tv() classes (the underlying Collapsible card chrome is kept). |
Inherited from:
- Omit, 'class' | 'children'> (omit-pattern)
### Types
```ts
type ChatToolCallPart = Extract
```
```ts
type ChatMessagePart = | { type: 'text'; text: string }
/** Model reasoning. Collapsed, tertiary presentation; `durationMs` feeds the "Thought for Xs" label. */
| { type: 'reasoning'; text: string; durationMs?: number }
/** A tool invocation with its lifecycle state. Rendered as a ToolCallCard by default; override via `partRenderers`. */
| {
type: 'tool-call';
id: string;
name: string;
state: 'pending' | 'running' | 'complete' | 'error';
input?: unknown;
output?: unknown;
errorMessage?: string;
}
/** A cited source. Same shape as CitationSource — also feeds StreamingMarkdown's `sources` for `[id]` markers. */
| ({ type: 'source' } & CitationSource)
/**
* A file attached to the message. `url` is only ever rendered as a
* policy-checked download link (never as an inline image/iframe) — LLM- or
* server-supplied URLs are untrusted input.
*/
| { type: 'attachment'; name: string; mimeType: string; size?: number; url?: string }
/** Declarative A2UI payload (P4). Validated fail-loud by A2UIView; ignored by default renderers until then. */
| { type: 'a2ui'; payload: unknown }
```
```ts
type SlotNames = keyof ReturnType & string
```
```ts
interface CitationSource {
/** Stable id — matches the `[id]` marker in the streamed markdown. */
id: string;
/** Human-readable source title, always shown in the popover (and as the chip label under `citationStyle="label"`). */
title: string;
/** Source URL. Rendered as an outbound link only when it passes the `urlPolicy`; a blocked or absent URL shows title/snippet with no link. */
url?: string;
/** Short excerpt shown under the title, clamped to ~3 lines. */
snippet?: string;
}
```
### Slots (slotClasses keys)
`trigger`, `triggerLeft`, `triggerRight`, `spinner`, `toolName`, `chevron`, `body`, `section`, `sectionLabel`, `errorMessage`