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

# useToolInfo

> Get metadata about the tool call that created this app.

<Badge color="yellow">sunpeak API</Badge>

## Overview

The `useToolInfo` hook returns metadata about the tool call that instantiated the current app. It is a convenience wrapper around `useHostContext`.

<Card horizontal title="Wraps onhostcontextchanged" icon="cube" href="/mcp-apps/app/event-handlers/onhostcontextchanged">
  MCP Apps SDK reference
</Card>

## Import

```tsx theme={null}
import { useToolInfo } from 'sunpeak';
```

## Signature

```tsx theme={null}
function useToolInfo(): ToolInfo | undefined
```

## Returns

<ResponseField name="return" type="ToolInfo | undefined">
  Metadata about the tool call, or `undefined` if not available.

  ```typescript theme={null}
  {
    id?: RequestId;   // JSON-RPC id of the tools/call request
    tool: Tool;       // Tool definition including name, inputSchema, etc.
  }
  ```
</ResponseField>

## Usage

```tsx theme={null}
import { useToolInfo } from 'sunpeak';

function MyResource() {
  const toolInfo = useToolInfo();

  return (
    <div>
      <p>Rendered by: {toolInfo?.tool.name ?? 'unknown tool'}</p>
    </div>
  );
}
```

The tool info comes from [`McpUiHostContext.toolInfo`](/mcp-apps/types/core-types#mcpuihostcontext).
