Skip to main content
Glama
j3k0

Elasticsearch Knowledge Graph for MCP

by j3k0

list_zones

Filter and prioritize available memory zones by relevance using a specified reason, enabling efficient information retrieval in the MCP Elasticsearch Knowledge Graph.

Instructions

List all available memory zones with metadata. When a reason is provided, zones will be filtered and prioritized based on relevance to your needs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
reasonNoReason for listing zones. What zones are you looking for? Why are you looking for them? The AI will use this to prioritize and filter relevant zones.

Implementation Reference

  • Handler for the list_zones tool. Retrieves memory zones using kgClient.listMemoryZones(reason). If a reason is provided and AI is available, uses GroqAI to classify and prioritize zones by usefulness, formatting the response accordingly. Falls back to listing all zones with full metadata if AI fails or no reason.
    else if (toolName === "list_zones") {
      const reason = params.reason;
      const zones = await kgClient.listMemoryZones(reason);
      
      // If reason is provided and GroqAI is available, use AI to score zone usefulness
      if (reason && GroqAI.isEnabled && zones.length > 0) {
        try {
          // Get usefulness scores for each zone
          const usefulnessScores = await GroqAI.classifyZoneUsefulness(zones, reason);
          
          // Process zones based on their usefulness scores
          const processedZones = zones.map(zone => {
            const usefulness = usefulnessScores[zone.name] !== undefined ? 
              usefulnessScores[zone.name] : 2; // Default to very useful (2) if not classified
            
            // Format zone info based on usefulness score
            if (usefulness === 0) { // Not useful
              return {
                name: zone.name,
                usefulness: 'not useful'
              };
            } else if (usefulness === 1) { // A little useful
              return {
                name: zone.name,
                description: zone.description,
                usefulness: 'a little useful'
              };
            } else { // Very useful (2) or default
              return {
                name: zone.name,
                description: zone.description,
                created_at: zone.createdAt,
                last_modified: zone.lastModified,
                config: zone.config,
                usefulness: 'very useful'
              };
            }
          });
          
          // Sort zones by usefulness (most useful first)
          processedZones.sort((a, b) => {
            const scoreA = usefulnessScores[a.name] !== undefined ? usefulnessScores[a.name] : 2;
            const scoreB = usefulnessScores[b.name] !== undefined ? usefulnessScores[b.name] : 2;
            return scoreB - scoreA; // Descending order
          });
          
          return formatResponse({
            zones: processedZones
          });
        } catch (error) {
          console.error('Error classifying zones:', error);
          // Fall back to default behavior
        }
      }
      
      // Default behavior (no reason provided or AI failed)
      return formatResponse({
        zones: zones.map(zone => ({
          name: zone.name,
          description: zone.description,
          created_at: zone.createdAt,
          last_modified: zone.lastModified,
          usefulness: 'very useful' // Default to very useful when no AI filtering is done
        }))
      });
    }
  • src/index.ts:472-486 (registration)
    Registration of the list_zones tool in the ListToolsRequestSchema handler, including name, description, and input schema.
    {
      name: "list_zones",
      description: "List all available memory zones with metadata. When a reason is provided, zones will be filtered and prioritized based on relevance to your needs.",
      inputSchema: {
        type: "object",
        properties: {
          reason: {
            type: "string",
            description: "Reason for listing zones. What zones are you looking for? Why are you looking for them? The AI will use this to prioritize and filter relevant zones."
          }
        },
        additionalProperties: false,
        "$schema": "http://json-schema.org/draft-07/schema#"
      }
    },
  • Input schema for the list_zones tool, defining the optional 'reason' parameter.
    inputSchema: {
      type: "object",
      properties: {
        reason: {
          type: "string",
          description: "Reason for listing zones. What zones are you looking for? Why are you looking for them? The AI will use this to prioritize and filter relevant zones."
        }
      },
      additionalProperties: false,
      "$schema": "http://json-schema.org/draft-07/schema#"
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses that the tool lists zones with metadata and can filter/prioritize based on a reason, which adds context beyond basic listing. However, it lacks details on behavioral traits such as pagination, rate limits, authentication needs, or what happens if no zones exist. The description doesn't contradict any annotations (since none exist).

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 two sentences, front-loaded with the core purpose and followed by an explanation of the optional parameter's effect. Every sentence earns its place by adding useful information without redundancy or fluff, making it efficient and well-structured.

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

Completeness3/5

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

Given the tool's low complexity (1 optional parameter, no output schema, no annotations), the description is somewhat complete but has gaps. It covers the purpose and parameter usage but lacks details on output format, error handling, or how metadata is structured. For a list tool with no output schema, more information on return values would improve completeness.

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?

The input schema has 1 parameter with 100% description coverage, providing a clear explanation of the 'reason' parameter. The description adds value by explaining that the reason is used to 'filter and prioritize relevant zones,' which gives semantic context beyond the schema's description. However, it doesn't elaborate on how filtering or prioritization works, keeping the baseline at 3 due to high schema coverage.

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's purpose: 'List all available memory zones with metadata.' It specifies the verb ('List') and resource ('memory zones'), and mentions metadata inclusion. However, it doesn't explicitly differentiate from sibling tools like 'zone_stats' or 'search_nodes' in terms of scope or output format.

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?

The description implies usage by stating that zones can be filtered and prioritized when a reason is provided, suggesting this tool is for retrieving zones with optional relevance-based filtering. However, it doesn't explicitly state when to use this tool versus alternatives like 'search_nodes' or 'zone_stats', nor does it provide exclusions or prerequisites for usage.

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

Related 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/j3k0/mcp-brain-tools'

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