action_classes.register

Live

Register a tenant-scoped custom action class with JSON Schema payload validation.

CategoryAction
JSON-RPCtools/call
EndpointPOST /mcp
Sourcepackages/mcp-tools/src/tools/action-classes-register.ts

Description

Namespace is locked to client_id. Enforces per-tenant quota, schema subset validation, and bumps world_version via customActionClassesHash. Per ADR-0022.

Input schema

FieldTypeRequiredDescription
namespacestringyesClient namespace (must match client_id).
namestringyesAction class name within namespace.
payload_schemaobjectyesJSON Schema 2020-12 subset (≤32KB, ≤8 levels).
allowed_modesArray<'ask'|'notify'|'silent'>yesSupported dispatch modes.
display_namestringnoHuman-readable label.
descriptionstringnoClass description.
legal_effect_classification'none'|'possible'|'always'noDefault 'possible'.

Output shape

typescript
{ ok: true; class_id: string; namespaced_name: string; world_version: string } | { ok: false; error: 'namespace_collision' | 'namespace_owned' | 'quota_exceeded' | 'schema_invalid'; message: string }

Example call

JSON-RPC tools/call request body (omit the JSON-RPC envelope when using an SDK; the SDK adds it for you):

jsontools/call params
{ "name": "action_classes.register", "arguments": { "namespace": "acme_builder", "name": "transact", "payload_schema": { "type": "object", "properties": { "amount": { "type": "number" } } }, "allowed_modes": ["ask"] } }

Example response

Tool results are always wrapped as content[0].text with a stringified JSON body. The shape below is what you get back from JSON.parse(result.content[0].text):

jsonparsed result body
{ "ok": true, "class_id": "550e8400-e29b-41d4-a716-446655440000", "namespaced_name": "acme_builder.transact", "world_version": "wv_01HXCUSTOMCL" }

Errors this tool can return

CodeMeaning
namespace_ownedaction_classes.register rejected because the namespace is owned by a different client_id within the same tenant.
quota_exceededPer-minute, daily call, or daily inference budget exceeded.
invalid_argumentsTool input failed Zod validation.
unauthorizedMissing or invalid bearer token.

See the full error catalog for resolution steps on each code, plus the standard transport-layer responses (401, 429).