# Infrastructure & Data

{% hint style="info" %}
**Who is this for?** SDETs, developers, and DevOps engineers integrating ContextQA with AI coding assistants (Claude, Cursor) or CI/CD pipelines.
{% endhint %}

These tools cover two areas: the infrastructure and configuration layer (environments, browsers, mobile devices, UI element repository) and the test data layer (data profiles used for data-driven test execution).

***

## Infrastructure & Configuration

***

## get\_environments

Retrieves a paginated list of configured test environments; use this to find environment IDs before executing tests against a specific target.

**Category:** Infrastructure & Config | **Authentication required:** Yes

### Parameters

| Name  | Required | Type    | Description                                    |
| ----- | -------- | ------- | ---------------------------------------------- |
| page  | ❌        | integer | Page number (0-based). Defaults to 0.          |
| size  | ❌        | integer | Results per page. Defaults to 20.              |
| sort  | ❌        | string  | Sort field and direction, e.g. `"name,asc"`.   |
| query | ❌        | string  | Free-text filter applied to environment names. |

### Returns

Paginated JSON with a `content` array. Each entry includes `id`, `name`, `envType`, `description`, and `dbType`.

### Example

```json
{
  "page": 0,
  "size": 20,
  "query": "staging"
}
```

### Related Tools

`get_environment`, `create_environment`, `update_environment`, `delete_environment`

***

## get\_environment

Retrieves the full configuration of a single environment by its numeric ID.

**Category:** Infrastructure & Config | **Authentication required:** Yes

### Parameters

| Name            | Required | Type    | Description                                |
| --------------- | -------- | ------- | ------------------------------------------ |
| environment\_id | ✅        | integer | Numeric ID of the environment to retrieve. |

### Returns

Single environment JSON including `id`, `name`, `envType`, `description`, `dbType`, and `parameters` key-value map.

### Example

```json
{
  "environment_id": 3
}
```

### Related Tools

`get_environments`, `update_environment`, `delete_environment`

***

## create\_environment

Creates a new test environment configuration with optional database connection and custom parameters.

**Category:** Infrastructure & Config | **Authentication required:** Yes

### Parameters

| Name        | Required | Type   | Description                                                         |
| ----------- | -------- | ------ | ------------------------------------------------------------------- |
| name        | ✅        | string | Display name for the environment.                                   |
| env\_type   | ❌        | string | Environment type, e.g. `"web"`, `"api"`, `"mobile"`.                |
| description | ❌        | string | Human-readable description.                                         |
| db\_type    | ❌        | string | Database type if DB validation is needed, e.g. `"postgres"`.        |
| parameters  | ❌        | object | Key-value map of custom parameters (base URLs, credentials, flags). |

### Returns

JSON of the created environment including its assigned `id`.

### Example

```json
{
  "name": "Staging EU",
  "env_type": "web",
  "description": "EU staging environment for regression runs",
  "parameters": {
    "BASE_URL": "https://staging.eu.example.com",
    "API_KEY": "sk-test-abc123"
  }
}
```

### Related Tools

`get_environments`, `update_environment`, `delete_environment`

***

## update\_environment

Partially updates an existing environment configuration; only fields provided are changed.

**Category:** Infrastructure & Config | **Authentication required:** Yes

### Parameters

| Name            | Required | Type    | Description                                                              |
| --------------- | -------- | ------- | ------------------------------------------------------------------------ |
| environment\_id | ✅        | integer | Numeric ID of the environment to update.                                 |
| name            | ❌        | string  | New display name.                                                        |
| env\_type       | ❌        | string  | Updated environment type.                                                |
| description     | ❌        | string  | Updated description.                                                     |
| db\_type        | ❌        | string  | Updated database type.                                                   |
| parameters      | ❌        | object  | Replacement key-value parameter map. Replaces the existing map entirely. |

### Returns

JSON of the updated environment record.

### Example

```json
{
  "environment_id": 3,
  "parameters": {
    "BASE_URL": "https://staging-v2.eu.example.com",
    "API_KEY": "sk-test-abc123"
  }
}
```

### Related Tools

`get_environment`, `create_environment`, `delete_environment`

***

## delete\_environment

Permanently deletes an environment configuration from the workspace.

**Category:** Infrastructure & Config | **Authentication required:** Yes

### Parameters

| Name            | Required | Type    | Description                              |
| --------------- | -------- | ------- | ---------------------------------------- |
| environment\_id | ✅        | integer | Numeric ID of the environment to delete. |

### Returns

JSON deletion confirmation with the deleted environment ID and a status message.

### Example

```json
{
  "environment_id": 3
}
```

### Related Tools

`get_environments`, `create_environment`

***

## get\_test\_devices

Retrieves the list of available test execution targets including browser configurations and registered mobile devices.

**Category:** Infrastructure & Config | **Authentication required:** Yes

### Parameters

| Name  | Required | Type    | Description                                 |
| ----- | -------- | ------- | ------------------------------------------- |
| page  | ❌        | integer | Page number (0-based). Defaults to 0.       |
| size  | ❌        | integer | Results per page. Defaults to 20.           |
| sort  | ❌        | string  | Sort field and direction.                   |
| query | ❌        | string  | Free-text filter on device or browser name. |

### Returns

Paginated list of device/browser entries. Each entry includes `id`, `name`, `type` (`browser` or `mobile`), and availability status.

### Example

```json
{
  "query": "chrome"
}
```

### Related Tools

`get_mobile_concurrency`, `execute_test_case`, `execute_test_suite`

