Skip to main content
Glama
knowall-ai

Neo4j Agent Memory MCP Server

by knowall-ai

update_memory

Modify existing memory entries in a Neo4j graph database by updating properties or adding new details when information changes.

Instructions

Update properties of an existing memory such as adding more detail or make a change when you find out something new

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nodeIdYesID of the memory to update
propertiesYesProperties to update/add

Implementation Reference

  • The handler function executes the update_memory tool by validating arguments with isUpdateMemoryArgs and calling neo4j.updateNode to update the memory node in the database.
    case 'update_memory': {
      if (!isUpdateMemoryArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid update_memory arguments');
      }
      const result = await neo4j.updateNode(args.nodeId, args.properties);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • TypeScript interface and validation function defining the input schema for update_memory tool arguments.
    export interface UpdateMemoryArgs {
      nodeId: number;
      properties: Record<string, any>;
    }
    
    export interface UpdateConnectionArgs {
      fromMemoryId: number;
      toMemoryId: number;
      type: string;
      properties: Record<string, any>;
    }
    
    export interface DeleteMemoryArgs {
      nodeId: number;
    }
    
    export interface DeleteConnectionArgs {
      fromMemoryId: number;
      toMemoryId: number;
      type: string;
    }
    
    export interface ListMemoryLabelsArgs {
      // No arguments needed for this tool
    }
    
    export function isCreateMemoryArgs(args: unknown): args is CreateMemoryArgs {
      return typeof args === 'object' && args !== null && typeof (args as CreateMemoryArgs).label === 'string' && typeof (args as CreateMemoryArgs).properties === 'object';
    }
    
    export function isSearchMemoriesArgs(args: unknown): args is SearchMemoriesArgs {
      if (typeof args !== 'object' || args === null) return false;
      const searchArgs = args as SearchMemoriesArgs;
      if (searchArgs.query !== undefined && typeof searchArgs.query !== 'string') return false;
      if (searchArgs.since_date !== undefined && typeof searchArgs.since_date !== 'string') return false;
      return true;
    }
    
    export function isCreateConnectionArgs(args: unknown): args is CreateConnectionArgs {
      return (
        typeof args === 'object' &&
        args !== null &&
        typeof (args as CreateConnectionArgs).fromMemoryId === 'number' &&
        typeof (args as CreateConnectionArgs).toMemoryId === 'number' &&
        typeof (args as CreateConnectionArgs).type === 'string'
      );
    }
    
    export function isUpdateMemoryArgs(args: unknown): args is UpdateMemoryArgs {
      return (
        typeof args === 'object' &&
        args !== null &&
        typeof (args as UpdateMemoryArgs).nodeId === 'number' &&
        typeof (args as UpdateMemoryArgs).properties === 'object'
      );
    }
  • Tool registration in the tools array, including name, description, and input schema for the MCP server.
    {
      name: 'update_memory',
      description: 'Update properties of an existing memory such as adding more detail or make a change when you find out something new',
      inputSchema: {
        type: 'object',
        properties: {
          nodeId: {
            type: 'number',
            description: 'ID of the memory to update',
          },
          properties: {
            type: 'object',
            description: 'Properties to update/add',
            additionalProperties: true,
          },
        },
        required: ['nodeId', 'properties'],
      },
    },

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