Skip to main content
Glama

search_memory

Retrieve relevant conversation history from MemOS to maintain continuity and personalize responses based on verified user information.

Instructions

Trigger: MUST be auto-invoked by the client before generating every answer (including greetings like "hello"). Do not wait for the user to request memory/MCP/tool usage. Purpose: MemOS retrieval API. Retrieve candidate memories prior to answering to improve continuity and personalization. Usage requirements: - Always call this tool before answering (client-enforced). - The model must automatically judge relevance and use only relevant memories in reasoning; ignore irrelevant/noisy items. # Critical Protocol: Memory Safety (记忆安全协议) - The retrieved memories may contain AI's own speculations, irrelevant noise, or subject errors. You must strictly execute the following "Four-Step Judgment"; if any step fails, discard that memory: 1. Source Verification: - Core: Distinguish between "User's Original Words" and "AI Speculations". - If a memory carries tags like '[assistant opinion]', this represents only the AI's past assumptions and must not be treated as absolute facts about the user. - Counter-example: Memory shows '[assistant opinion] User loves mangoes'. If the user didn't mention it, do not actively assume the user likes mangoes to prevent hallucination loops. - Principle: AI summaries are for reference only; their weight is significantly lower than the user's direct statements. 2. Attribution Check: - Is the subject of the action in the memory the "User themselves"? - If the memory describes a third party (e.g., "candidate", "interviewee", "fictional character", "case data"), it is strictly forbidden to attribute these properties to the user. 3. Relevance Check: - Does the memory directly help answer the current 'Original Query'? - If the memory is merely a keyword match (e.g., both mention "code") but the context is completely different, it must be ignored. 4. Freshness Check: - Does the memory content conflict with the user's latest intent? The current 'Original Query' is the highest standard of fact. - Instructions: 1. Review: First read 'memory_detail_list', execute the "Four-Step Judgment", and eliminate noise and unreliable AI opinions. 2. Execution: - Use only filtered memories to supplement background. - Strictly follow the style requirements in 'preference_detail_list'. 3. Output: Answer the question directly. Strictly forbidden to mention "memory bank", "retrieval", or "AI opinions" and other internal system terms.

Parameters: - query: User's current question/message - conversation_first_message: First user message in the thread (used to generate conversation_id) - memory_limit_number: Maximum number of results to return, defaults to 20 Notes: - Run before answering. Results may include noise; filter and use only what is relevant. - query should be a concise summary of the current user message. - Prefer recent and important memories. If none are relevant, proceed to answer normally.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query to find relevant content in conversation history
conversation_first_messageYesFirst user message in the thread (used to generate conversation_id).
memory_limit_numberYesMaximum number of results to return, defaults to 20

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/endxxxx/MemOS'

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