Skip to main content
Glama

optimize_scan

Scan memories to plan curation: view snippets, dedup hints, domain clusters, and stats. Filter by date, domain, or type to review incremental changes.

Instructions

Dump the memory corpus compactly so you can plan a curation pass.

Step 1 of the "optimize my memories" workflow. Returns every memory's curation-relevant fields, the relation edges among them, and dedup-candidate pairs as a starting hint. Read this, then decide what to compact/reword/retag/redomain/set_confidence/archive/link/merge/ distill and stage it with optimize_stage.

The listing is slim on purpose so a few-hundred-memory store fits one response: content is a ~120-char snippet plus content_len (tags cut at ~100 with tags_len); empty/default fields are omitted (incl. confidence 'unverified' -- stats keeps the aggregate); created_at drops sub-second precision. Pass full=True for whole bodies, or fetch one with get_memory(uid) when a snippet is not enough. A page also ends early if its serialized size hits an internal budget, so one response ALWAYS fits the host's output cap. truncated: true means the listing stopped before the corpus ended -- page onward with offset = offset + count (stats.total is the whole corpus).

On a grown store, prefer INCREMENTAL curation over full-corpus passes: since limits the scan to memories created or updated at/after an ISO timestamp or date ('2026-07-01'), so a recurring "optimize my memories" only reviews the delta since the last run (optimize_runs shows when that was). Cross-window collisions are still caught: dedup_hints probe FROM the new memories against the whole store (a new memory duplicating an old one outside the window surfaces; old x old pairs are skipped), and domain_hints report any store-wide domain cluster the delta touches. Combine with domain/type to curate one slice at a time. Also included:

  • stats: totals for the whole filtered corpus (by_type, by_confidence, by_domain, empty_domain) -- computed regardless of limit,

  • domain_hints: clusters of domain-string variants that likely mean the same thing (case/separator drift, ticket-id spellings), with a suggested canonical -- ready-made redomain candidates,

  • anchors: per memory, the verifiable references found in its FULL content (URLs, file paths, table/field identifiers, constants), space-joined -- the things to go check against live facts.

Before proposing any change, CHECK IT AGAINST LIVE FACTS -- do not rewrite or archive something that was true then but stale now, and do not "correct" something that is still true:

  • cross-check newer memories already in this corpus (supersession / contradiction),

  • for code/config memories, verify the anchors against the live repo,

  • for world-facts, web-check current truth. Record what you verified in each suggestion's verified field -- destructive suggestions (archive, set_confidence=contradicted) are rejected without it.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fullNo
typeNo
limitNo
sinceNo
domainNo
offsetNo
include_archivedNo
Behavior5/5

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

No annotations are provided, so the description bears full responsibility. It thoroughly discloses behavioral traits: compact format, truncation logic, 'truncated' flag, pagination, omission of empty/default fields, precision drops, and constraints on output size. It also explains the content of the response (stats, domain_hints, anchors) and the verification workflow.

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?

The description is lengthy but well-organized, with clear sections for purpose, format, usage, parameters, and verification. Every sentence adds value, though it could be slightly more concise without losing information. The front-loading of the purpose is effective.

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?

Given the complexity (7 parameters, no output schema, many sibling tools), the description is exceptionally complete. It explains the full structure of the response, pagination behavior, and integrates workflow guidance. It even includes verification instructions for downstream actions, leaving no ambiguity.

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?

The schema has 0% coverage, but the description compensates by explaining the role of each parameter: 'full' for full bodies, 'since' for delta scans, 'domain' and 'type' for filtering, 'limit' and 'offset' for pagination. It provides concrete examples (e.g., ISO timestamp or date for 'since') and explains how parameters affect output.

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 clearly states the tool's purpose: 'Dump the memory corpus compactly so you can plan a curation pass.' It distinguishes this tool from siblings by positioning it as the first step in an 'optimize my memories' workflow and by specifying its unique output (memories, edges, dedup hints).

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?

The description provides explicit context on when to use this tool (step 1 of workflow) and when to use alternatives (e.g., fetching a single memory with get_memory). It advises on incremental curation vs full passes using the 'since' parameter. It does not explicitly list exclusions, but the context is well covered.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Filipe-Soares-de-Almeida/MemAI'

If you have feedback or need assistance with the MCP directory API, please join our Discord server