accepts
accepts
Declare the input contract for a machine. The accepts section defines what data a machine expects to receive when invoked. Each field has a name, type, and optional modifiers (required, default value, validation constraints). The runtime validates incoming data against this contract before execution begins.
Replaces the legacy provides > inputs syntax. The parser accepts both forms; run mashin fmt to auto-migrate.
When to use
Every machine that takes input should have an accepts section. Omit it only for machines that are triggered purely by events (via subscribes) or schedules with no parameters.
Syntax
accepts <field_name> as <type>, <modifiers> ...Field declaration
Each field follows the pattern:
<name> as <type>, <modifier1>, <modifier2>, ...Types
| Type | Description | Example |
|---|---|---|
text / string | Text value | name as text |
number | Numeric value (integer or decimal) | count as number |
integer | Integer only | age as integer |
decimal | Decimal/float | score as decimal |
boolean | True or false | active as boolean |
list | Array of values | items as list |
list of <type> | Typed list | tags as list of text |
map | Key-value object | metadata as map |
any | Any type (untyped) | data as any |
Modifiers
| Modifier | Description | Example |
|---|---|---|
is required | Field must be provided | name as text, is required |
default: <value> | Default value if not provided | limit as number, default: 10 |
description "<text>" | Human-readable description (shown in UI) | email as text, description "User email address" |
label "<text>" | Display label for the visual builder | email_id as text, label "Email" |
Validation constraints
| Constraint | Applies to | Description | Example |
|---|---|---|---|
min: <n> | number, integer | Minimum value | age as integer, min: 0 |
max: <n> | number, integer | Maximum value | age as integer, max: 150 |
min_length: <n> | text | Minimum string length | name as text, min_length: 2 |
max_length: <n> | text | Maximum string length | name as text, max_length: 100 |
format: "<fmt>" | text | Format validation | email as text, format: "email" |
pattern: "<regex>" | text | Regex pattern match | code as text, pattern: "^[A-Z]+$" |
choices: [...] | text | Allowed values (whitelist) | role as text, choices: ["admin", "user"] |
exclude: [...] | text | Disallowed values (blacklist) | status as text, exclude: ["deleted"] |
subset: [...] | list | List items must be from this set | teams as list, subset: ["eng", "design"] |
range: [lo, hi] | number | Value must be within range | score as number, range: [0.0, 1.0] |
Accessing input values
Inside steps, input fields are accessed via input.<field_name>:
compute greet {greeting: "Hello, " + input.name + "!"}Examples
Simple inputs
accepts name as text, is required age as integer active as boolean, default: trueWith validation constraints
accepts email as text, is required, format: "email" username as text, is required, min_length: 3, max_length: 20, pattern: "^[a-zA-Z0-9_]+$" age as integer, is required, min: 13, max: 150 role as text, default: "member", choices: ["member", "admin", "moderator"] score as number, range: [0.0, 1.0]With UI hints
accepts email_id as text, is required, description "Gmail message ID to process", label "Email" intent as text, is required, description "What the user wants to do with this email" max_length as integer, default: 500, description "Maximum response length in characters"Full machine with accepts
machine email_triage accepts subject as text, is required body as text, is required sender as text is_vip as boolean, default: false
responds with priority as text action as text
implements ask classify, using: "anthropic:claude-haiku-4" with task "Triage this email. Subject: ${input.subject}\nBody: ${input.body}\nVIP: ${input.is_vip}" returns priority as text action as text assuming priority: "medium" action: "review"Governance
Input validation happens before the governance interpreter runs. If a required field is missing or a constraint is violated, the machine rejects the input with a validation error. No steps execute, no governance decisions are made, and no behavioral ledger entries are created for the failed invocation.
This means accepts serves as the first line of defense: type-safe, schema-validated input that reaches the steps is guaranteed to match the declared contract.
Translations
| Language | Keyword |
|---|---|
| English | accepts |
| Spanish | acepta |
| French | accepte |
| German | akzeptiert |
| Japanese | 受け取る |
| Chinese | 接受 |
| Korean | 받는다 |
See also
- responds with - Output contract declaration
- implements - Where steps use input values
- verifies - Test cases that provide sample inputs via
given - achieves - Goal examples that define input/output pairs