> ## Documentation Index
> Fetch the complete documentation index at: https://docs.skybridge.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# useToolInfo

> Read the tool call that produced the current view

`useToolInfo` reads the [tool](https://docs.skybridge.tech/build/tools.md) call that rendered the current [view](https://docs.skybridge.tech/build/view.md), so a view can display the data its own tool produced.

Import it from your generated [`helpers.ts`](https://docs.skybridge.tech/api-reference/generate-helpers): the typed hook infers `input`, `output`, and `responseMetadata` from your server, so you pass only the tool name.

## Example

The view reads the result of the tool that rendered it, branching on `status`.

```tsx highlight={4-5,7,8,10,13,15} theme={null}
import { useToolInfo } from "../helpers.js"; // generated, type-safe from server schema

function Carousel() {
  const { input, isPending, isSuccess, output, responseMetadata } =
    useToolInfo<"search-products">();

  if (isPending) {
    return <p>Searching {input?.query}...</p>;
  }
  if (isSuccess) {
    return (
      <div>
        <ProductGrid products={output.products} />
        <p>
          {output.products.length} results in {responseMetadata.ms}ms
        </p>
      </div>
    );
  }
  return null;
}
```

## Type Parameters

### `ToolSignature`

```tsx theme={null}
ToolSignature extends Partial<{
  input: Record<string, unknown>;
  output: Record<string, unknown>;
  responseMetadata: Record<string, unknown>;
}> = Record<string, never>;
```

Refines the shape of `input`, `output`, and `responseMetadata`. This is the direct-import form; the generated helper takes a tool name instead and infers all three. With neither, each typed field resolves to `never`.

## Returns

### `status`

```tsx theme={null}
status: "pending" | "success";
```

* `"pending"`: the tool's output and metadata have not arrived yet.
* `"success"`: the tool delivered its `output` or its `responseMetadata`.

### `isPending`, `isSuccess`

```tsx theme={null}
isPending: boolean;
isSuccess: boolean;
```

Each is `true` when `status` equals the matching value and `false` otherwise.

### `input`

```tsx theme={null}
input: ToolInput | undefined;
```

The [arguments](https://docs.skybridge.tech/api-reference/register-tool.md#inputschema-outputschema) the view's tool was called with. The model sees these: they are part of the tool call in the conversation. It can be `undefined` in either state, because the host may render the view before it delivers the arguments.

### `output`

```tsx theme={null}
output: ToolOutput | undefined;
```

The tool's structured output, set when `status` is `"success"`. The model sees this: it is the tool [result](https://docs.skybridge.tech/api-reference/register-tool.md#return) in the conversation. It is `undefined` while pending, and `undefined` in success if the tool returned no structured output.

### `responseMetadata`

```tsx theme={null}
responseMetadata: ToolResponseMetadata | undefined;
```

The `_meta` the tool's [handler](https://docs.skybridge.tech/api-reference/register-tool.md#handler) returned alongside its result, typed from your server. It is `undefined` while pending, and `undefined` in success if the tool returned no metadata.

> [card] [Create Views](https://docs.skybridge.tech/build/view.md)
>
> Render a view from a tool result in context

> [card] [generateHelpers](https://docs.skybridge.tech/api-reference/generate-helpers.md)
>
> The typed `useToolInfo` that infers from your server

> [card] [useCallTool](https://docs.skybridge.tech/api-reference/use-call-tool.md)
>
> Call another tool from the view


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.