---
sidebar_position: 10
title: read_dive
description: Read a specific Dive by ID, including its full component code
feature_stage: preview
---

Read a specific [Dive](/docs/key-tasks/ai-and-motherduck/dives) by ID, including its full JSX/React component code. Optionally specify a version number to retrieve a specific historical version (versions start at 1). If no version is specified, the latest version is returned.

## Description

The `read_dive` tool retrieves a Dive's complete details, including its title, description, timestamps, and the full React component source code. Use this to inspect an existing Dive before updating it, or to understand how a Dive is built.

Use [`list_dives`](../list-dives) first to find the Dive ID and its `current_version`.

## Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `id` | string | Yes | The unique identifier (UUID) of the Dive to read |
| `version` | number | No | Version number to retrieve (1-indexed). Defaults to the latest version. |

## Output Schema

```json
{
  "success": boolean,
  "dive": {                      // Dive object (on success)
    "id": string,                // Unique identifier (UUID)
    "title": string,             // Dive title
    "description": string,       // Dive description
    "content": string,           // Full JSX/React component code
    "current_version": number,   // Current version number
    "created_at": string,        // ISO 8601 creation timestamp
    "updated_at": string         // ISO 8601 last update timestamp
  },
  "error": string                // Error message (on failure)
}
```

## Example Usage

**Read a Dive to inspect its code:**

```text
Show me the code for my revenue trends Dive
```

The AI assistant will call the tool with the Dive's ID:

```json
{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
```

**Read a specific version of a Dive:**

```text
Show me version 1 of my revenue trends Dive
```

```json
{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "version": 1
}
```

**Read a Dive before updating it:**

```text
I want to modify my customer signups Dive—can you show me what it looks like?
```

## Success Response Example

```json
{
  "success": true,
  "dive": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "title": "Monthly Revenue Trends",
    "description": "Line chart showing revenue by month",
    "content": "import { useSQLQuery } from \"@motherduck/react-sql-query\";\n\nexport default function Dive() {\n  const { data, isLoading } = useSQLQuery(`SELECT ...`);\n  // ...\n}",
    "current_version": 3,
    "created_at": "2025-01-15T10:30:00Z",
    "updated_at": "2025-01-20T14:45:00Z"
  }
}
```

## Error Response Example

```json
{
  "success": false,
  "error": "Dive with ID 'invalid-uuid' not found"
}
```
