# define_field

Add a custom field to companies, people or deals, or change an existing one's label, options or description.

| | |
| --- | --- |
| Group | Custom fields |
| Scope | `crm:write` |
| Who can call it | Signed-in people only. Agents don't see this tool over MCP, and calling it with an API key returns `forbidden`. People use it in the Tandem app. |
| Kind | Write. Recorded in the change history with who made it. |
| Retries | Pass `idempotency_key` (MCP) or the `Idempotency-Key` header (REST); a retry with the same key within 24 hours returns the first result. |
| Widget | Text only. |

## Parameters

| Parameter | Type | Required | Notes |
| --- | --- | --- | --- |
| `entity_type` | `company` \\| `person` \\| `deal` | yes |  |
| `label` | string | yes | max 60 characters |
| `key` | string | no | Defaults to the label in snake_case. |
| `type` | `text` \\| `number` \\| `date` \\| `boolean` \\| `select` \\| `multi_select` \\| `url` \\| `email` | yes |  |
| `options` | array of string | no | default [], max 50 items |
| `description` | string | no | max 300 characters |

## Call it over MCP

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "define_field",
    "arguments": {
      "entity_type": "company",
      "label": "…",
      "type": "text",
      "idempotency_key": "log-call-acme-2026-11-02"
    }
  }
}
```

Send it to `https://api.tandemcrm.app/mcp` (streamable HTTP). Most people never write this by hand: their agent picks the tool from its description.

## Call it over REST

```bash
curl -X POST https://api.tandemcrm.app/v1/ops/define_field \
  -H "Authorization: Bearer $TANDEM_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: log-call-acme-2026-11-02" \
  -d '{"entity_type":"company","label":"…","type":"text"}'
```

## Input schema

The JSON Schema the MCP server advertises for this tool (over MCP it also accepts `idempotency_key`):

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "entity_type": {
      "type": "string",
      "enum": [
        "company",
        "person",
        "deal"
      ]
    },
    "label": {
      "type": "string",
      "minLength": 1,
      "maxLength": 60
    },
    "key": {
      "description": "Defaults to the label in snake_case.",
      "type": "string",
      "pattern": "^[a-z][a-z0-9_]{0,39}$"
    },
    "type": {
      "type": "string",
      "enum": [
        "text",
        "number",
        "date",
        "boolean",
        "select",
        "multi_select",
        "url",
        "email"
      ]
    },
    "options": {
      "default": [],
      "maxItems": 50,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 60
      }
    },
    "description": {
      "type": "string",
      "maxLength": 300
    }
  },
  "required": [
    "entity_type",
    "label",
    "type"
  ]
}
```
