# Tool

Schema reference for tools and the versioned code packages behind them.

### Tools Table

**Table Name:** `tools`\
**Description:** Tool configurations and metadata

{% tabs %}
{% tab title="Schema" %}

| Column           | Type      | Description                  |
| ---------------- | --------- | ---------------------------- |
| `_id`            | string    | Tool identifier              |
| `created_at`     | timestamp | Creation timestamp           |
| `deprecated`     | boolean   | Deprecation status           |
| `description`    | string    | Tool description             |
| `envvars`        | json      | Environment variables        |
| `name`           | string    | Tool name                    |
| `org_id`         | string    | Organization identifier      |
| `region_name`    | string    | Deployment region            |
| `secret_envvars` | json      | Secret environment variables |
| `tags`           | json      | Associated tags              |
| `updated_at`     | timestamp | Last update timestamp        |
| {% endtab %}     |           |                              |

{% tab title="Query Example" %}

```sql
SELECT
  name,
  description,
  deprecated,
  tags
FROM tools
WHERE deprecated = false;
```

{% endtab %}
{% endtabs %}

### Tool Versions Table

**Table Name:** `tool_versions`\
**Description:** Version history and configurations for tools

{% tabs %}
{% tab title="Schema" %}

| Column                       | Type      | Description                        |
| ---------------------------- | --------- | ---------------------------------- |
| `_id`                        | string    | Version identifier                 |
| `amigo_scaffold_commit_hash` | string    | Scaffold commit hash               |
| `created_at`                 | timestamp | Creation timestamp                 |
| `creator`                    | json      | Creator info `{ user_id, org_id }` |
| `deprecated`                 | boolean   | Deprecation status                 |
| `input_schema`               | json      | Input schema definition            |
| `org_id`                     | string    | Organization identifier            |
| `project_directory`          | string    | Project directory path             |
| `region_name`                | string    | Deployment region                  |
| `required_envvars`           | json      | Required environment vars          |
| `required_secret_envvars`    | json      | Required secret vars               |
| `commit_hash`                | string    | Commit hash                        |
| `creator_user_id`            | string    | Creator user ID                    |
| `tool_branch_name`           | string    | Tool branch name                   |
| `tool_commit_hash`           | string    | Tool commit hash                   |
| `tool_id`                    | string    | Parent tool ID                     |
| `tool_repo`                  | string    | Tool repository                    |
| `updated_at`                 | timestamp | Last update timestamp              |
| `version`                    | integer   | Version number                     |
| {% endtab %}                 |           |                                    |

{% tab title="Query Example" %}

```sql
SELECT
  tool_id,
  version,
  deprecated,
  created_at,
  project_directory
FROM tool_versions
ORDER BY version DESC;
```

{% endtab %}
{% endtabs %}
