Skip to main content
Glama

register_hook

Register side-effect hooks (shell command, HTTP webhook, or process signal) that fire automatically when matching secrets are written, deleted, or rotated, keeping external 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). shell and signal hooks registered here start DISABLED (enabled: false): they run commands or signal processes outside exec policy, so the operator must review and arm them with qring hook enable <id>. http hooks are SSRF-guarded, carry no values, and start enabled.

Input 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.8/5.0
Behavior5/5

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

Annotations only declare the generic mutation/safety profile (readOnly=false, destructive=false, idempotent=false). The description goes well beyond that: it discloses that the registry on disk is mutated, that `shell` and `signal` hooks start DISABLED and require operator arming via `qring hook enable <id>` because they run outside exec policy, and that `http` hooks are SSRF-guarded, carry no values, and start enabled — exactly the operational facts an agent needs before calling.

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?

Front-loaded with purpose, then usage/alternatives, then behavioral caveats and return value — a sensible ordering. It is dense but long for a single paragraph, and the parenthetical recovery path (`remove_hook`) slightly interrupts the flow, keeping it just short of a 5.

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 the missing pieces: the required match criterion, the per-type required fields, the disabled-by-default safety posture for `shell`/`signal`, and what the call returns. Nothing an agent needs to invoke it correctly is left out.

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 coverage is 100%, so baseline is 3, but the description adds a cross-field constraint not expressible per-property in the schema: at least one match criterion is required or the call errors. It also explains the return value's `id` and that the `id` must be reused with `remove_hook`, which the schema cannot convey.

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?

States a specific verb and resource ("Register a side-effect ... that fires automatically when a matching secret is written, deleted, or rotated") and enumerates the three delivery mechanisms. It also explicitly separates itself from `agent_remember` and `agent_scan`, so an agent can route without opening sibling schemas.

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?

Names concrete use cases (restart a service after rotation, post to Slack on delete, kick a build), names the wrong-tool alternatives with the condition that selects them (`agent_remember` for recallable facts, `agent_scan` for time-based rotation), and states a hard precondition (at least one of `key`/`keyPattern`/`tag`, otherwise an error).

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