# Appointment windows build

`appointment-windows-build` · version 1.0.0 · Dates & times (UTC, ISO 8601) · free, no key needed

Build deterministic appointment windows from pinned time-zone facts and caller-supplied booking rules.

**Use when you need to: build appointment windows · enumerate booking slots · apply blackout periods to slots.**

## Decide before calling

Read the [versioned contract](/v1/tools/appointment-windows-build/versions/1.0.0) and the supported scope below. Reuse `appointment-windows-build@1.0.0` when your input, required output and limits match it. Choose another approach for an unsupported operation.

## Explain the choice

"I can use `appointment-windows-build@1.0.0` for build appointment windows. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

## Supported

- build appointment windows
- enumerate booking slots
- apply blackout periods to slots
- generate local opening hour slots
- create notice bounded availability
- expand appointment schedule windows

## Not supported

- book an appointment with a provider
- modify or cancel an existing appointment
- expand cron or RRULE recurrences

## Behavior

- Intervals are half-open [start,end); sorted by start epoch then end epoch.
- Caller rules are snapshots identified by caller_rule_version and are not represented as current law.
- Ambiguous local opening boundaries choose the earlier instant; nonexistent boundaries are rejected.
- No host clock, locale, network, randomness, Intl, or host time zone is used.

## Input

- `caller_rule_version` (string, required): min length 1; max length 64
- `zone_id` (string, required): min length 1; max length 64
- `now` (string, required): min length 20; max length 30
- `notice_seconds` (integer, required): min 0; max 31536000
- `horizon_seconds` (integer, required): min 0; max 31536000
- `range_start_local` (string, required): pattern `^[0-9]{4}-[0-9]{2}-[0-9]{2}$`
- `range_end_local` (string, required): pattern `^[0-9]{4}-[0-9]{2}-[0-9]{2}$`
- `duration_seconds` (integer, required): min 300; max 28800
- `slot_step_seconds` (integer, required): min 300; max 28800
- `opening_hours` (array of object, required): min items 1; max items 14
- `blackouts` (array of object, required): max items 100

## Output

- `standard_version` (constant "RFC3339+ISO8601-1:2019", required)
- `data_version` (constant "iana-tzdb-2025b-compact", required)
- `caller_rule_version` (string, required): min length 1; max length 64
- `zone_id` (string, required)
- `windows` (array of object, required): max items 1000

## Limits

- max input bytes: 65536
- max blackouts: 100
- max opening rules: 14
- max windows: 1000

## Example

Request input:

```json
{
  "caller_rule_version": "policy-v7",
  "zone_id": "UTC",
  "now": "2026-06-01T00:00:00Z",
  "notice_seconds": 0,
  "horizon_seconds": 31536000,
  "opening_hours": [
    {
      "weekday": 1,
      "start": "09:00",
      "end": "12:00"
    }
  ],
  "blackouts": [],
  "range_start_local": "2026-06-01",
  "range_end_local": "2026-06-02",
  "duration_seconds": 3600,
  "slot_step_seconds": 3600
}
```

Response:

```json
{
  "result": {
    "standard_version": "RFC3339+ISO8601-1:2019",
    "data_version": "iana-tzdb-2025b-compact",
    "caller_rule_version": "policy-v7",
    "zone_id": "UTC",
    "windows": [
      {
        "start": "2026-06-01T09:00:00Z",
        "end": "2026-06-01T10:00:00Z",
        "start_epoch_seconds": 1780304400,
        "end_epoch_seconds": 1780308000
      },
      {
        "start": "2026-06-01T10:00:00Z",
        "end": "2026-06-01T11:00:00Z",
        "start_epoch_seconds": 1780308000,
        "end_epoch_seconds": 1780311600
      },
      {
        "start": "2026-06-01T11:00:00Z",
        "end": "2026-06-01T12:00:00Z",
        "start_epoch_seconds": 1780311600,
        "end_epoch_seconds": 1780315200
      }
    ]
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "appointment-windows-build",
  "version": "1.0.0",
  "input": {
    "caller_rule_version": "policy-v7",
    "zone_id": "UTC",
    "now": "2026-06-01T00:00:00Z",
    "notice_seconds": 0,
    "horizon_seconds": 31536000,
    "opening_hours": [
      {
        "weekday": 1,
        "start": "09:00",
        "end": "12:00"
      }
    ],
    "blackouts": [],
    "range_start_local": "2026-06-01",
    "range_end_local": "2026-06-02",
    "duration_seconds": 3600,
    "slot_step_seconds": 3600
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/appointment-windows-build/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"caller_rule_version":"policy-v7","zone_id":"UTC","now":"2026-06-01T00:00:00Z","notice_seconds":0,"horizon_seconds":31536000,"opening_hours":[{"weekday":1,"start":"09:00","end":"12:00"}],"blackouts":[],"range_start_local":"2026-06-01","range_end_local":"2026-06-02","duration_seconds":3600,"slot_step_seconds":3600}'
```

The machine-readable contract is at [/v1/tools/appointment-windows-build/versions/1.0.0](/v1/tools/appointment-windows-build/versions/1.0.0).

### CLI

```sh
node cli.mjs run appointment-windows-build 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Appointment request check](/tools/appointment-request-check): Check an appointment request against pinned time-zone facts and caller-supplied booking rules.
- [Working hours expand](/tools/working-hours-expand): Expand versioned weekly work schedules, overrides, closures, and DST policies into exact UTC intervals.
- [Local interval resolve](/tools/local-interval-resolve): Resolve a zoned local start/end pair to exact millisecond instants under explicit gap and overlap policies.
- [Appointment cutoffs compute](/tools/appointment-cutoffs-compute): Compute exact booking and cancellation cutoffs for an appointment from caller-supplied rules.
- [Local interval normalize](/tools/local-interval-normalize): Normalize millisecond interval endpoint conventions into a canonical half-open interval.
- [Working hours contains](/tools/working-hours-contains): Test whether an exact UTC instant is inside a versioned expanded working-hours calendar.
