{/* TODO: Re-link worker references to https://workers.iii.dev/workers/<name> once the Worker Docs migration ships. */}
Scanned 9/3/2026
Install to Claude Code
npx -y skills add iii-hq/iii --skill using-iii --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Using Iii?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/iii-hq-using-iii-883eff2b)More formats (shields.io, HTML) on the badges page.
<!-- generated by iii-skill-render. DO NOT EDIT (changes here are overwritten on the next render). Edit docs/0-12-0/using-iii/functions.mdx. -->
# Functions
{/* TODO: Re-link worker references to https://workers.iii.dev/workers/<name> once the Worker Docs migration ships. */}
## Invoking functions
A function runs when a trigger fires. The same function can be invoked from many trigger types at
once (direct CLI calls, an HTTP route, and a cron schedule, for example) without changing the
handler.
<Note>
Some trigger types are: [`iii trigger`](./cli), [`worker.trigger`](./triggers),
iii-http,
iii-cron,
iii-queue,
iii-state,
iii-stream.
</Note>
## Register a function
Inside a worker, `worker.registerFunction(id, handler)` makes a function callable from anywhere in
the iii system. The `id` follows the `service::name` form; the handler receives the call's payload
and returns the result.
<Tabs>
<Tab title="Node / TypeScript">
```typescript
import { registerWorker } from "iii-sdk";
const worker = registerWorker(process.env.III_URL);
worker.registerFunction("math::add", async (payload: { a: number; b: number }) => {
return { c: payload.a + payload.b };
});
```
</Tab>
<Tab title="Python">
```python
import os
from iii import register_worker, InitOptions
worker = register_worker(
os.environ.get("III_URL"),
InitOptions(worker_name="math-worker"),
)
def add_handler(payload: dict) -> dict:
return {"c": payload["a"] + payload["b"]}
worker.register_function("math::add", add_handler)
```
</Tab>
<Tab title="Rust">
```rust
use iii_sdk::{InitOptions, RegisterFunction, register_worker};
let url = std::env::var("III_URL").expect("III_URL must be set");
let worker = register_worker(&url, InitOptions::default());
worker.register_function(RegisterFunction::new("math::add", |input: AddInput| {
Ok(serde_json::json!({ "c": input.a + input.b }))
}));
```
</Tab>
</Tabs>
## Define request and response formats
Functions can carry JSON Schemas for their request payload and response shape. The schemas are
stored with the function and feed the iii console and the agent-readable skills.
<Note>
Runtime validation is not yet supported. Attached schemas are metadata only; the engine does not
reject payloads or responses that don't match. Treat the schemas as contract documentation for
callers, agents, and the console until validation lands.
</Note>
<Note>
For how to attach schemas when registering a function, see [Creating Workers /
Functions](../creating-workers/functions#attach-request-and-response-schemas).
</Note>
## Invoke a function
<Note>
For how to call a registered function from worker code or the terminal (with optional delivery
actions like fire-and-forget or queue-routed), see
[Triggers / Call a function directly](./triggers#call-a-function-directly).
</Note>
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!