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];
    }
Behavior2/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 states this is an update operation (implying mutation) but doesn't address permissions needed, whether changes are reversible, rate limits, or what happens if the connection doesn't exist. The description adds minimal behavioral context beyond what's implied by 'update'.

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, efficient sentence that states the core purpose without unnecessary words. It's appropriately sized for a straightforward update operation and front-loads the essential information ('Update properties of an existing connection').

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 mutation tool with no annotations and no output schema, the description is inadequate. It doesn't explain what 'properties' can be updated, what the response looks like, error scenarios, or how this differs from sibling tools. Given the complexity (4 required params including nested objects), more context is needed for the agent to use this effectively.

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?

Schema description coverage is 100%, so the schema already documents all 4 parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema descriptions (e.g., examples of 'type' values and 'properties' content are already in schema). Baseline 3 is appropriate when schema does the heavy lifting.

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 verb ('Update') and resource ('properties of an existing connection between memories'), making the purpose immediately understandable. It distinguishes from siblings like 'create_connection' (creates new) and 'delete_connection' (removes), though it doesn't explicitly mention these alternatives in the description text itself.

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 like 'create_connection' or 'update_memory'. It doesn't mention prerequisites (e.g., connection must exist), error conditions, or typical use cases, leaving the agent to infer usage from the name and schema alone.

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