## MODIFIED Requirements

### Requirement: Tool Type Model

The system SHALL store tool type definitions in the database.

#### Scenario: Create tool type
- GIVEN an admin user
- WHEN they define a new tool type
- THEN the following fields are stored:
  - name: Tool identifier
  - description: Human-readable description
  - docker_compose_template: Compose file template
  - icon: Visual identifier
  - category: Tool category
  - default_env_vars: Default environment variables
  - default_port: **Required** primary port the tool listens on
  - interfaces: List of supported interfaces ("web", "terminal")

#### Scenario: Tool type without port rejected
- GIVEN a user creating a tool type without `default_port`
- WHEN the request is submitted
- THEN the system rejects with a 422 validation error

### Requirement: Built-in Tools

The system SHALL include default tool types.

#### Scenario: Built-in tools
- GIVEN a fresh installation
- THEN these tool types are pre-configured:
  - code-server: VS Code in browser (port 8443, interfaces: ["web"])
  - jupyter-notebook: Jupyter notebooks (port 8888, interfaces: ["web"])
  - opencode: OpenCode agent environment (port 3000, interfaces: ["terminal", "web"])

### Requirement: Template Validation

The system SHALL validate Docker Compose templates.

#### Scenario: Invalid template
- GIVEN an invalid Docker Compose template
- WHEN a user tries to create/update a tool type
- THEN the system rejects with validation errors

#### Scenario: Port not exposed in template
- GIVEN a tool type with `default_port: 8443`
- WHEN the compose template does not expose port 8443
- THEN the system rejects with a validation error indicating the port mismatch
