# Tool Types API

Tool type management endpoints.

## Authentication

All endpoints require authentication (session cookie).

---

## GET /tool-types

**Description:** List all tool types.

### Response

#### Success (200 OK)

```json
[
  {
    "id": "uuid",
    "name": "code-server",
    "display_name": "VS Code Server",
    "description": "VS Code in the browser",
    "is_builtin": true,
    "created_at": "2024-01-01T00:00:00Z"
  }
]
```

---

## POST /tool-types

**Description:** Create a new tool type.

### Request

#### Request Body

```json
{
  "name": "my-tool",
  "display_name": "My Custom Tool",
  "description": "A custom development tool",
  "compose_template": "version: \"3.8\"\nservices:\n  tool:\n    image: my-image:latest\n    container_name: {{TOOL_NAME}}\n    volumes:\n      - {{REPO_PATH}}:/workspace",
  "required_variables": ["TOOL_NAME", "REPO_PATH"]
}
```

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `name` | `string` | Yes | Unique identifier |
| `display_name` | `string` | Yes | Human-readable name |
| `description` | `string` | No | Description |
| `compose_template` | `string` | Yes | Docker Compose YAML |
| `required_variables` | `array` | Yes | Required template variables |

### Response

#### Success (201 Created)

```json
{
  "id": "uuid",
  "name": "my-tool",
  "display_name": "My Custom Tool",
  "description": "A custom development tool",
  "compose_template": "...",
  "required_variables": ["TOOL_NAME", "REPO_PATH"],
  "is_builtin": false,
  "created_at": "2024-01-01T00:00:00Z"
}
```

#### Error (400 Bad Request)

```json
{
  "detail": "Invalid YAML in compose template"
}
```

---

## GET /tool-types/{id}

**Description:** Get tool type details.

### Response

#### Success (200 OK)

```json
{
  "id": "uuid",
  "name": "code-server",
  "display_name": "VS Code Server",
  "description": "VS Code in the browser",
  "compose_template": "...",
  "required_variables": ["TOOL_NAME", "REPO_PATH"],
  "is_builtin": true,
  "created_at": "2024-01-01T00:00:00Z"
}
```

---

## PUT /tool-types/{id}

**Description:** Update a tool type.

**Note:** Built-in tool types cannot be modified.

### Request

#### Request Body

Same as POST /tool-types.

### Response

#### Success (200 OK)

Returns updated tool type.

#### Error (403 Forbidden)

```json
{
  "detail": "Cannot modify built-in tool types"
}
```

---

## DELETE /tool-types/{id}

**Description:** Delete a tool type.

**Note:** Built-in tool types cannot be deleted.

### Response

#### Success (204 No Content)

#### Error (403 Forbidden)

```json
{
  "detail": "Cannot delete built-in tool types"
}
```
