Goal
Register functions withrequest_format and response_format (JSON Schema objects) so callers—including AI agents and the CLI know exactly what JSON to send and what to expect back.
Why this matters
When you register a function, the iii engine stores metadata for discovery. The built-inengine::functions::list function returns every registered function with its request_format and response_format.
- AI and automation — Agents can read that list and construct valid
payloadobjects without guessing field names or types. - CLI and scripts — The same schemas document how to build
--payloadforiii trigger. - Contracts — Formats are a machine-readable contract between your implementation and anything that triggers it.
request_format / response_format may be null, leaving callers without a structured contract.
Discover functions (and their formats) from the CLI
List everything registered on a running engine:functions array. Each entry has function_id, description, request_format, response_format, and optional metadata. For example, a state helper might look like this (trimmed):
request_format to shape the JSON you pass to trigger() or iii trigger --payload='...'. Use response_format when you need to document or validate the return shape (when present).
Register formats in your SDK
Define schemas in the way that fits each language, then register the function. The engine stores the JSON Schema (or schema-compatible object) you send.- Node / TypeScript
- Python
- Rust
Use Zod (or any library that produces JSON Schema) and pass the schema objects on registration. The Node SDK does not infer formats from TypeScript types—you set Keep one Zod schema per direction (input / output) so types and JSON Schema stay in sync via
request_format and response_format explicitly.hello-world-zod.ts
z.infer.Auto-extraction vs explicit schemas
Next steps
Trigger Functions from the CLI
Invoke any function with
iii trigger and a JSON payloadUse Functions & Triggers
Register functions, triggers, and cross-language invocation patterns