Skip to main content
Glama

search_memory

Search agent memories semantically to find relevant information using natural language queries. Returns top matches based on relevance.

Instructions

Semantic search across all agent memories. Returns most relevant matches. Cost: $0.005 USDC. Service: memex.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_idYes
queryYes
top_kNo

Implementation Reference

  • The "search_memory" tool (along with all other tools) is dynamically handled by this CallToolRequestSchema handler. It fetches tools from a remote registry and executes them via callTool.
    server.setRequestHandler(CallToolRequestSchema, async (request) => {
      const { name, arguments: args } = request.params;
    
      let registry: Registry;
      try {
        registry = await fetchRegistry();
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({ error: "Failed to fetch tool registry", detail: String(error) }),
            },
          ],
        };
      }
    
      const tool = registry.tools.find((t) => t.name === name);
      if (!tool) {
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({
                error: `Tool '${name}' not found`,
                available_tools: registry.tools.map((t) => t.name),
              }),
            },
          ],
        };
      }
    
      try {
        const result = await callTool(tool, args as Record<string, unknown>);
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(result, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({
                error: "Tool call failed",
                tool: name,
                service: tool.service,
                detail: String(error),
              }),
            },
          ],
        };
      }
    });
Behavior3/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It adds valuable context about cost ($0.005 USDC) and service provider (memex), which aren't captured elsewhere. However, it doesn't describe important behavioral aspects like rate limits, authentication requirements, error conditions, or what constitutes 'most relevant matches' in the search algorithm.

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 appropriately brief with three concise sentences that each add value: the core functionality, return behavior, and cost/service information. There's no wasted text, though it could be slightly more structured for readability.

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?

For a search tool with 3 parameters (2 required), 0% schema coverage, no annotations, and no output schema, the description is insufficient. It doesn't explain parameter meanings, return format, error handling, or important behavioral constraints. The cost information is helpful but doesn't compensate for the major gaps in understanding how to use the tool effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage for all 3 parameters, the description provides no information about parameter meanings. It doesn't explain what 'agent_id' refers to, what format 'query' should take, or what 'top_k' controls. The description fails to compensate for the complete lack of schema documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool performs 'semantic search across all agent memories' and 'returns most relevant matches', specifying both the action (search) and resource (agent memories). It distinguishes from siblings like 'read_memory' and 'write_memory' by focusing on search functionality rather than direct memory access. However, it doesn't explicitly contrast with all potential alternatives.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when this search is appropriate compared to other memory-related tools like 'read_memory', nor does it specify prerequisites or exclusions. The cost information is useful but doesn't constitute usage guidance.

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

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