---
sidebar_position: 2
title: MD_GET_DIVE
description: Retrieve a Dive by ID including its full React component content.
feature_stage: preview
---

Retrieves a single [Dive](/key-tasks/ai-and-motherduck/dives) by ID, including the full React component source code for the current version.

## Syntax

```sql
SELECT * FROM MD_GET_DIVE(id ='your-dive-uuid'::UUID);
```

## Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `id` | `UUID` | Yes | The unique identifier of the Dive |

## Return Columns

| Column | Type | Description |
|--------|------|-------------|
| `id` | `UUID` | Unique identifier of the Dive |
| `title` | `VARCHAR` | Dive title |
| `description` | `VARCHAR` | Dive description |
| `owner_id` | `UUID` | UUID of the Dive owner |
| `current_version` | `INTEGER` | Latest version number (1-based) |
| `created_at` | `TIMESTAMP WITH TIME ZONE` | When the Dive was created |
| `updated_at` | `TIMESTAMP WITH TIME ZONE` | When the Dive was last updated |
| `owner_name` | `VARCHAR` | Name of the Dive owner |
| `version_id` | `UUID` | UUID of the current version |
| `version_storage_url` | `VARCHAR` | Storage URL of the current version content |
| `version_description` | `VARCHAR` | Description/commit message for the current version |
| `version_created_at` | `TIMESTAMP WITH TIME ZONE` | When the current version was created |
| `version_api_version` | `UINTEGER` | API version used to create this version |
| `content` | `VARCHAR` | Full JSX/React component source code |

## Examples

Read a Dive by ID:

```sql
SELECT title, description, content
FROM MD_GET_DIVE(id ='a1b2c3d4-e5f6-7890-abcd-ef1234567890'::UUID);
```

Get the metadata without the content:

```sql
SELECT id, title, owner_name, current_version, updated_at
FROM MD_GET_DIVE(id ='a1b2c3d4-e5f6-7890-abcd-ef1234567890'::UUID);
```

## Errors

Returns an error if the Dive does not exist.

## Related

- [`MD_GET_DIVE_VERSION`](../md-get-dive-version) — Retrieve a specific historical version
- [`MD_LIST_DIVES`](../md-list-dives) — List all Dives to find IDs
- [`read_dive` MCP tool](/sql-reference/mcp/read-dive) — AI assistant equivalent
