Skip to main content
Glama

register_hook

Register a side-effect that fires when a matching secret is written, deleted, or rotated - run a shell command, POST a webhook, or send a signal to keep systems in sync.

Instructions

[hooks] Register a side-effect (shell command, HTTP webhook, or process signal) that fires automatically when a matching secret is written, deleted, or rotated. Use to keep external systems in sync (restart a service after rotation, post to Slack on delete, kick a build); prefer agent_remember for storing facts an agent should recall later, and register_hook is not the right tool for time-based scheduled rotation (use agent_scan for that). Mutates the hook registry on disk. At least one match criterion (key, keyPattern, or tag) is required — calls without any return an error. Returns JSON of the registered hook entry including its assigned id (use that id with remove_hook).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyNoTrigger only on this exact key name. Pick at most one of `key` / `keyPattern` / `tag` (or combine for stricter matching).
tagNoTrigger on any secret carrying this exact tag. Combinable with key/keyPattern as an AND filter.
urlNoRequired when type='http'. Full URL to POST a JSON body `{ id, key, scope, action, timestamp }` to (the value itself is never sent).
typeYesHook delivery mechanism. 'shell' runs a local command, 'http' POSTs JSON to a URL, 'signal' sends an OS signal to a named process.
scopeNoRestrict the hook to secrets in this scope. Omit to fire across both global and project secrets.
actionsNoWhich lifecycle actions trigger this hook. Defaults to all three.
commandNoRequired when type='shell'. The literal shell command to run; q-ring exposes the matching key as $QRING_HOOK_KEY and action as $QRING_HOOK_ACTION.
keyPatternNoTrigger on any key matching this glob pattern. Examples: 'DB_*', 'STRIPE_*'.
signalNameNoSignal name to send (e.g. 'SIGHUP', 'SIGUSR1'). Defaults to SIGHUP, which most daemons treat as 'reload config'.SIGHUP
descriptionNoFree-text human-readable description, surfaced by `list_hooks` and the dashboard.
signalTargetNoRequired when type='signal'. Either a numeric PID or a process name resolvable via `ps`.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed11 schema fields changedv0.11.7
    • changedInput schema / properties / actions / description
      Previous value: -"Which actions trigger this hook"New value: +"Which lifecycle actions trigger this hook. Defaults to all three."
    • changedInput schema / properties / command / description
      Previous value: -"Shell command to execute (for shell type)"New value: +"Required when type='shell'. The literal shell command to run; q-ring exposes the matching key as $QRING_HOOK_KEY and action as $QRING_HOOK_ACTION."
    • changedInput schema / properties / description / description
      Previous value: -"Human-readable description"New value: +"Free-text human-readable description, surfaced by `list_hooks` and the dashboard."
    • changedInput schema / properties / key / description
      Previous value: -"Trigger on exact key match"New value: +"Trigger only on this exact key name. Pick at most one of `key` / `keyPattern` / `tag` (or combine for stricter matching)."
    • changedInput schema / properties / keyPattern / description
      Previous value: -"Trigger on key glob pattern (e.g. DB_*)"New value: +"Trigger on any key matching this glob pattern. Examples: 'DB_*', 'STRIPE_*'."
    • changedInput schema / properties / scope / description
      Previous value: -"Trigger only for this scope"New value: +"Restrict the hook to secrets in this scope. Omit to fire across both global and project secrets."
    • changedInput schema / properties / signalName / description
      Previous value: -"Signal to send (for signal type)"New value: +"Signal name to send (e.g. 'SIGHUP', 'SIGUSR1'). Defaults to SIGHUP, which most daemons treat as 'reload config'."
    • changedInput schema / properties / signalTarget / description
      Previous value: -"Process name or PID (for signal type)"New value: +"Required when type='signal'. Either a numeric PID or a process name resolvable via `ps`."
    • changedInput schema / properties / tag / description
      Previous value: -"Trigger on secrets with this tag"New value: +"Trigger on any secret carrying this exact tag. Combinable with key/keyPattern as an AND filter."
    • changedInput schema / properties / type / description
      Previous value: -"Hook type"New value: +"Hook delivery mechanism. 'shell' runs a local command, 'http' POSTs JSON to a URL, 'signal' sends an OS signal to a named process."
    • changedInput schema / properties / url / description
      Previous value: -"URL to POST to (for http type)"New value: +"Required when type='http'. Full URL to POST a JSON body `{ id, key, scope, action, timestamp }` to (the value itself is never sent)."
  2. Addedv0.1.1

TDQS

A4.9/5.0
Behavior5/5

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

Goes well beyond annotations by disclosing the on-disk registry mutation, the hard precondition that at least one of key/keyPattern/tag is required or the call errors, and the return contract (JSON entry including an assigned `id` to be used with `remove_hook`). These are behaviors the readOnlyHint/idempotentHint flags alone do not convey.

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

Conciseness5/5

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

Front-loaded with purpose in the first clause, then usage, side effects, preconditions, and return shape — dense but no filler. Every sentence adds a distinct fact an invoking agent needs.

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?

For an 11-parameter mutation tool with no output schema, the description covers side effects, precondition errors, return payload contents, hook environment variables ($QRING_HOOK_KEY/$QRING_HOOK_ACTION), and the follow-up tool (remove_hook). Annotations and schema fill the remaining type/enum details.

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

Parameters4/5

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

Schema description coverage is 100%, so baseline is 3, but the description adds a cross-parameter constraint absent from the schema: at least one match criterion (key, keyPattern, or tag) is required or the call fails. It also notes the returned `id`'s purpose with `remove_hook`. Individual parameter meanings remain schema-only, so not a 5.

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?

Specific verb+resource: 'Register a side-effect (shell command, HTTP webhook, or process signal) that fires automatically when a matching secret is written, deleted, or rotated.' It explicitly distinguishes itself from siblings by naming agent_remember (fact storage) and agent_scan (scheduled rotation) as the wrong tools for those jobs.

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?

Provides concrete when-to-use scenarios ('restart a service after rotation, post to Slack on delete, kick a build'), explicit alternatives ('prefer agent_remember for storing facts'), and an exclusion ('not the right tool for time-based scheduled rotation — use agent_scan'). This is exactly the when/when-not/alternative triad.

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