# absence_save

Create / update / delete an absence

## Beschreibung

Files (or updates, or deletes) an absence row for a user
— vacation, unpaid_leave, or sickness. Pass `id` to update;
add `delete: true` to remove instead. Same role-scoped rules
as the web UI:

  - admin / employer: any user, any date.
  - member: only their own rows; sick limited to a
    1-day retro cap.

`unpaid_leave` (ENG-1392) uses the same lifecycle as vacation
(planned; no retroactive cap) but records the day as off-book
for payroll — distinct from paid vacation.

Bank holidays live in the web UI; no MCP tool for them
in this iteration.

## Zugriff

Zugriffsprofil: `gated`. Module: `timeclock`.
Die Freigabe im Profil ersetzt keine Account-, Workspace- oder Rollenberechtigung.

## Parameter

| Name | Typ | Pflicht | Beschreibung |
| --- | --- | --- | --- |
| `account_id` | string | Ja | Account prefix ID (acct_…). |
| `id` | string | Nein | Absence prefix ID (abs_…). Omit to create. |
| `user_id` | string | Nein | User prefix (user_…) or @handle. Defaults to the caller for plain members; required to specify a different user for admin / employer. |
| `type` | string | Nein | Required on create. `unpaid_leave` shares vacation's lifecycle (no retroactive cap). |
| `start_date` | string | Nein | ISO date YYYY-MM-DD. Required on create. |
| `end_date` | string | Nein | ISO date YYYY-MM-DD. Defaults to `start_date` if omitted on create. |
| `half_day` | boolean | Nein |  |
| `note` | string / null | Nein |  |
| `delete` | boolean | Nein | When true and `id` is present, delete the row. Mutually exclusive with field updates. |

## Eingabeschema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "account_id": {
      "type": "string",
      "description": "Account prefix ID (acct_…)."
    },
    "id": {
      "type": "string",
      "description": "Absence prefix ID (abs_…). Omit to create."
    },
    "user_id": {
      "type": "string",
      "description": "User prefix (user_…) or @handle. Defaults to the caller for plain members; required to specify a different user for admin / employer."
    },
    "type": {
      "type": "string",
      "enum": [
        "vacation",
        "sick",
        "unpaid_leave"
      ],
      "description": "Required on create. `unpaid_leave` shares vacation's lifecycle (no retroactive cap)."
    },
    "start_date": {
      "type": "string",
      "description": "ISO date YYYY-MM-DD. Required on create."
    },
    "end_date": {
      "type": "string",
      "description": "ISO date YYYY-MM-DD. Defaults to `start_date` if omitted on create."
    },
    "half_day": {
      "type": "boolean"
    },
    "note": {
      "type": [
        "string",
        "null"
      ]
    },
    "delete": {
      "type": "boolean",
      "description": "When true and `id` is present, delete the row. Mutually exclusive with field updates."
    }
  },
  "required": [
    "account_id"
  ],
  "type": "object"
}
```

## Ausgabeschema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "absence": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "type": {
          "type": "string"
        },
        "user": {
          "type": "object"
        },
        "start_date": {
          "type": "string"
        },
        "end_date": {
          "type": "string"
        },
        "half_day": {
          "type": "boolean"
        },
        "note": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "deleted": {
      "type": "boolean",
      "description": "True when the row was deleted."
    }
  },
  "type": "object"
}
```
