# prescriptio_base

Travailler la base de donnees du client (module Base de donnees) : action:"chercher" { type, q?, statut?, limit? } liste les fiches ; "creer" { type, siren|siret } cree une fiche liee au referentiel, ou { type, nom, ville } une fiche saisie hors referentiel ; "statut" { fiche_id, statut } ; "tag" { fiche_id, tag, retirer? } ; "note" { fiche_id, texte } ; "contact" { fiche_id (entreprise), prenom, nom, fonction? } rattache une personne ; "archiver" / "restaurer" { fiche_id } ; "listes" ; "liste_creer" { nom, fiche_ids? } ; "liste_ajouter" / "liste_retirer" { liste_id, fiche_ids } ; "segment" { nom, criteres:{q?,dept?,naf?,ville?,rge?} } enregistre un segment vivant depuis des filtres ; "segment_couper" { liste_id } ; "pipeline" { fiche_ids | liste_id } pousse des contacts (avec e-mail) dans le pipeline commercial. Les identifiants viennent de chercher / prescriptio_suivis.

État : implémenté ; distribution : historique uniquement ; offre payante : true ; effets : lecture et écriture possibles.

## Entrée MCP

```json
{
  "properties": {
    "action": {
      "enum": [
        "chercher",
        "creer",
        "statut",
        "tag",
        "note",
        "contact",
        "archiver",
        "restaurer",
        "listes",
        "liste_creer",
        "liste_ajouter",
        "liste_retirer",
        "segment",
        "segment_couper",
        "pipeline"
      ],
      "type": "string"
    },
    "criteres": {
      "description": "segment : q, dept (2 ou 3 caracteres), naf, ville, rge (bool), statut, tag.",
      "properties": {
        "dept": {
          "type": "string"
        },
        "naf": {
          "type": "string"
        },
        "q": {
          "type": "string"
        },
        "rge": {
          "type": "boolean"
        },
        "statut": {
          "type": "string"
        },
        "tag": {
          "type": "string"
        },
        "ville": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "fiche_id": {
      "type": "string"
    },
    "fiche_ids": {
      "items": {
        "type": "string"
      },
      "maxItems": 500,
      "type": "array"
    },
    "fonction": {
      "maxLength": 120,
      "type": "string"
    },
    "limit": {
      "maximum": 100,
      "minimum": 1,
      "type": "integer"
    },
    "liste_id": {
      "type": "string"
    },
    "nom": {
      "maxLength": 200,
      "type": "string"
    },
    "prenom": {
      "maxLength": 80,
      "type": "string"
    },
    "q": {
      "description": "chercher : mot du nom ou de la ville (sans accent).",
      "maxLength": 120,
      "type": "string"
    },
    "retirer": {
      "type": "boolean"
    },
    "siren": {
      "type": "string"
    },
    "siret": {
      "type": "string"
    },
    "statut": {
      "description": "chercher : filtre ; statut : la valeur a poser (entreprise : prospect | client | a_qualifier | concurrent ; projet : preparation | en_cours | termine ; vide pour effacer).",
      "maxLength": 40,
      "type": "string"
    },
    "tag": {
      "maxLength": 60,
      "type": "string"
    },
    "texte": {
      "maxLength": 4000,
      "type": "string"
    },
    "type": {
      "description": "chercher / creer : le type de fiche.",
      "enum": [
        "entreprise",
        "contact",
        "acheteur",
        "projet"
      ],
      "type": "string"
    },
    "ville": {
      "maxLength": 120,
      "type": "string"
    }
  },
  "required": [
    "action"
  ],
  "type": "object"
}
```

## Sortie MCP

```json
{
  "properties": {
    "action": {
      "type": "string"
    },
    "download_url": {
      "type": [
        "string",
        "null"
      ]
    },
    "fields": {
      "type": "object"
    },
    "files": {
      "items": {
        "type": "object"
      },
      "type": "array"
    },
    "ok": {
      "type": "boolean"
    },
    "page": {
      "type": [
        "integer",
        "null"
      ]
    },
    "pages_total": {
      "type": [
        "integer",
        "null"
      ]
    },
    "quota": {
      "type": "object"
    },
    "texte": {
      "description": "Contenu textuel (pièce de DCE, PV…).",
      "type": "string"
    }
  },
  "type": "object"
}
```

[Contrats externes et limites](/docs/reference/concepts.md).
