# Campaign Tools

Use the campaign tools to search campaigns and retrieve campaign support context in the workspace bound to your API key.

## Available tools

| Tool                           | Purpose                                               |
| ------------------------------ | ----------------------------------------------------- |
| `campaign_list`                | List readable campaigns in the current workspace.     |
| `campaign_find`                | Search campaigns by query and optional status.        |
| `campaign_get_summary`         | Return the main operational summary for one campaign. |
| `campaign_get_support_context` | Return support-specific context for one campaign.     |

## `campaign_list`

List readable campaigns in the current workspace.

This tool does not take any parameters.

### Response

```json
{
  "items": [
    {
      "publicId": "cp_01hj5kq4k4a2v3x7p9m8n6c2dz",
      "name": "Spring Launch",
      "status": "running",
      "isUnlimited": false,
      "startDate": "2026-03-01",
      "endDate": "2026-04-15"
    }
  ]
}
```

### Notes

* The response is capped to the first 25 readable campaigns.
* Deleted campaigns are excluded from `campaign_list`.
* Returned items use the same compact campaign reference shape as `campaign_find`.
* Results are ordered for operational triage: running first, then planned, paused, completed, and deleted last when applicable in filtered searches.

## `campaign_find`

Search campaigns by free text.

### Parameters

| Name     | Type    | Required | Description                                                 |
| -------- | ------- | -------- | ----------------------------------------------------------- |
| `query`  | String  | Yes      | Search query. Maximum length: `120`.                        |
| `status` | String  | No       | One of `active`, `paused`, `deleted`, `planned`, `running`. |
| `limit`  | Integer | No       | Result limit. Default: `10`. Maximum: `10`.                 |

### Response

```json
{
  "items": [
    {
      "publicId": "cp_01hj5kq4k4a2v3x7p9m8n6c2dz",
      "name": "Spring Launch",
      "status": "running",
      "isUnlimited": false,
      "startDate": "2026-03-01",
      "endDate": "2026-04-15"
    }
  ]
}
```

### Notes

* When no `status` filter is provided, deleted campaigns are excluded.
* The returned `status` can be `deleted`, `paused`, `planned`, `running`, or `completed`.
* `isUnlimited = true` means the campaign has no end date.

## `campaign_get_summary`

Return the main operational summary for one campaign.

### Parameters

| Name               | Type   | Required | Description                                         |
| ------------------ | ------ | -------- | --------------------------------------------------- |
| `campaignPublicId` | String | Yes      | Campaign public ID in `cp_<lowercase_ulid>` format. |

### Response

```json
{
  "publicId": "cp_01hj5kq4k4a2v3x7p9m8n6c2dz",
  "name": "Spring Launch",
  "status": "running",
  "dates": {
    "startDate": "2026-03-01",
    "endDate": "2026-04-15"
  },
  "assignments": {
    "directUsers": 25,
    "groups": 3,
    "totalUsers": 148
  },
  "flags": {
    "hasLink": true,
    "hasBanner": true,
    "hasMetadata": true,
    "isUnlimited": false,
    "hasActiveAnomalies": false
  },
  "metadata": {
    "description": "Main campaign for the spring launch.",
    "direction": "internal",
    "priority": 10,
    "activeAnomalyCount": 0
  }
}
```

## `campaign_get_support_context`

Return support-focused targeting and anomaly information for one campaign.

### Parameters

| Name               | Type   | Required | Description                                         |
| ------------------ | ------ | -------- | --------------------------------------------------- |
| `campaignPublicId` | String | Yes      | Campaign public ID in `cp_<lowercase_ulid>` format. |

### Response

```json
{
  "campaign": {
    "publicId": "cp_01hj5kq4k4a2v3x7p9m8n6c2dz",
    "name": "Spring Launch",
    "status": "running",
    "isUnlimited": false,
    "startDate": "2026-03-01",
    "endDate": "2026-04-15"
  },
  "status": "running",
  "dates": {
    "startDate": "2026-03-01",
    "endDate": "2026-04-15"
  },
  "targeting": {
    "directUsers": 25,
    "excludedUsers": 2,
    "groups": 3,
    "domains": 1,
    "contactLists": 0
  },
  "anomalies": [
    {
      "type": "missing_banner",
      "state": "active"
    }
  ],
  "operations": {
    "hasLink": true,
    "hasBanner": true,
    "isUnlimited": false,
    "priority": 10,
    "direction": "internal"
  }
}
```

### Field notes

* `anomalies` returns a compact summary of active anomalies with `type` and `state`.
* `targeting` is designed for support and operational triage, not for full targeting export.
* `operations.isUnlimited = true` means the campaign has no end date.
