Skip to main content
Glama
knowall-ai

Neo4j Agent Memory MCP Server

by knowall-ai

update_connection

Modify properties of relationships between stored memories in a Neo4j graph database to reflect changes in connections like status updates or temporal attributes.

Instructions

Update properties of an existing connection between memories

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fromMemoryIdYesID of the source memory
toMemoryIdYesID of the target memory
typeYesRelationship type to identify which connection to update (e.g. WORKS_AT, KNOWS, MANAGES)
propertiesYesProperties to update/add (e.g. {status: "completed", end_date: "2024-01"})

Implementation Reference

  • Main handler logic for the 'update_connection' tool: validates arguments and calls Neo4jClient.updateRelationship to perform the update.
    case 'update_connection': { if (!isUpdateConnectionArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid update_connection arguments'); } const result = await neo4j.updateRelationship(args.fromMemoryId, args.toMemoryId, args.type, args.properties); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
  • Tool registration definition including name, description, and input schema for MCP.
    { name: 'update_connection', description: 'Update properties of an existing connection between memories', inputSchema: { type: 'object', properties: { fromMemoryId: { type: 'number', description: 'ID of the source memory', }, toMemoryId: { type: 'number', description: 'ID of the target memory', }, type: { type: 'string', description: 'Relationship type to identify which connection to update (e.g. WORKS_AT, KNOWS, MANAGES)', }, properties: { type: 'object', description: 'Properties to update/add (e.g. {status: "completed", end_date: "2024-01"})', additionalProperties: true, }, }, required: ['fromMemoryId', 'toMemoryId', 'type', 'properties'], }, },
  • TypeScript interface defining the input arguments for update_connection.
    export interface UpdateConnectionArgs { fromMemoryId: number; toMemoryId: number; type: string; properties: Record<string, any>; }
  • Runtime type guard function used to validate update_connection arguments in the handler.
    export function isUpdateConnectionArgs(args: unknown): args is UpdateConnectionArgs { return ( typeof args === 'object' && args !== null && typeof (args as UpdateConnectionArgs).fromMemoryId === 'number' && typeof (args as UpdateConnectionArgs).toMemoryId === 'number' && typeof (args as UpdateConnectionArgs).type === 'string' && typeof (args as UpdateConnectionArgs).properties === 'object' ); }
  • Neo4jClient method implementing the relationship update logic via Cypher query, called by the handler.
    async updateRelationship(fromNodeId: number, toNodeId: number, relationType: string, properties: Neo4jQueryParams): Promise<any> { const result = await this.executeQuery( `MATCH (a)-[r:${relationType}]->(b) WHERE id(a) = $fromId AND id(b) = $toId SET r += $props RETURN r as relationship`, { fromId: neo4j.int(fromNodeId), toId: neo4j.int(toNodeId), props: properties, } ); return result[0]; }

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