Skip to main content
Glama
knowall-ai

Neo4j Agent Memory MCP Server

by knowall-ai

list_memory_labels

Retrieve all unique memory labels with their counts to gain an overview of the knowledge graph structure.

Instructions

List all unique memory labels currently in use with their counts (useful for getting an overview of the knowledge graph)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler logic for the 'list_memory_labels' tool, which queries Neo4j to retrieve all unique memory labels with their counts and returns the result as JSON.
    case 'list_memory_labels': {
      if (!isListMemoryLabelsArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid list_memory_labels arguments');
      }
      
      const query = `
        MATCH (memory)
        WITH labels(memory) as nodeLabels
        UNWIND nodeLabels as label
        WITH label, count(*) as count
        ORDER BY count DESC, label
        RETURN collect({label: label, count: count}) as labels, sum(count) as totalMemories
      `;
      
      const result = await neo4j.executeQuery(query, {});
      
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • Tool registration in the tools array, defining name, description, and input schema.
    {
      name: 'list_memory_labels',
      description: 'List all unique memory labels currently in use with their counts (useful for getting an overview of the knowledge graph)',
      inputSchema: {
        type: 'object',
        properties: {},
        required: [],
      },
    },
  • TypeScript interface defining the expected arguments for list_memory_labels (empty object).
    export interface ListMemoryLabelsArgs {
      // No arguments needed for this tool
    }
  • Type guard function for validating list_memory_labels arguments.
    export function isListMemoryLabelsArgs(args: unknown): args is ListMemoryLabelsArgs {
      // This tool doesn't require any arguments, so just check it's an object
      return typeof args === 'object' && args !== null;
    }
Behavior3/5

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

With no annotations provided, the description carries full burden. It discloses the tool's behavior of listing labels with counts, which is useful. However, it doesn't mention potential limitations like pagination, sorting, or performance implications for large datasets, leaving gaps in behavioral context.

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 a single, well-structured sentence that efficiently conveys purpose and utility without any wasted words. It is front-loaded with the core action and includes a helpful parenthetical note.

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 simplicity (0 parameters, no output schema, no annotations), the description is adequate but minimal. It explains what the tool does but lacks details on output format (e.g., structure of the list) or error conditions, which could be helpful despite the low complexity.

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

Parameters4/5

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

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, maintaining focus on the tool's purpose. A baseline of 4 is applied for zero-parameter tools when schema coverage is complete.

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 verb ('List') and resource ('all unique memory labels currently in use') with specific scope ('with their counts'). It distinguishes from siblings like 'search_memories' by focusing on labels overview rather than memory content.

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

Usage Guidelines4/5

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

The description provides clear context ('useful for getting an overview of the knowledge graph'), indicating when to use this tool. However, it doesn't explicitly state when not to use it or name specific alternatives among siblings like 'search_memories' for different purposes.

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/knowall-ai/mcp-neo4j-agent-memory'

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