type and objectId you pass: e.g. function + tbl_abc becomes function:tbl_abc. Returns the new routine in the same shape as clay routines get; update it later with clay routines update.
Arguments
| Argument | Description |
|---|---|
type | Routine type. One of function or workflow. Required. |
objectId | Underlying object id — a table id for function, a workflow id for workflow. Required. |
Flags
| Flag | Description |
|---|---|
--name <name> | Routine name (6–100 characters). |
--description <description> | Optional description (max 500 characters). |
--entity-type <type> | MCP entity type. One of contact or company. Required for function routines; rejected for workflow routines. |
--integrations <csv> | Integrations to expose the routine on. Comma-separated list of api, mcp, or claygent. |
Output
| Field | Type | Description |
|---|---|---|
id | string | Routine id, built as <type>:<objectId>. |
type | "function" | "workflow" | Routine type. |
name | string | Display name. |
description | string | null | Description, or null if not set. |
entityType | "contact" | "company" | MCP entity type. Omitted for workflow routines. |
access.integrations | string[] | Integrations the routine is exposed on. Each is api, mcp, or claygent. |
inputSchema | object | Input schema for the routine. Omitted when the routine has none. |
Errors
| Code | Exit | Notes |
|---|---|---|
validation_error | 2 | Invalid type, missing required flags, --entity-type on a workflow routine, or invalid integration value. |
auth_forbidden | 3 | The API key lacks the cli:all scope (or all). |