***

## get\_ui\_elements

Retrieves entries from the UI element repository, which stores reusable selectors and locators shared across test cases.

**Category:** Infrastructure & Config | **Authentication required:** Yes

### Parameters

| Name                   | Required | Type    | Description                                      |
| ---------------------- | -------- | ------- | ------------------------------------------------ |
| page                   | ❌        | integer | Page number (0-based). Defaults to 0.            |
| size                   | ❌        | integer | Results per page. Defaults to 20.                |
| sort                   | ❌        | string  | Sort field and direction.                        |
| query                  | ❌        | string  | Free-text filter on element name or locator.     |
| workspace\_version\_id | ❌        | string  | Filter elements by a specific workspace version. |

### Returns

Paginated list of UI element records including `id`, `name`, `locatorType`, `locatorValue`, and associated test count.

### Example

```json
{
  "query": "login button",
  "size": 50
}
```

### Related Tools

`get_environments`, `get_test_cases`

***

## get\_mobile\_concurrency

Returns the number of available mobile device execution slots currently free in the workspace; check this before scheduling parallel mobile runs.

**Category:** Infrastructure & Config | **Authentication required:** Yes

### Parameters

None.

### Returns

JSON with `availableSlots` (integer) and `totalSlots` (integer) for mobile execution capacity.

### Example

```json
{}
```

### Related Tools

`get_test_devices`, `execute_test_case`, `execute_test_suite`

***

## Test Data Profiles

***

## get\_data\_profiles

Retrieves a paginated list of test data profiles; use this to find profile IDs for data-driven test execution.

**Category:** Test Data Profiles | **Authentication required:** Yes

### Parameters

| Name  | Required | Type    | Description                           |
| ----- | -------- | ------- | ------------------------------------- |
| page  | ❌        | integer | Page number (0-based). Defaults to 0. |
| size  | ❌        | integer | Results per page. Defaults to 20.     |
| sort  | ❌        | string  | Sort field and direction.             |
| query | ❌        | string  | Free-text filter on profile name.     |

### Returns

Paginated JSON with a `content` array of profile records including `id`, `name`, and `rowCount`.

### Example

```json
{
  "query": "login credentials"
}
```

### Related Tools

`get_data_profile`, `create_data_profile`, `update_data_profile`, `delete_data_profile`

***

## get\_data\_profile

Retrieves the full contents of a single test data profile including all rows and column definitions.

**Category:** Test Data Profiles | **Authentication required:** Yes

### Parameters

| Name        | Required | Type    | Description                                 |
| ----------- | -------- | ------- | ------------------------------------------- |
| profile\_id | ✅        | integer | Numeric ID of the data profile to retrieve. |

### Returns

JSON with `id`, `name`, and `rows` — an array of objects where each object is one data row with column-name keys.

### Example

```json
{
  "profile_id": 12
}
```

### Related Tools

`get_data_profiles`, `update_data_profile`, `delete_data_profile`

***

## create\_data\_profile

Creates a new test data profile with an initial set of data rows for use in data-driven test execution.

**Category:** Test Data Profiles | **Authentication required:** Yes

### Parameters

| Name | Required | Type             | Description                                                                             |
| ---- | -------- | ---------------- | --------------------------------------------------------------------------------------- |
| name | ✅        | string           | Display name for the data profile.                                                      |
| rows | ✅        | array of objects | Array of row objects. Each object's keys become column names; values are the test data. |

### Returns

JSON of the created data profile including its assigned `id` and the stored rows.

### Example

```json
{
  "name": "E-commerce Login Users",
  "rows": [
    { "username": "admin@test.com", "password": "Admin123!", "role": "admin" },
    { "username": "user@test.com", "password": "User456!", "role": "standard" },
    { "username": "guest@test.com", "password": "Guest789!", "role": "guest" }
  ]
}
```

### Related Tools

`get_data_profiles`, `update_data_profile`, `delete_data_profile`, `execute_test_case`

***

## update\_data\_profile

Partially updates an existing test data profile; supplying `rows` replaces all existing rows entirely.

**Category:** Test Data Profiles | **Authentication required:** Yes

### Parameters

| Name        | Required | Type             | Description                                                             |
| ----------- | -------- | ---------------- | ----------------------------------------------------------------------- |
| profile\_id | ✅        | integer          | Numeric ID of the profile to update.                                    |
| name        | ❌        | string           | New display name.                                                       |
| rows        | ❌        | array of objects | Replacement row set. Supplying this field overwrites all existing rows. |

### Returns

JSON of the updated data profile with its full row set.

### Example

```json
{
  "profile_id": 12,
  "rows": [
    { "username": "admin@test.com", "password": "NewAdmin123!", "role": "admin" },
    { "username": "poweruser@test.com", "password": "Power789!", "role": "power" }
  ]
}
```

### Related Tools

`get_data_profile`, `create_data_profile`, `delete_data_profile`

***

## delete\_data\_profile

Permanently deletes a test data profile from the workspace.

**Category:** Test Data Profiles | **Authentication required:** Yes

### Parameters

| Name        | Required | Type    | Description                               |
| ----------- | -------- | ------- | ----------------------------------------- |
| profile\_id | ✅        | integer | Numeric ID of the data profile to delete. |

### Returns

JSON deletion confirmation with the deleted profile ID and a status message.

### Example

```json
{
  "profile_id": 12
}
```

### Related Tools

`get_data_profiles`, `create_data_profile`

***
