Skip to main content
Glama

Memoria — Deterministic AI Memory & Code Intelligence MCP

Batch Encode Memories

batch_encode

Store multiple memories atomically in one request (consumes max(1, memories.length) Write API calls; non-idempotent) and return { ids, encoded }. Validates every item namespace before writing so any reserved "org:" prefix aborts the entire batch cleanly; items inherit top-level namespace and default to type="episodic" and salience=0.5. Use when checkpointing or importing 2+ memories together; use encode_memory instead for a single memory write.

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": {
      "memories": "<memories>"
    },
    "name": "batch_encode"
  }
}

Input Schema

NameRequiredDescriptionDefault
memoriesYesNon-empty array of memory objects ({ content, type?, salience?, namespace?, context? }).
namespaceNoFallback logical workspace namespace applied to batch items that omit namespace.

Output Schema

NameRequiredDescriptionDefault
idsYesCreated memory UUIDs in input order.
encodedYesTotal number of memories stored.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • changedInput schema / properties / memories / description
      Previous value: -"Array of memory objects ({ content, type, salience, namespace, context })."New value: +"Non-empty array of memory objects ({ content, type?, salience?, namespace?, context? })."
    • addedInput schema / properties / memories / items
      Added value: +{
      +  "properties": {
      +    "content": {
      +      "description": "Memory text to persist.",
      +      "type": "string"
      +    },
      +    "context": {
      +      "description": "Optional [key, value] metadata pairs.",
      +      "items": {
      +        "items": {
      +          "type": "string"
      +        },
      +        "type": "array"
      +      },
      +      "type": "array"
      +    },
      +    "namespace": {
      +      "description": "Optional per-item logical namespace override (never prefix with \"org:\").",
      +      "type": "string"
      +    },
      +    "salience": {
      +      "default": 0.5,
      +      "description": "Importance weight from 0.0 to 1.0.",
      +      "maximum": 1,
      +      "minimum": 0,
      +      "type": "number"
      +    },
      +    "type": {
      +      "default": "episodic",
      +      "description": "Memory tier classification.",
      +      "enum": [
      +        "episodic",
      +        "semantic",
      +        "buffer",
      +        "core"
      +      ],
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "content"
      +  ],
      +  "type": "object"
      +}
    • changedInput schema / properties / namespace / description
      Previous value: -"Default workspace namespace for items in the batch."New value: +"Fallback logical workspace namespace applied to batch items that omit namespace."
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "encoded": {
      +      "description": "Total number of memories stored.",
      +      "type": "integer"
      +    },
      +    "ids": {
      +      "description": "Created memory UUIDs in input order.",
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    }
      +  },
      +  "required": [
      +    "ids",
      +    "encoded"
      +  ],
      +  "type": "object"
      +}
  2. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already declare a non-readonly, non-idempotent write, and the description goes well beyond that: it discloses the write-cost model (max(1, memories.length) API calls), all-or-nothing validation semantics where one reserved "org:" prefix aborts the whole batch, and the applied defaults for type and salience. These are exactly the failure-mode and cost details an agent needs before committing a batch.

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 core action and cost, and every clause carries information, but the first sentence is heavily parenthetical and packs three distinct facts into one line. Slightly dense packaging is the only real cost.

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?

Covers atomicity, cost, failure semantics, defaults, and routing to the single-write alternative; an output schema exists so return values need no elaboration, and it names them anyway. Nothing material an agent needs to invoke this correctly is missing.

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 100%, so defaults (type=episodic, salience=0.5) and the "org:" restriction are already documented in the schema. The description's inheritance note (items fall back to the top-level namespace) adds modestly, but most parameter meaning is duplicated rather than extended, so baseline 3 applies.

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 ("Store multiple memories atomically in one request") plus the return shape, and explicitly contrasts itself with encode_memory for the single-memory case. An agent can distinguish it from siblings like encode_memory without opening any schema.

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?

Gives an explicit positive trigger ("checkpointing or importing 2+ memories together") and names the alternative tool with the condition that selects it ("use encode_memory instead for a single memory write"). Both the when and the when-not are stated.

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.