Build your own functions
Publish device functions with bounded parameters, discover them through MCP, choose agent permissions and broadcast requests with separate results.
A function is something your device knows how to do: read a sensor, change a light, or update a display. openlaunch calls that function a capability in its API. You write the device code; openlaunch handles discovery, permission and delivery.
Add a function to your device adapter
Give the function a name, a short explanation, and a schema for its inputs. Include it in the manifest your adapter sends during pairing. For example, a lamp adapter can publish:
{
"name": "desk lamp",
"kind": "custom.sensor",
"capabilities": ["device.health", "light.brightness"],
"functions": [
{
"name": "light.brightness",
"title": "Set brightness",
"description": "Set this lamp's brightness from 0 to 100.",
"access": "write",
"inputSchema": {
"type": "object",
"properties": {
"value": { "type": "integer", "minimum": 0, "maximum": 100 }
},
"required": ["value"],
"additionalProperties": false
}
}
]
}
kind identifies the adapter’s device family. Use a built-in kind for a supported profile or a lower-case custom kind such as custom.sensor. Custom kinds are limited to 64 characters, start with a letter, and use lowercase letters or digits separated by single dots or hyphens. The bridge accepts custom kinds without requiring a service release. Your adapter must implement every advertised function and report its result. A manifest describes code; it does not install code or add a circuit. The Pi health profile reports health. The Linux host profile adds scoped files, named commands, system metrics, processes, network inventory and user services. The built-in Uno R4 integration implements health, LED and matrix text. Extend the Pi adapter source or Uno sketch for additional hardware behavior.
For a Node adapter, createAdapter() derives the manifest and handler map from one explicit tool declaration. It does not infer input schemas or implement hardware behavior:
import { createAdapter } from "@openlaunch/sdk";
const adapter = createAdapter({
name: "desk lamp",
kind: "custom.sensor",
tools: {
"light.brightness": {
title: "Set brightness",
description: "Set this lamp's brightness from 0 to 100.",
access: "write",
inputSchema: {
type: "object",
properties: { value: { type: "integer", minimum: 0, maximum: 100 } },
required: ["value"],
additionalProperties: false,
},
handler: async ({ value }) => setLampBrightness(value as number),
},
},
});
// Publish adapter.manifest and dispatch with adapter.handlers.
Use the exact same definition for publication and execution. Agent SDK, MCP and CLI discovery expose only currently granted built-in and custom functions and their advertised schema. The guide text can explain a verified profile, but the schema and live grant check remain authoritative.
Capability names use lowercase dot-separated segments, for example sensor.temperature or light.brightness. Inputs support booleans, bounded numbers or integers, and strings with a maximum length and optional choices. Use at most 16 named parameters and 64 functions per Home Assistant linked device, 24 per Linux device, or 16 for other kinds. String choices must be unique and fit their length bounds; integer ranges must contain at least one safely representable integer. Contradictory definitions are rejected when a device publishes them. External schema references and executable input schemas are rejected. Standard function names cannot be overridden. Capability names identify operations; they do not add implementations to your adapter.
For custom GPIO, publish a purpose-specific function with bounded inputs, such as a named output and an on/off value, then implement that operation in your device handler. A manifest does not provide arbitrary pin access; the Uno’s built-in integration has no general GPIO function.
Use it in the console
After pairing your adapter, its function appears on the device with a form based on its schema. Choose the parameters and run it. The receipt starts queued; inspect its result after the device polls.
Create an ol_agent_ API connection for the agent, or connect through OAuth. Device setup uses a separate short-lived ol_sdk_ token that cannot authenticate an agent. In each device’s Access view, grant the connection only the functions it needs when it runs in selected-functions mode; new connections and invited agent members default to an all-functions policy covering current and future workspace functions, with owner-set exclusions instead. A grant can expire or remain active until revoked. A valid agent credential by itself does not approve grants. Agents call list_functions for the current schemas and invoke_device_function to request any approved built-in or custom function. This works even when an MCP client retains the tool list it discovered before pairing or approval. Device-specific tools are also included when the client refreshes discovery. Revoking a grant blocks both invocation paths immediately. See the Device and agent SDK guide for one-command setup and the agent guide for MCP clients.
Firmware or adapter changes require a matching manifest. SDK adapters can call publishManifest(manifest) after implementing their functions. Changed manifests clear existing grants and cancel queued actions, so owners approve the updated functions before agents can use them. Requests already delivered become uncertain; publishing a manifest cannot undo a physical action. Changing a device’s kind requires a new enrollment.
Broadcast to several devices
Use Broadcast a function in the console. Choose devices, then choose a function they all publish. Each device gets its own command, permission check, expiry and receipt. A rejection on one device does not make another device’s completed action disappear.
Developers can use the SDK’s broadcast() method or POST /v1/broadcasts with deviceIds, capability, arguments, idempotencyKey and ttlSeconds. Responses contain an action or an error for each device. Retrying the same request with the same key reuses each existing action. A broadcast is not an atomic hardware operation: inspect each result.
Read the API guide and pairing rules when building a new adapter. Keep the repaired Uno’s console UART profile separate from stock firmware; see the Uno guide.
Home Assistant linked functions additionally accept bounded nested JSON objects for native service data and targets. Their MCP catalog uses stable discovery and generic invocation to avoid thousands of cached per-entity tools; every granted function remains callable.