Skip to main content
Glama
memstate-ai

Memstate AI - Agent Memory System

Official

memstate_search

Search agent memories by semantic meaning to find relevant information before starting tasks when exact keypaths are unknown.

Instructions

Find memories by meaning (semantic search). Use BEFORE starting tasks when you don't know the exact keypath.

USE THIS WHEN: You want to find relevant memories by topic or meaning, not by exact keypath. NOT FOR: Saving content (use memstate_remember for markdown/summaries, memstate_set for one keypath value).

memstate_search(query="how is authentication configured", project_id="myapp") memstate_search(query="database connection settings", project_id="myapp")

Returns summaries with similarity scores. Use memstate_get(memory_id="...") to fetch full content of a result.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesNatural language search query. Leave empty to explore/list all memories ordered by keypath.
project_idNoFilter by project
limitNoMaximum results (default: 20, max: 100)
categoriesNoFilter by categories
keypath_prefixNoFilter by keypath prefix
include_supersededNoInclude old versions

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The actual implementation of the semantic search tool, which performs a POST request to the Memstate API. It is designed to be executable as a script or via the MCP proxy.
    def search_memories(query, project_id=None, limit=20):
        url = f"{BASE_URL}/memories/search"
        headers = {
            "X-API-Key": API_KEY,
            "Content-Type": "application/json",
            "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
        }
        
        data = {
            "query": query,
            "limit": limit
        }
        
        if project_id:
            data["project_id"] = project_id
    
        req = urllib.request.Request(url, data=json.dumps(data).encode("utf-8"), headers=headers, method="POST")
        
        try:
            with urllib.request.urlopen(req) as response:
                result = json.loads(response.read().decode("utf-8"))
                print(json.dumps(result, indent=2))
                return 0
        except urllib.error.HTTPError as e:
            print(f"Error: {e.code} - {e.read().decode('utf-8')}", file=sys.stderr)
            return 1
        except Exception as e:
            print(f"Error: {e}", file=sys.stderr)
            return 1
    
    if __name__ == "__main__":
        parser = argparse.ArgumentParser(description="Semantic search by meaning")
        parser.add_argument("--query", required=True, help="Natural language search query")
        parser.add_argument("--project", help="Filter by project ID")
        parser.add_argument("--limit", type=int, default=20, help="Maximum results (default: 20)")
        
        args = parser.parse_args()
        sys.exit(search_memories(args.query, args.project, args.limit))
  • In the proxy implementation, `memstate_search` (among other tools) is dynamically forwarded from the remote Memstate MCP server to the client.
    server.setRequestHandler(CallToolRequestSchema, async (request) => {
      return await remote.callTool({
        name: request.params.name,
        arguments: request.params.arguments,
      });
    });
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behaviors: it's a search tool (implied read-only), returns summaries with similarity scores, and requires memstate_get to fetch full content. However, it doesn't mention potential limitations like rate limits or authentication needs, which could be relevant for a search tool.

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?

The description is well-structured and front-loaded with the core purpose. Every sentence adds value: the initial statement, usage guidelines, examples, and instructions for fetching full content. It uses bold formatting effectively without being verbose, and there's no wasted text.

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

Completeness4/5

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

Given the tool's complexity (semantic search with 6 parameters), no annotations, but with a rich input schema (100% coverage) and output schema (confirmed present), the description is mostly complete. It explains the tool's purpose, usage, and result handling well. The main gap is lack of explicit behavioral details like error conditions or performance characteristics, but the output schema likely covers return values.

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 the schema already documents all 6 parameters thoroughly. The description adds minimal parameter semantics beyond the schema—it only mentions 'query' and 'project_id' in examples. This meets the baseline of 3 for high schema coverage, but doesn't provide additional meaningful context about parameters.

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: 'Find memories by meaning (semantic search).' It specifies the verb ('Find'), resource ('memories'), and method ('semantic search'), and distinguishes it from siblings by contrasting with exact keypath searches. The title being null doesn't detract from this clarity.

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?

The description provides explicit guidance with 'USE THIS WHEN:' and 'NOT FOR:' sections, clearly stating when to use this tool (for semantic search when exact keypath is unknown) and when to use alternatives (memstate_remember for saving content, memstate_set for one keypath value). It also mentions using it 'BEFORE starting tasks' for context.

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/memstate-ai/memstate-mcp'

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