Dive

Guides

Improve what Dive knows about a tool

Record what a tool returns by running it, then declare its output schema in the tool file.

Drafters write templates like {{releases.0.tagName}} from what a tool returns. recent_releases doesn't say yet.

version: 2
name: recent_releases
description: The latest releases of a GitHub repository, newest first.
kind: exec
command: gh
args:
- release
- list
- --repo
- '{{input.repo}}'
- --json
- tagName,publishedAt
- --limit
- '3'
output: json
read_only: true
input_schema:
  type: object
  required:
  - repo
  properties:
    repo:
      type: string
      description: The repository as owner/name

Record a shape by running the tool

Dive records the shape of each successful result. Before the first call, there's nothing for recent_releases:

dive shape show user__recent_releases
Error: no cached shape for tool user__recent_releases

Call it once:

dive tool test user__recent_releases \
  --input repo=loon-rocks/dive

The shape is now cached, with a schema inferred from the result and an example:

dive shape show user__recent_releases
{
  "example": [
    {
      "publishedAt": "2026-09-24T04:34:59Z",
      "tagName": "v0.21.0"
    },
    …
  ],
  "schema": {
    "items": {
      "properties": {
        "publishedAt": {
          "type": "string"
        },
        "tagName": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "type": "array"
  },
  "seen_count": 1,
  "tool": "user__recent_releases"
}

Declare the output schema

A recorded shape only exists after a run, and it can't say what a field means. Add output_schema to the tool file:

.dive/tools/recent_releases.yaml
output_schema:
  type: array
  items:
    type: object
    properties:
      tagName:
        type: string
        description: The release's tag
      publishedAt:
        type: string
        description: When it was published, ISO 8601

dive tool show now lists it, and drafters use it in place of the recorded shape:

dive tool show user__recent_releases
user__recent_releases

The latest releases of a GitHub repository, newest first.

input schema:
…

output schema:
{
  "items": {
    "properties": {
      "publishedAt": {
        "description": "When it was published, ISO 8601",
        "type": "string"
      },
      "tagName": {
        "description": "The release's tag",
        "type": "string"
      }
    },
    "type": "object"
  },
  "type": "array"
}
source: ./.dive/tools/recent_releases.yaml