---
title: "build_campaign"
description: "Construit une campaign exécutable à partir d'une seule source, test_ids ou test_campaign_id. Lot éphémère de tests, supprimé après l'exécution."
sidebarTitle: "build_campaign"
lastUpdated: "2026-09-23"
---

> **For AI agents:** the complete documentation index is at [llms.txt](/llms.txt). Append `.md` to any page URL for its markdown version.

{/* GENERATED FILE: do not edit by hand. Regenerate with: node scripts/generate.mjs */}

Construit une campaign exécutable (un lot éphémère de tests, supprimé après l'exécution, NON sauvegardé) à partir d'exactement une source : test_ids ou test_campaign_id (pas les deux).

<Note>
  **Lecture seule · Appelle des systèmes externes.** Appel sûr : cet outil ne modifie pas les données.
</Note>

## Paramètres

| Champ | Type | Requis | Description |
| --- | --- | --- | --- |
| `name` | string | Non | Nom optionnel de la campaign |
| `product` | string | Non | Slug du produit (format : operator~product). Requis quand test_ids est utilisé avec "variants". Dérivé automatiquement de la test campaign quand test_campaign_id est utilisé. |
| `test_campaign_id` | number | Non | Identifiant de la test campaign (depuis list_test_campaigns). Exactement un parmi test_ids ou test_campaign_id est requis. Le produit est dérivé automatiquement de la test campaign. |
| `test_ids` | string | Non | Identifiants de tests séparés par des virgules (depuis list_tests). Exactement un parmi test_ids ou test_campaign_id est requis. |
| `variants` | array | Non | Épinglez un variant par groupe de variables. Chaque entrée est "5" (ID numérique de variant) ou "GroupName:VariantName" (ex. "API:Staging"). Répétable. Les variables des groupes non épinglés utilisent le variant par défaut de ce groupe. Les globales émettent toujours \{type:"global"\}. Le mélange de formes numériques et nominales est autorisé. |

## Exemple d'arguments

Arguments illustratifs qu'un agent fournit lors de l'appel de cet outil :

```json
{
  "name": "string",
  "product": "string"
}
```

## Description

```text
SOURCE: test_ids — build an ad-hoc campaign from explicit test IDs.
SOURCE: test_campaign_id — load a saved Tests campaign and produce the same campaign template (product auto-derived). To create/save a reusable pack instead, use create_test_campaign; building from a Tests campaign never modifies it.

Two distinct concepts — don't confuse them: a "Tests campaign" is the SAVED, named pack you CRUD (see list_test_campaigns); a "campaign" is the throwaway JSON you build here and pass to run_campaign.

The template includes empty variable slots. Use get_test_detail to understand what each test needs, and list_resources to find device identifiers for direct_owners. Pass the template to run_campaign with an overrides map to fill or override values.

Pin variants per group via the variants array — same shape as create_monitor. Globals always emit a "global" bucket; variables in unpinned groups use that group's default variant. IMPORTANT (test_ids source): grouped (variable-group) variables and secrets are emitted with EMPTY values and are NOT auto-bucketed — pin the variant with variants=[…] (use get_test_detail to read each variable's variable_group_id / variant_id), or run_campaign / start_execution will reject the launch as empty + unresolvable. (With test_campaign_id, buckets come from the saved campaign.)
```

## Associés

- [`create_test_campaign`](/fr/mcp/tools/test-campaigns/create_test_campaign)
- [`list_test_campaigns`](/fr/mcp/tools/test-campaigns/list_test_campaigns)
- [`run_campaign`](/fr/mcp/tools/execution/run_campaign)
- [`get_test_detail`](/fr/mcp/tools/discovery/get_test_detail)
- [`list_resources`](/fr/mcp/tools/discovery/list_resources)
- [`create_monitor`](/fr/mcp/tools/monitor-management/create_monitor)

## Et ensuite ?

<Columns cols={2}>
  <Card title="Tous les outils MCP" icon="robot" href="/fr/mcp/tools/overview">
    Parcourez la référence complète des outils par catégorie.
  </Card>
  <Card title="Connecter un client" icon="plug" href="/fr/mcp/connect">
    Configurez Claude, Cursor ou Claude Code avec le serveur.
  </Card>
</Columns>
