# ToolCallCard

Inline MCP/tool invocation + result as a native <details> disclosure with status badge and IO panel.

[All components](https://rickylabs.github.io/netscript/design-system/components/) · [Theme builder](https://rickylabs.github.io/netscript/create/) · [Implementation source](https://github.com/rickylabs/netscript/blob/main/packages/fresh-ui/registry/components/ui/tool-call-card.tsx)

## Live preview

[Open live tool-call-card preview](https://rickylabs.github.io/netscript/assets/fresh-ui/preview/?component=tool-call-card&theme=studio-utility)

## Install

```bash
netscript ui:add tool-call-card
```

## Usage and examples

The preview runs this JSX with the installed components. Import any composed primitives from your UI directory.

```tsx
import { useState } from 'preact/hooks';
import { ToolCallCard } from '@app/components/ui/tool-call-card.tsx';

export function Example() {
  const [value, setValue] = useState('standard');
  const [open, setOpen] = useState(false);
  const [notice, report] = useState('');
  return (<><div><ToolCallCard name="orders.lookup" status="done" args={JSON.stringify({id:"SO–10480"})} result="Order shipped" /></div><p role="status">{notice}</p></>);
}
```

## Props

Generated from native `deno doc --json --private` over the shipped implementation. Compound component props retain their owning interface; native attributes pass through where declared.

| Owner | Prop | Type | Optional | Description |
| --- | --- | --- | --- | --- |
| `ToolCallCardProps` | `name` | `string` | No | Fully-qualified tool name, e.g. `pkg.fn`. |
| `ToolCallCardProps` | `args` | `string` | Yes | Serialized invocation arguments. |
| `ToolCallCardProps` | `result` | `string` | Yes | Serialized result payload. |
| `ToolCallCardProps` | `status` | `ToolCallStatus` | No | Lifecycle status. |
| `ToolCallCardProps` | `defaultOpen` | `boolean` | Yes | Open the disclosure by default. |
| `ToolCallCardProps` | `class` | `string` | Yes |  |

```typescript
type ToolCallStatus = "running" | "done" | "error"
ToolCallCardProps extends Omit<JSX.HTMLAttributes<HTMLDetailsElement>, "class">
```

## Keyboard

| Key | Action |
| --- | --- |
| `Enter/Space` | Toggle disclosure |

## Tokens

Semantic contract roles: `border/default`, `destructive/border`, `destructive/text`, `radius/input`, `space/stack/gap`, `success/text`, `surface/surface`, `text/muted`.

CSS custom properties referenced directly: `--ns-border`, `--ns-border-width`, `--ns-code-bg`, `--ns-destructive-border`, `--ns-destructive-text`, `--ns-ease-fast`, `--ns-fg`, `--ns-focus-ring-offset`, `--ns-focus-ring-width`, `--ns-font-eyebrow`, `--ns-font-mono`, `--ns-label-tracking`, `--ns-leading-label`, `--ns-leading-normal`, `--ns-muted`, `--ns-muted-fg`, `--ns-prose-code-line`, `--ns-prose-code-size`, `--ns-radius-control`, `--ns-radius-input`, `--ns-radius-md`, `--ns-radius-sm`, `--ns-ring`, `--ns-space-1`, `--ns-space-2`, `--ns-space-3`, `--ns-space-5`, `--ns-success-text`, `--ns-surface`, `--ns-surface-raised`, `--ns-text-2xs`, `--ns-text-label`, `--ns-text-xs`, `--ns-tracking-label`, `--ns-tracking-wide`, `--ns-weight-label`.

## Contract and compatibility

Accessibility pattern: [WAI-ARIA guidance](https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/)

- Native DOM attributes pass through where the implementation accepts them.

Design contract values marked planned are not implementation props. The props above describe what ships today.
