Skip to main content
Glama

batchStoreMemory

Persist multiple memories in one atomic SQLite transaction to reduce per-insert fsync overhead during session-end batch writes.

Instructions

Persist multiple memory units in a single atomic SQLite transaction. Significantly faster than calling storeMemory repeatedly for session-end writes of 10-20 memories.

WHEN TO CALL: At session end or whenever you have multiple memories to store at once. Reduces overhead from per-insert fsync by wrapping all writes in one transaction.

WHEN NOT TO CALL: For a single memory — use storeMemory instead. For imports from external files — use importMemories.

Each item in the memories array follows the same schema as storeMemory (memoryId, sessionId, sourceAdapter, kind, content, importance). Invalid items are reported individually; valid items are still stored atomically.

NOTE: the per-item memory echoed back in the response has its content truncated to 2000 characters (a batch can return many rows). The full body is still persisted — fetch it with getMemory if you need the complete text. (Single-record storeMemory echoes the full content.)

Input Schema

NameRequiredDescriptionDefault
memoriesYesArray of memory objects to store. Each must include: memoryId (unique UUID), sessionId, sourceAdapter, kind, content (self-contained text), importance (1-10). Minimum 1 item, maximum 100. Per-item results may include `warningCodes` (e.g. 'session_write_limit_warning', 'redaction_partial_failure') — advisory signals, not failures.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv1.10.0
    • addedInput schema / properties / memories / items / properties / scope
      Added value: +{
      +  "anyOf": [
      +    {
      +      "maxLength": 160,
      +      "minLength": 1,
      +      "pattern": "^[^\\x00-\\x1f\\x7f]+$",
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ]
      +}
    • addedInput schema / properties / memories / items / properties / workingDirectory
      Added value: +{
      +  "maxLength": 4096,
      +  "minLength": 1,
      +  "type": "string"
      +}
  2. Changed3 schema fields changedv1.6.0
    • addedInput schema / properties / memories / items / properties / expiresAt
      Added value: +{
      +  "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
      +  "type": "string"
      +}
    • addedInput schema / properties / memories / items / properties / tags
      Added value: +{
      +  "items": {
      +    "maxLength": 50,
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  "maxItems": 10,
      +  "type": "array"
      +}
    • changedInput schema / properties / memories / items / required
      Previous value: -[
      -  "memoryId",
      -  "sessionId",
      -  "sourceAdapter",
      -  "content",
      -  "importance"
      -]New value: +[
      +  "memoryId",
      +  "sessionId",
      +  "sourceAdapter",
      +  "kind",
      +  "content",
      +  "importance"
      +]
  3. Changed10 schema fields changedv1.1.2
    • changedInput schema / properties / memories / description
      Previous value: -"Array of memory objects to store. Each must include: memoryId (unique UUID), sessionId, sourceAdapter, kind, content (self-contained text), importance (1-10). Minimum 1 item."New value: +"Array of memory objects to store. Each must include: memoryId (unique UUID), sessionId, sourceAdapter, kind, content (self-contained text), importance (1-10). Minimum 1 item, maximum 100.\n\nPer-item results may include `warningCodes` (e.g. 'session_write_limit_warning', 'redaction_partial_failure') — advisory signals, not failures."
    • addedInput schema / properties / memories / items / properties / content / maxLength
      Added value: +10000
    • addedInput schema / properties / memories / items / properties / kind / enum
      Added value: +[
      +  "decision",
      +  "fact",
      +  "warning",
      +  "preference",
      +  "summary"
      +]
    • removedInput schema / properties / memories / items / properties / kind / minLength
      Removed value: -1
    • addedInput schema / properties / memories / items / properties / memoryId / maxLength
      Added value: +200
    • addedInput schema / properties / memories / items / properties / sessionId / maxLength
      Added value: +200
    • addedInput schema / properties / memories / items / properties / sourceAdapter / maxLength
      Added value: +100
    • addedInput schema / properties / memories / items / properties / sourceAdapter / pattern
      Added value: +"^[^\\n\\r\\x00-\\x08\\x0e-\\x1f\\x7f]*$"
    • changedInput schema / properties / memories / items / required
      Previous value: -[
      -  "memoryId",
      -  "sessionId",
      -  "sourceAdapter",
      -  "kind",
      -  "content",
      -  "importance"
      -]New value: +[
      +  "memoryId",
      +  "sessionId",
      +  "sourceAdapter",
      +  "content",
      +  "importance"
      +]
    • addedInput schema / properties / memories / maxItems
      Added value: +100
  4. Addedv1.0.6

TDQS

A4.2/5.0
Behavior3/5

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

The description adds meaningful context beyond the annotations (idempotentHint=false, destructiveHint=false): atomic wrapping, per-insert fsync savings, per-item partial success where invalid items are reported but valid items still commit, and 2000-char content truncation in the echoed response with a pointer to getMemory. That is rich disclosure. However, the interaction between 'atomic' and 'valid items are still stored' is ambiguous, and it doesn't state duplicate-memoryId behavior despite declaring non-idempotency.

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 WHEN/WITHOUT/NOTE blocks that make scanning easy. Minor redundancy: 'Significantly faster than calling storeMemory repeatedly' and 'Reduces overhead from per-insert fsync' say the same thing twice.

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?

There is no output schema, so the description carries the return-value burden and does so: per-item error reporting, warningCodes semantics, and content truncation with a recovery path via getMemory. Nothing essential for correct invocation 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% and the primary parameter additionally carries its own inline description with required fields and warningCodes. The prose mostly restates that structure and points to storeMemory's schema, so this is the baseline case where the schema does the heavy lifting.

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 ('Persist multiple memory units in a single atomic SQLite transaction') and immediately scopes it against siblings: not storeMemory for singles, not importMemories for file imports. An agent can pick this over the 14 siblings without opening a 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?

Has explicit WHEN TO CALL (session end, 10-20 memories at once) and WHEN NOT TO CALL sections that name the two alternative tools and the condition selecting each. No inference required.

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