> Call the `diagnose` tool first. Full index: /llms.txt. Errors: /reference/problems.

# Setup and diagnose

## `diagnose`

Check what an app needs before a run: call it first, and whenever a call is refused.

Annotations: reads only.

| Argument     | Type             | Required | What it is                     |
| ------------ | ---------------- | -------- | ------------------------------ |
| `project_id` | `string`         | yes      | The project the call is about. |
| `app_id`     | `string \| null` | no       |                                |

```json
{
  "additionalProperties": false,
  "properties": {
    "app_id": {
      "anyOf": [
        {
          "minLength": 1,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "App Id"
    },
    "project_id": {
      "description": "The project the call is about.",
      "minLength": 1,
      "title": "Project Id",
      "type": "string"
    }
  },
  "required": [
    "project_id"
  ],
  "title": "DiagnoseCall",
  "type": "object"
}
```

## `setup`

Create and list projects, apps, builds, accounts and phones, and upload a build.

Annotations: can change or delete data.

### `setup create_account`

Add a test login for an app.

| Argument     | Type     | Required | What it is                     |
| ------------ | -------- | -------- | ------------------------------ |
| `project_id` | `string` | yes      | The project the call is about. |
| `app_id`     | `string` | yes      |                                |
| `email`      | `string` | yes      |                                |
| `password`   | `string` | yes      |                                |
| `label`      | `string` | no       |                                |

### `setup create_app`

Add an app to a project.

| Argument     | Type                | Required | What it is                     |
| ------------ | ------------------- | -------- | ------------------------------ |
| `project_id` | `string`            | yes      | The project the call is about. |
| `name`       | `string`            | yes      |                                |
| `platform`   | `ExecutionPlatform` | yes      |                                |
| `url`        | `string \| null`    | no       |                                |

### `setup create_build_upload_url`

Get a link to upload a build file.

| Argument       | Type     | Required | What it is                     |
| -------------- | -------- | -------- | ------------------------------ |
| `project_id`   | `string` | yes      | The project the call is about. |
| `app_id`       | `string` | yes      |                                |
| `filename`     | `string` | yes      |                                |
| `content_type` | `string` | yes      |                                |

### `setup create_project`

Create a project.

| Argument      | Type         | Required | What it is |
| ------------- | ------------ | -------- | ---------- |
| `name`        | `string`     | yes      |            |
| `target_kind` | `TargetKind` | yes      |            |

### `setup finalize_build`

Register an uploaded build file.

| Argument      | Type     | Required | What it is                     |
| ------------- | -------- | -------- | ------------------------------ |
| `project_id`  | `string` | yes      | The project the call is about. |
| `app_id`      | `string` | yes      |                                |
| `object_key`  | `string` | yes      |                                |
| `app_package` | `string` | no       |                                |

### `setup list_accounts`

List an app's test logins.

| Argument     | Type             | Required | What it is                     |
| ------------ | ---------------- | -------- | ------------------------------ |
| `project_id` | `string`         | yes      | The project the call is about. |
| `app_id`     | `string \| null` | no       |                                |

### `setup list_apps`

List a project's apps.

| Argument     | Type     | Required | What it is                     |
| ------------ | -------- | -------- | ------------------------------ |
| `project_id` | `string` | yes      | The project the call is about. |

### `setup list_builds`

List an app's builds.

| Argument     | Type     | Required | What it is                     |
| ------------ | -------- | -------- | ------------------------------ |
| `project_id` | `string` | yes      | The project the call is about. |
| `app_id`     | `string` | yes      |                                |

### `setup list_devices`

List the phones a project can use.

| Argument     | Type     | Required | What it is                     |
| ------------ | -------- | -------- | ------------------------------ |
| `project_id` | `string` | yes      | The project the call is about. |

### `setup list_projects`

List your projects.

| Argument | Type | Required | What it is |
| -------- | ---- | -------- | ---------- |

### `setup upload_build`

Upload an APK from this computer.

| Argument      | Type     | Required | What it is                     |
| ------------- | -------- | -------- | ------------------------------ |
| `project_id`  | `string` | yes      | The project the call is about. |
| `app_id`      | `string` | yes      |                                |
| `apk_path`    | `string` | yes      |                                |
| `app_package` | `string` | no       |                                |

### `setup whoami`

Show who the call is signed in as.

| Argument | Type | Required | What it is |
| -------- | ---- | -------- | ---------- |

