Skip to main content
Glama

Purge records older than N days (retention)

purge_expired
DestructiveIdempotent

Permanently deletes records older than the specified retention window for a user and space; optional flags extend purges to tenant-wide decisions and receipts or deployment-wide audit logs.

Instructions

Retention / storage-limitation (GDPR Art. 5(1)(e)): permanently delete records written more than older_than_days ago. Statements are scoped to the user/space. The optional flags extend the same window to the append-only tables — NOTE these are not per-user: include_decisions and include_receipts purge those tables for your whole tenant, and include_audit purges the audit log from the head of the chain (a signed retention anchor keeps the remaining chain verifiable). There is one chain per deployment, shared by every tenant, so include_audit is DEPLOYMENT-WIDE and only the deployment operator may use it.

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": {
      "older_than_days": "<older_than_days>"
    },
    "name": "purge_expired"
  }
}

Input Schema

NameRequiredDescriptionDefault
run_idNo
user_idNodefault
agent_idNo
include_auditNo
older_than_daysYes
include_receiptsNo
include_decisionsNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.11.0

TDQS

A3.9/5.0
Behavior3/5

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

The annotations already declare destructiveHint=true, idempotentHint=true and readOnlyHint=false, so the safety profile is partly pre-supplied. The description still adds substantive behavior the annotations cannot convey: which tables are affected, that `include_decisions`/`include_receipts` hit the whole tenant rather than one user, that `include_audit` is deployment-wide, and that a signed retention anchor keeps the remaining chain verifiable.

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 action and its window parameter, then escalates to the riskier optional flags — good ordering for a destructive tool. Minor waste: the parenthetical legal citation and the repeated 'DEPLOYMENT-WIDE' framing after the chain-per-deployment sentence restate what was just said.

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?

An output schema exists, so return values need not be described, and the highest-risk behaviors (tenant-wide and deployment-wide purges, operator-only constraint, non-reversibility by implication of 'permanently') are covered. Remaining gaps are the semantics of `run_id`/`agent_id` and confirmation of whether the result reports how many records were purged.

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 0%, so the description has to carry all parameter meaning; it covers `older_than_days` and all three boolean flags with real blast-radius detail. It leaves `run_id`, `user_id` and `agent_id` essentially unexplained beyond an implied 'scoped to the user/space', which is a meaningful gap at 0% coverage.

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 ('permanently delete records'), the exact selection criterion ('written more than `older_than_days` ago'), and the scope ('scoped to the user/space'), which separates it from the generic `delete`/`forget` siblings. An agent can tell this is a time-windowed retention purge rather than a targeted record deletion without opening the schema.

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

Usage Guidelines4/5

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

Frames the use case explicitly (retention / storage limitation, GDPR Art. 5(1)(e)) and adds a hard authorization rule: `include_audit` is deployment-wide and only the deployment operator may use it. It does not name an alternative for the narrow single-record case (e.g. `delete`/`forget`), leaving that routing to inference.

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