Skip to main content
Glama

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

NameRequiredDescriptionDefault
labelNoOptional human-readable name for the hook.
to_stateNoOnly fire when the thread enters this state: open, in_review, closed or archived. Omit it to match any new state.
from_stateNoOnly fire when the thread leaves this state: open, in_review, closed or archived. Omit it to match any previous state.
handler_kindYesHow 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_idYesUUID of the workspace to register the hook in. It must be the caller's own workspace.
handler_targetYesFor 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.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv479.0.2
    • addedInput schema / properties / from_state / description
      Added value: +"Only fire when the thread leaves this state: open, in_review, closed or archived. Omit it to match any previous state."
    • addedInput schema / properties / handler_kind / description
      Added value: +"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."
    • addedInput schema / properties / handler_target / description
      Added value: +"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."
    • addedInput schema / properties / label / description
      Added value: +"Optional human-readable name for the hook."
    • addedInput schema / properties / to_state / description
      Added value: +"Only fire when the thread enters this state: open, in_review, closed or archived. Omit it to match any new state."
    • addedInput schema / properties / workspace_id / description
      Added value: +"UUID of the workspace to register the hook in. It must be the caller's own workspace."
  2. First observedv479.0.0

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations only declare it is a non-read-only, non-destructive, non-idempotent local mutation; the description goes well past that by disclosing the http signing headers, the payload fields passed to mcp_tool hooks, the fact that the response carries a signing secret list_fsm_hooks withholds, and that the hook runs with the registering token's authority. It also explains the revocation failure mode (skipped with an audit row when the token is revoked or loses workspace:admin), which is exactly the kind of lifecycle detail an agent cannot infer. Only the outbound-URL validation callback and error surface remain thin.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

It is front-loaded with the core action and then layers delivery mode, payload, secret handling, authority and lifecycle in a compact paragraph with no filler sentences. It is dense and long-ish, but every clause carries information an agent would otherwise have to discover by trial.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

There is no output schema, yet the description still tells the agent what comes back (the hook, plus the signing secret for http) and gives the exact payload an mcp_tool handler receives. Combined with the auth requirement and the revocation behavior, nothing material is missing for correct invocation of a six-parameter, security-sensitive registration tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with enums and per-field explanations for label, from_state, to_state, handler_kind and handler_target, so the baseline is 3. The description reinforces handler_target semantics (URL validation vs a tool the registering token may itself call) but adds little beyond the schema's own field text.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The opening sentence names a specific verb and resource ('Register a hook that fires when a thread ... changes state') and scopes it to matching transitions, returning the created hook. It further splits the tool's two delivery modes (http vs mcp_tool) so an agent can tell exactly what it is creating rather than confusing it with list_fsm_hooks or revoke_fsm_hook.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It states the prerequisite ('Requires workspace:admin'), names the removal alternative (revoke_fsm_hook) and the read alternative (list_fsm_hooks, which never returns the secret), and warns that each call creates a new hook rather than updating one. The handler_kind schema also rules out wasi, closing an obvious wrong-turn.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools