# Tool List

`ToolList` shows a list of tool contracts (what each tool takes and returns). Use it to show which tools an Agent had and which it used. The inspectors and the Capability reference pages in these docs use it.

_Interactive preview available on the rendered documentation page._


## Installation

Install `@vite-hub/ui` as [Installation](https://vitehub.dev/docs/ui/installation) shows. `vite-hub/nuxt` auto-imports the component. In Vue with Vite, import it from `@vite-hub/ui` or `@vite-hub/ui/tool-list`:

```ts
import { ToolList } from "@vite-hub/ui";
```

## Usage

```ts
import { ToolList, type AgentToolInspection } from "@vite-hub/ui";
```

```vue
<template>
  <ToolList :tools="configuration.tools" :calls="{ search_meals: 3 }" @select="showFirstCall" />
</template>
```

## Features

- Shows the name, label, icon, and call count of each tool.
- A tool with a description or schemas expands to show them, with a table of input fields.
- MCP tools show their server and original tool name.

## Contracts Without Usage

Leave out `calls` to show only the contracts, such as for a build-time reference.

_Interactive preview available on the rendered documentation page._


## Call Counts

- Without `calls`, rows show no usage.
- With `calls`, a used tool shows **n calls**. An unused tool shows a dash named **Not used**.
- The count is a button only when you listen to `select`. Selecting it does not toggle the row.

## Accessibility

- Tools with details use native `<details>` disclosures.
- The call count button has the name **n calls, show the first call**.

## API Reference

### ToolList

Renders tool contracts with optional call counts.

#### Props

| Prop    | Type                                 | Default  | Description                                  |
| ------- | ------------------------------------ | -------- | -------------------------------------------- |
| `tools` | `readonly AgentToolInspection[]`     | Required | The tool contracts. |
| `calls` | `Readonly<Record<string, number>>`   |          | Call counts by tool name.                    |

#### Events

| Event    | Payload        | Description                                       |
| -------- | -------------- | ------------------------------------------------- |
| `select` | `name: string` | The call count of a used tool was selected. |

#### Types

```ts
import type { AgentInspectionValue } from "vite-hub/ui"

interface AgentToolInspection {
  name: string;
  /** Short past-tense label from the tool's title, for example "Searched meals". */
  label?: string;
  /** Iconify icon name, for example "i-lucide-database". */
  icon?: string;
  description?: string;
  inputSchema?: AgentInspectionValue;
  outputSchema?: AgentInspectionValue;
  mcp?: { server: string; name: string };
  /** Capability that registered this tool, when known. */
  capabilityId?: string;
}
```

Icons use Nuxt UI's `UIcon`. To replace it, see [Nuxt UI components](https://vitehub.dev/docs/ui/installation#nuxt-ui-components).

## Related

- [Console](https://vitehub.dev/docs/development/console) groups the tools of a run by Capability.
- [Code block](https://vitehub.dev/docs/ui/code-block) shows the input and output of a tool call.

<!-- vitehub-docs:section-links -->
## In this section

- [Start](https://vitehub.dev/raw/docs/ui.md)
- [Blocks](https://vitehub.dev/raw/docs/ui/blocks/chat-app.md)
- [Parts](https://vitehub.dev/raw/docs/ui/message.md)
- [Chat](https://vitehub.dev/raw/docs/ui/chat.md)
- [Collaboration](https://vitehub.dev/raw/docs/ui/avatar-stack.md)
- Agent work
  - [Tool List](https://vitehub.dev/raw/docs/ui/tool-list.md) (this page)
  - [Diff](https://vitehub.dev/raw/docs/ui/diff.md)
  - [Code View](https://vitehub.dev/raw/docs/ui/code-view.md)
  - [File Tree](https://vitehub.dev/raw/docs/ui/file-tree.md)
- [Utilities](https://vitehub.dev/raw/docs/ui/attachments.md)

Next: [Markdown Editor](https://vitehub.dev/raw/docs/ui/markdown-editor.md)

All pages: [llms.txt](https://vitehub.dev/llms.txt)
