Skip to main content
Glama

Memoria — Deterministic AI Memory & Code Intelligence MCP

Delete Memories by Context

delete_by_context
DestructiveIdempotent

Permanently bulk-delete all memories whose context array contains an exact [key, value] pair (destructive, idempotent; consumes 1 Write API call) and return { deleted_count }. Scopes deletion to namespace when provided, or across all namespaces in your organization when namespace is omitted (rejecting reserved "org:" prefixes). Use to purge memories tied to a deleted file, PR, or feature tag; use forget_memory instead when deleting a single memory by UUID.

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": {
      "key": "<key>",
      "value": "<value>"
    },
    "name": "delete_by_context"
  }
}

Input Schema

NameRequiredDescriptionDefault
keyYesExact context tuple key to match (for example "file" or "pr").
valueYesExact context tuple value to match (for example "src/legacy.js").
namespaceNoOptional logical namespace filter; omit to match across the entire organization.

Output Schema

NameRequiredDescriptionDefault
deleted_countYesNumber of matching memories deleted (0 if none matched).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • changedInput schema / properties / key / description
      Previous value: -"Context metadata key to match."New value: +"Exact context tuple key to match (for example \"file\" or \"pr\")."
    • changedInput schema / properties / namespace / description
      Previous value: -"Optional workspace namespace scope."New value: +"Optional logical namespace filter; omit to match across the entire organization."
    • changedInput schema / properties / value / description
      Previous value: -"Context metadata value to match."New value: +"Exact context tuple value to match (for example \"src/legacy.js\")."
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "deleted_count": {
      +      "description": "Number of matching memories deleted (0 if none matched).",
      +      "type": "integer"
      +    }
      +  },
      +  "required": [
      +    "deleted_count"
      +  ],
      +  "type": "object"
      +}
  2. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Beyond the annotations, it discloses that deletion is permanent and bulk, that it consumes one Write API call, that it is idempotent, and that it returns { deleted_count }. It also reveals the org-wide blast radius when namespace is omitted and the reserved "org:" prefix rejection — genuinely useful context for a destructive operation.

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?

Destructiveness is front-loaded and every clause carries information, with no filler. The second sentence is dense with stacked parentheticals, which slightly reduces scanability but does not waste space.

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 a destructive bulk tool, the definition covers scope, cost, return shape, matching semantics, and the single-record alternative. With an output schema present, no further explanation of return values is required, so nothing an agent needs is missing.

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 real meaning: exact-match semantics on the [key, value] pair, and the consequence of omitting namespace (organization-wide scope). It does not elaborate on the rejected "org:" prefix rule at parameter level, keeping it just short of 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?

The description names a specific verb and resource ("permanently bulk-delete all memories whose context array contains an exact [key, value] pair") and explicitly distinguishes itself from forget_memory, which deletes one memory by UUID. The scoping rule (namespace present vs. omitted) further sharpens what the tool does.

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 gives concrete triggering scenarios ("purge memories tied to a deleted file, PR, or feature tag") and names the alternative with the condition that selects it ("use forget_memory instead when deleting a single memory by UUID"). The cross-namespace behavior when namespace is omitted is also spelled out.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.