```json
{
  "$defs": {
    "ExecutionPlatform": {
      "description": "Platform family selected by a runtime target.\n\nThis includes browser, unlike :class:`Platform`, which represents a mobile\ndevice OS. Runtime-target-to-platform conversion belongs here and must not be\nreimplemented as service-local dictionaries.",
      "enum": [
        "android",
        "ios",
        "browser"
      ],
      "title": "ExecutionPlatform",
      "type": "string"
    },
    "SetupCreateAccountCall": {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "create_account",
          "title": "Action",
          "type": "string"
        },
        "app_id": {
          "minLength": 1,
          "title": "App Id",
          "type": "string"
        },
        "email": {
          "minLength": 1,
          "title": "Email",
          "type": "string"
        },
        "label": {
          "default": "primary",
          "minLength": 1,
          "title": "Label",
          "type": "string"
        },
        "password": {
          "format": "password",
          "title": "Password",
          "type": "string",
          "writeOnly": true
        },
        "project_id": {
          "description": "The project the call is about.",
          "minLength": 1,
          "title": "Project Id",
          "type": "string"
        }
      },
      "required": [
        "action",
        "project_id",
        "app_id",
        "email",
        "password"
      ],
      "title": "SetupCreateAccountCall",
      "type": "object"
    },
    "SetupCreateAppCall": {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "create_app",
          "title": "Action",
          "type": "string"
        },
        "name": {
          "minLength": 1,
          "title": "Name",
          "type": "string"
        },
        "platform": {
          "$ref": "#/$defs/ExecutionPlatform"
        },
        "project_id": {
          "description": "The project the call is about.",
          "minLength": 1,
          "title": "Project Id",
          "type": "string"
        },
        "url": {
          "anyOf": [
            {
              "minLength": 1,
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Url"
        }
      },
      "required": [
        "action",
        "project_id",
        "name",
        "platform"
      ],
      "title": "SetupCreateAppCall",
      "type": "object"
    },
    "SetupCreateBuildUploadUrlCall": {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "create_build_upload_url",
          "title": "Action",
          "type": "string"
        },
        "app_id": {
          "minLength": 1,
          "title": "App Id",
          "type": "string"
        },
        "content_type": {
          "minLength": 1,
          "title": "Content Type",
          "type": "string"
        },
        "filename": {
          "minLength": 1,
          "title": "Filename",
          "type": "string"
        },
        "project_id": {
          "description": "The project the call is about.",
          "minLength": 1,
          "title": "Project Id",
          "type": "string"
        }
      },
      "required": [
        "action",
        "project_id",
        "app_id",
        "filename",
        "content_type"
      ],
      "title": "SetupCreateBuildUploadUrlCall",
      "type": "object"
    },
    "SetupCreateProjectCall": {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "create_project",
          "title": "Action",
          "type": "string"
        },
        "name": {
          "minLength": 1,
          "title": "Name",
          "type": "string"
        },
        "target_kind": {
          "$ref": "#/$defs/TargetKind"
        }
      },
      "required": [
        "action",
        "name",
        "target_kind"
      ],
      "title": "SetupCreateProjectCall",
      "type": "object"
    },
    "SetupFinalizeBuildCall": {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "finalize_build",
          "title": "Action",
          "type": "string"
        },
        "app_id": {
          "minLength": 1,
          "title": "App Id",
          "type": "string"
        },
        "app_package": {
          "default": "",
          "title": "App Package",
          "type": "string"
        },
        "object_key": {
          "minLength": 1,
          "title": "Object Key",
          "type": "string"
        },
        "project_id": {
          "description": "The project the call is about.",
          "minLength": 1,
          "title": "Project Id",
          "type": "string"
        }
      },
      "required": [
        "action",
        "project_id",
        "app_id",
        "object_key"
      ],
      "title": "SetupFinalizeBuildCall",
      "type": "object"
    },
    "SetupListAccountsCall": {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "list_accounts",
          "title": "Action",
          "type": "string"
        },
        "app_id": {
          "anyOf": [
            {
              "minLength": 1,
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "App Id"
        },
        "project_id": {
          "description": "The project the call is about.",
          "minLength": 1,
          "title": "Project Id",
          "type": "string"
        }
      },
      "required": [
        "action",
        "project_id"
      ],
      "title": "SetupListAccountsCall",
      "type": "object"
    },
    "SetupListAppsCall": {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "list_apps",
          "title": "Action",
          "type": "string"
        },
        "project_id": {
          "description": "The project the call is about.",
          "minLength": 1,
          "title": "Project Id",
          "type": "string"
        }
      },
      "required": [
        "action",
        "project_id"
      ],
      "title": "SetupListAppsCall",
      "type": "object"
    },
    "SetupListBuildsCall": {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "list_builds",
          "title": "Action",
          "type": "string"
        },
        "app_id": {
          "minLength": 1,
          "title": "App Id",
          "type": "string"
        },
        "project_id": {
          "description": "The project the call is about.",
          "minLength": 1,
          "title": "Project Id",
          "type": "string"
        }
      },
      "required": [
        "action",
        "project_id",
        "app_id"
      ],
      "title": "SetupListBuildsCall",
      "type": "object"
    },
    "SetupListDevicesCall": {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "list_devices",
          "title": "Action",
          "type": "string"
        },
        "project_id": {
          "description": "The project the call is about.",
          "minLength": 1,
          "title": "Project Id",
          "type": "string"
        }
      },
      "required": [
        "action",
        "project_id"
      ],
      "title": "SetupListDevicesCall",
      "type": "object"
    },
    "SetupListProjectsCall": {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "list_projects",
          "title": "Action",
          "type": "string"
        }
      },
      "required": [
        "action"
      ],
      "title": "SetupListProjectsCall",
      "type": "object"
    },
    "SetupUploadBuildCall": {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "upload_build",
          "title": "Action",
          "type": "string"
        },
        "apk_path": {
          "minLength": 1,
          "title": "Apk Path",
          "type": "string"
        },
        "app_id": {
          "minLength": 1,
          "title": "App Id",
          "type": "string"
        },
        "app_package": {
          "default": "",
          "title": "App Package",
          "type": "string"
        },
        "project_id": {
          "description": "The project the call is about.",
          "minLength": 1,
          "title": "Project Id",
          "type": "string"
        }
      },
      "required": [
        "action",
        "project_id",
        "app_id",
        "apk_path"
      ],
      "title": "SetupUploadBuildCall",
      "type": "object"
    },
    "SetupWhoamiCall": {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "whoami",
          "title": "Action",
          "type": "string"
        }
      },
      "required": [
        "action"
      ],
      "title": "SetupWhoamiCall",
      "type": "object"
    },
    "TargetKind": {
      "description": "What a project tests — a mobile app or a website. The domain/wire ``Project.target_kind``\nis a ``Literal[\"mobile\", \"web\"]``; this is its centralized enum form that drives the\nCHECK-constrained ``talotrace_projects.target_kind`` column (the drift-guard test asserts the\ntwo agree).",
      "enum": [
        "mobile",
        "web"
      ],
      "title": "TargetKind",
      "type": "string"
    }
  },
  "discriminator": {
    "mapping": {
      "create_account": "#/$defs/SetupCreateAccountCall",
      "create_app": "#/$defs/SetupCreateAppCall",
      "create_build_upload_url": "#/$defs/SetupCreateBuildUploadUrlCall",
      "create_project": "#/$defs/SetupCreateProjectCall",
      "finalize_build": "#/$defs/SetupFinalizeBuildCall",
      "list_accounts": "#/$defs/SetupListAccountsCall",
      "list_apps": "#/$defs/SetupListAppsCall",
      "list_builds": "#/$defs/SetupListBuildsCall",
      "list_devices": "#/$defs/SetupListDevicesCall",
      "list_projects": "#/$defs/SetupListProjectsCall",
      "upload_build": "#/$defs/SetupUploadBuildCall",
      "whoami": "#/$defs/SetupWhoamiCall"
    },
    "propertyName": "action"
  },
  "oneOf": [
    {
      "$ref": "#/$defs/SetupWhoamiCall"
    },
    {
      "$ref": "#/$defs/SetupListProjectsCall"
    },
    {
      "$ref": "#/$defs/SetupCreateProjectCall"
    },
    {
      "$ref": "#/$defs/SetupListAppsCall"
    },
    {
      "$ref": "#/$defs/SetupCreateAppCall"
    },
    {
      "$ref": "#/$defs/SetupListDevicesCall"
    },
    {
      "$ref": "#/$defs/SetupListAccountsCall"
    },
    {
      "$ref": "#/$defs/SetupCreateAccountCall"
    },
    {
      "$ref": "#/$defs/SetupListBuildsCall"
    },
    {
      "$ref": "#/$defs/SetupUploadBuildCall"
    },
    {
      "$ref": "#/$defs/SetupCreateBuildUploadUrlCall"
    },
    {
      "$ref": "#/$defs/SetupFinalizeBuildCall"
    }
  ],
  "type": "object"
}
```