← capabilitiescrm.write

create_deal

crm.create_deal · v0.1.0

Create a new deal in the CRM sales pipeline under an existing contact.

Semantics

Creates a Deal row linked to the contact, with title, estimated value (optional), and starting in stage `new`. Subsequent stage transitions (`qualifying`, `proposal`, `won`, `lost`) are owner-driven and not exposed via this capability.

Invariants

  • The contact must exist. If contact_email is not found, returns `unknown_contact` with the same wrong-tenant hint mechanism as `log_activity`.
  • Deal title is required.
  • If estimated_value_cents is provided, currency must be provided too.

When to use

When the user is starting to pursue a sale with a known contact — after `find_contact` or `create_contact`. Tracks the opportunity in the CRM pipeline so the owner can move it through stages.

Input schema

{
  "type": "object",
  "required": [
    "contact_email",
    "title"
  ],
  "properties": {
    "title": {
      "type": "string",
      "maxLength": 200,
      "minLength": 1
    },
    "currency": {
      "type": "string",
      "description": "ISO 4217. Required if estimated_value_cents is provided."
    },
    "description": {
      "type": "string",
      "maxLength": 5000
    },
    "agent_vendor": {
      "type": "string"
    },
    "contact_email": {
      "type": "string",
      "format": "email"
    },
    "expected_close_date": {
      "type": "string",
      "format": "date"
    },
    "estimated_value_cents": {
      "type": "number",
      "minimum": 0
    }
  },
  "additionalProperties": false
}

Output schema

{
  "type": "object",
  "required": [
    "ok"
  ],
  "properties": {
    "ok": {
      "type": "boolean"
    },
    "error": {
      "enum": [
        "unknown_contact",
        "wrong_tenant",
        "invalid_input"
      ],
      "type": "string"
    },
    "stage": {
      "enum": [
        "new",
        "qualifying",
        "proposal",
        "won",
        "lost"
      ],
      "type": "string"
    },
    "deal_id": {
      "type": "string"
    },
    "contact_id": {
      "type": "string"
    }
  }
}

Recent conformance runs

passprovidertestmswhen
crm:design-shop-austinrejects_unknown_contact17305-18 19:51
crm:design-shop-austinhappy_path21905-18 19:51
crm:dental-pro-pdxrejects_unknown_contact18105-18 19:51
crm:dental-pro-pdxhappy_path23205-18 19:51
crm:acme-consulting-brooklynrejects_unknown_contact15505-18 19:51
crm:acme-consulting-brooklynhappy_path149405-18 19:51