# Mode

URL: /business/nouns/mode · Id: `noun:mode`

> A Mode is how a caller invokes a Verb: try waits and stores nothing, send returns a pending Action, do waits for the result.

A Mode is how a caller invokes a [Verb](/business/nouns/verb): try waits and stores nothing, send returns a pending [Action](/business/nouns/action), do waits for the result.

## Properties
| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | `string` | Yes | One of `try`, `send`, or `do`. |
| `durable` | `boolean` | Yes | True when the Action is stored and survives restarts: `send` and `do`. |
| `waits` | `boolean` | Yes | True when the caller holds the call open until the result: `try` and `do`. |
| `holdSeconds` | `integer` | No | For `do`: seconds a call holds before it returns `202` with the pending Action; Setting `mode.holdSeconds`. |
| `maxWaitSeconds` | `integer` | No | The longest hold `Prefer: wait=N` may ask for; Setting `mode.maxWaitSeconds`. |

## Object
```json
{
  "$id": "https://api.sb/ledgerlark.com/modes/mode_1",
  "$type": "Mode",
  "name": "try",
  "durable": true,
  "waits": true,
  "holdSeconds": 60,
  "maxWaitSeconds": 300
}
```

## Relationships
- <a id="rel-default-for"></a>A Mode **default for** many [Verbs](/business/nouns/verb): the Mode a call uses when the caller names none: `try`, `send` or `do`. `defaultFor`, inverse [`defaultsTo`](/business/nouns/verb#rel-defaults-to).
- <a id="rel-mode-of"></a>A Mode **is a mode of** many [Actions](/business/nouns/action): the Mode the caller chose: `try` stores nothing, `send` returns a pending [Action](/business/nouns/action), `do` waits for the result. `modeOf`, inverse [`runsIn`](/business/nouns/action#rel-runs-in).

## Verbs
| Verb | Description | Subject | Event | Class |
| --- | --- | --- | --- | --- |
| <a id="get"></a>[Mode.get](/business/nouns/mode/get) | Returns one Mode by id. Inherited from [Noun](/business/nouns/noun). | None. | None. | Read: `try`, `do` |
| <a id="list"></a>[Mode.list](/business/nouns/mode/list) | Returns Modes, newest first, one page at a time. Inherited from [Noun](/business/nouns/noun). | None. | None. | Read: `try`, `do` |

A Mode is kept forever and never edited: it has no `update` or `delete`.

## Permissions
Which Access level may call each Verb. One-way Verbs wait their delay window.

| Operation | `owner` | `admin` | `member` | `viewer` |
| --- | --- | --- | --- | --- |
| `Mode.get` | Yes | Yes | Yes | Yes |
| `Mode.list` | Yes | Yes | Yes | Yes |

## Call it

**Ask**

```text
Show me the latest mode.
```

**API**

```bash
curl https://api.sb/patentpad.com/modes/mode_1 \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
```

```json
{
  "api": "https://api.sb/patentpad.com",
  "$type": "Mode",
  "$id": "https://api.sb/patentpad.com/modes/mode_1",
  "mode": {
    "$id": "https://api.sb/patentpad.com/modes/mode_1",
    "$type": "Mode",
    "name": "try",
    "durable": true,
    "waits": true
  },
  "links": {
    "self": "https://api.sb/patentpad.com/modes/mode_1",
    "up": "https://api.sb/patentpad.com/modes"
  }
}
```

**SDK**

```ts
import { $ } from 'startup-builder'

const mode = await $.Mode.get({ id: 'mode_1' })
```

**CLI**

```bash
npx startup-builder do Mode.get --json '{"id":"mode_1"}'
```

**MCP**

```json
{
  "name": "do",
  "arguments": {
    "code": "return await $.Mode.get({ id: 'mode_1' })"
  }
}
```

## Example
```ts
import { $ } from 'startup-builder'

const preview = await $.try.Order.place({ offer: 'offer_1' }) // waits, stores nothing
const pending = await $.send.Order.place({ offer: 'offer_1' }) // the Action, status Pending
const order = await $.do.Order.place({ offer: 'offer_1' }) // waits for the finished Action
```