Skip to main content
Glama

memory_hook

Destructive

Fire lifecycle events like session_started or new_message to update persistent agent memory in real time.

Instructions

Fire one external lifecycle event (session_started, new_message, ...).

Args: event: one of KNOWN_EVENTS (session_started, session_ended, new_message, auto_save_candidate, context_threshold, memory_pressure, post_context_compression). payload: event body. Recognized keys per event: session_ended: {"summary": str}; new_message/auto_save_candidate: {"text": str}; post_context_compression: {"query": str}; session_started: {"text": str?, "budget": int?}. layer: "user" (default) or "agent". user_id: subject user (bound to API key on HTTP transports). ctx: MCP context (injected).

Returns: Handler results dict; unknown event raises ValueError (MCP error).

Input Schema

NameRequiredDescriptionDefault
eventYes
layerNouser
payloadNo
user_idNodefault

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.9.0

TDQS

A4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=false, idempotentHint=false and destructiveHint=true, so the write/destructive profile is covered. The description adds genuinely new behavioral context: unknown events raise ValueError as an MCP error, user_id is bound to the API key on HTTP transports, and the handler result dict is returned. It stops short of describing side effects of firing an event (what state changes), so not a 5.

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 the purpose in the first line, then a structured Args/Returns block. The per-event payload mapping is dense but each line earns its place. Slightly long, but not padded.

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

Completeness4/5

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

A mutating, non-idempotent dispatch tool with 0% schema coverage but a rich description covering events, payload shapes, layer, user binding, and error behavior. An output schema exists, so return values need minimal explanation. Complete enough to call correctly, though it never states the concrete side effects of firing each event.

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

Parameters5/5

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

Schema coverage is 0%, so the description carries the full burden and does so well: it enumerates the KNOWN_EVENTS values for 'event', lists the recognized payload keys per event type (summary, text, query, budget), explains 'layer' as user/agent with user as default, and clarifies that user_id is the subject user bound to the API key. This is far more semantic detail than the bare schema provides.

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

Purpose4/5

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

States a specific verb ('Fire') and resource ('external lifecycle event') and enumerates the actual event names (session_started, session_ended, new_message, etc.), so an agent knows precisely what the tool does. It does not explicitly distinguish itself from the cryptic siblings (evolve, think, dream, forget, project, wake_up), which keeps it at a 4 rather than a 5.

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

Usage Guidelines3/5

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

The event enumeration implicitly signals the trigger contexts (session start/end, new message, memory pressure), but there is no explicit when-to-use versus when-not-to-use guidance and no mention of the sibling tools as alternatives. Usage is inferable but not spelled out.

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