register_fsm_hook
Register a workspace hook that fires on matching thread state transitions, delivering signed HTTP JSON or an MCP tool call and returning the hook details.
Instructions
Register a hook that fires when a thread in the workspace changes state, for every matching transition, and return it. An http hook POSTs the transition as signed JSON to the target URL with X-Maidan-Event and X-Maidan-Signature headers; its response also carries the signing secret, which list_fsm_hooks never returns. An mcp_tool hook calls the named tool with workspace_id, channel_id, thread_id, actor_id, from_state and to_state. The hook runs with the registering token's authority and is skipped, with an audit row, once that token is revoked or no longer holds workspace:admin. Each call creates a new hook; remove one with revoke_fsm_hook. Requires workspace:admin.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"workspace_id": "<workspace_id>",
"handler_kind": "<handler_kind>",
"handler_target": "<handler_target>"
},
"name": "register_fsm_hook"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| label | No | Optional human-readable name for the hook. | |
| to_state | No | Only fire when the thread enters this state: open, in_review, closed or archived. Omit it to match any new state. | |
| from_state | No | Only fire when the thread leaves this state: open, in_review, closed or archived. Omit it to match any previous state. | |
| handler_kind | Yes | How the hook is delivered: http to POST to a URL, or mcp_tool to call a Maidan tool. wasi is not supported for hooks. | |
| workspace_id | Yes | UUID of the workspace to register the hook in. It must be the caller's own workspace. | |
| handler_target | Yes | For http, the destination URL, which must pass the server's outbound-URL validation. For mcp_tool, the name of the MCP tool to call, which the registering token must itself be allowed to call. |