Skip to main content
Glama

agentbay_memory_recall

Search project memory using hybrid search (alias, tags, full-text, vector) with RRF fusion. Filter by memory tier, type, tags, limit, or token budget. Fast mode skips vectors for quicker results.

Instructions

Search project memory using hybrid search (alias + tag + full-text + vector) with RRF fusion. Use tokenBudget to control context size. Use fast=true to skip vectors.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesProject ID
queryYesWhat you need to remember / search for
tierNoFilter by memory tier
typeNo
tagsNo
limitNoMax entries (default 5)
tokenBudgetNoMax tokens to return
fastNoSkip vector search for speed
formatNo"context" returns compact text for LLM injection

Implementation Reference

  • src/index.ts:611-651 (registration)
    Registration and schema definition for the 'agentbay_memory_recall' tool using McpServer.server.tool(), defining the Zod schema for projectId, query, tier, type, tags, limit, tokenBudget, fast, and format parameters.
    server.tool(
      'agentbay_memory_recall',
      'Search project memory using hybrid search (alias + tag + full-text + vector) with RRF fusion. Use tokenBudget to control context size. Use fast=true to skip vectors.',
      {
        projectId: z.string().describe('Project ID'),
        query: z.string().describe('What you need to remember / search for'),
        tier: z.enum(['working', 'episodic', 'semantic', 'procedural']).optional().describe('Filter by memory tier'),
        type: z.enum(['PATTERN', 'PITFALL', 'ARCHITECTURE', 'DEPENDENCY', 'TEST_INSIGHT', 'PERFORMANCE', 'DECISION', 'CONTEXT']).optional(),
        tags: z.array(z.string()).optional(),
        limit: z.number().min(1).max(20).optional().describe('Max entries (default 5)'),
        tokenBudget: z.number().optional().describe('Max tokens to return'),
        fast: z.boolean().optional().describe('Skip vector search for speed'),
        format: z.enum(['json', 'context']).optional().describe('"context" returns compact text for LLM injection'),
      },
      async ({ projectId, query, tier, type, tags, limit, tokenBudget, fast, format }) => {
        const params = new URLSearchParams({ q: query });
        if (tier) params.set('tier', tier);
        if (type) params.set('type', type);
        if (tags?.length) params.set('tags', tags.join(','));
        if (limit) params.set('limit', String(limit));
        if (tokenBudget) params.set('tokenBudget', String(tokenBudget));
        if (fast) params.set('fast', 'true');
        if (format) params.set('format', format);
    
        const data = await apiGet(`/api/v1/projects/${projectId}/memory?${params.toString()}`);
        if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] };
    
        if (format === 'context' && typeof data === 'string') {
          return { content: [{ type: 'text' as const, text: data }] };
        }
    
        const entries = data.entries || [];
        if (!entries.length) return { content: [{ type: 'text' as const, text: 'No relevant memories found.' }] };
    
        const text = entries.map((e: any) =>
          `## ${e.title} [${e.type}/${e.tier}]\nID: ${e.id} | Confidence: ${(e.confidence * 100).toFixed(0)}% | Score: ${e.score.toFixed(4)}${e.truncated ? ' | [SUMMARIZED]' : ''}\n${e.content}${e.tags?.length ? `\nTags: ${e.tags.join(', ')}` : ''}`
        ).join('\n\n---\n\n');
    
        return { content: [{ type: 'text' as const, text: `Found ${entries.length} memories (${data.totalTokens} tokens, mode: ${data.searchMode}):\n\n${text}` }] };
      }
    );
  • Handler function that builds query params, calls the API endpoint /api/v1/projects/{projectId}/memory with hybrid search, and formats results as formatted text with title, type, tier, confidence, score, truncated flag, content, and tags.
      async ({ projectId, query, tier, type, tags, limit, tokenBudget, fast, format }) => {
        const params = new URLSearchParams({ q: query });
        if (tier) params.set('tier', tier);
        if (type) params.set('type', type);
        if (tags?.length) params.set('tags', tags.join(','));
        if (limit) params.set('limit', String(limit));
        if (tokenBudget) params.set('tokenBudget', String(tokenBudget));
        if (fast) params.set('fast', 'true');
        if (format) params.set('format', format);
    
        const data = await apiGet(`/api/v1/projects/${projectId}/memory?${params.toString()}`);
        if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] };
    
        if (format === 'context' && typeof data === 'string') {
          return { content: [{ type: 'text' as const, text: data }] };
        }
    
        const entries = data.entries || [];
        if (!entries.length) return { content: [{ type: 'text' as const, text: 'No relevant memories found.' }] };
    
        const text = entries.map((e: any) =>
          `## ${e.title} [${e.type}/${e.tier}]\nID: ${e.id} | Confidence: ${(e.confidence * 100).toFixed(0)}% | Score: ${e.score.toFixed(4)}${e.truncated ? ' | [SUMMARIZED]' : ''}\n${e.content}${e.tags?.length ? `\nTags: ${e.tags.join(', ')}` : ''}`
        ).join('\n\n---\n\n');
    
        return { content: [{ type: 'text' as const, text: `Found ${entries.length} memories (${data.totalTokens} tokens, mode: ${data.searchMode}):\n\n${text}` }] };
      }
    );
  • Helper function apiGet used by the handler to make authenticated GET requests to the AgentBay API.
    async function apiGet(path: string) {
      const res = await fetch(`${API_BASE}${path}`, { headers: getHeaders() });
      return res.json();
    }
Behavior2/5

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

No annotations provided; description lacks behavioral details beyond search method. No mention of read-only nature, permissions, rate limits, or side effects. It does clarify tokenBudget and fast parameter effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two concise sentences: first defines purpose and method, second provides two specific usage tips. No redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With 9 parameters and no output schema, description is too brief. Lacks explanation of hybrid search components, return format, or result structure, making it incomplete for full understanding.

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 78%; description adds context for tokenBudget and fast parameters but adds little beyond schema for others. No contradictions.

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?

Description clearly states 'Search project memory' with specific methods (hybrid search, RRF fusion) distinguishing it from sibling tools like store or forget.

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

Usage Guidelines3/5

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

Implies usage for searching memory but no explicit guidance on when to use this tool versus other memory tools (e.g., agentbay_knowledge_query, agentbay_memory_compact). No alternatives mentioned.

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/thomasjumper/agentbay-mcp'

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