Skip to main content
Glama
shaneholloman

mcp-knowledge-graph

aim_memory_remove_facts

Delete specific observations from a memory entity without removing the entity itself. Use to correct or update stored information.

Instructions

Remove specific facts from a memory. Keeps the memory but removes selected observations.

DATABASE SELECTION: Observations are deleted from entities within the specified database's knowledge graph.

LOCATION OVERRIDE: Use the 'location' parameter to force deletion from 'project' (.aim directory) or 'global' (configured directory). Leave blank for auto-detection.

EXAMPLES:

  • Master database (default): aim_memory_remove_facts({deletions: [{entityName: "John", observations: ["Outdated info"]}]})

  • Work database: aim_memory_remove_facts({context: "work", deletions: [{entityName: "Project", observations: ["Old deadline"]}]})

  • Master database in global location: aim_memory_remove_facts({location: "global", deletions: [{entityName: "John", observations: ["Outdated info"]}]})

  • Health database in project location: aim_memory_remove_facts({context: "health", location: "project", deletions: [{entityName: "Exercise", observations: ["Injured knee"]}]})

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contextNoOptional memory context. Observations will be deleted from entities in the specified context's knowledge graph.
locationNoOptional storage location override. 'project' forces project-local .aim directory, 'global' forces global directory. If not specified, uses automatic detection.
deletionsYes

Implementation Reference

  • Input schema for aim_memory_remove_facts tool: accepts 'context' (string), 'location' (enum: project/global), and 'deletions' (array of {entityName, observations[]}) with 'deletions' required.
    inputSchema: {
      type: "object",
      properties: {
        context: {
          type: "string",
          description: "Optional memory context. Observations will be deleted from entities in the specified context's knowledge graph."
        },
        location: {
          type: "string",
          enum: ["project", "global"],
          description: "Optional storage location override. 'project' forces project-local .aim directory, 'global' forces global directory. If not specified, uses automatic detection."
        },
        deletions: {
          type: "array",
          items: {
            type: "object",
            properties: {
              entityName: { type: "string", description: "The name of the entity containing the observations" },
              observations: {
                type: "array",
                items: { type: "string" },
                description: "An array of observations to delete"
              },
            },
            required: ["entityName", "observations"],
          },
        },
      },
      required: ["deletions"],
    },
  • Handler case for 'aim_memory_remove_facts' in the CallToolRequestSchema switch statement. Calls knowledgeGraphManager.deleteObservations with args.deletions, context, and location.
    case "aim_memory_remove_facts":
      await knowledgeGraphManager.deleteObservations(args.deletions as { entityName: string; observations: string[] }[], args.context as string, args.location as 'project' | 'global');
      return { content: [{ type: "text", text: "Observations deleted successfully" }] };
  • index.ts:579-622 (registration)
    Tool registration in ListToolsRequestSchema handler. Defines name 'aim_memory_remove_facts', description with examples, and inputSchema for the tool definition exposed to AI models.
          {
            name: "aim_memory_remove_facts",
            description: `Remove specific facts from a memory. Keeps the memory but removes selected observations.
    
    DATABASE SELECTION: Observations are deleted from entities within the specified database's knowledge graph.
    
    LOCATION OVERRIDE: Use the 'location' parameter to force deletion from 'project' (.aim directory) or 'global' (configured directory). Leave blank for auto-detection.
    
    EXAMPLES:
    - Master database (default): aim_memory_remove_facts({deletions: [{entityName: "John", observations: ["Outdated info"]}]})
    - Work database: aim_memory_remove_facts({context: "work", deletions: [{entityName: "Project", observations: ["Old deadline"]}]})
    - Master database in global location: aim_memory_remove_facts({location: "global", deletions: [{entityName: "John", observations: ["Outdated info"]}]})
    - Health database in project location: aim_memory_remove_facts({context: "health", location: "project", deletions: [{entityName: "Exercise", observations: ["Injured knee"]}]})`,
            inputSchema: {
              type: "object",
              properties: {
                context: {
                  type: "string",
                  description: "Optional memory context. Observations will be deleted from entities in the specified context's knowledge graph."
                },
                location: {
                  type: "string",
                  enum: ["project", "global"],
                  description: "Optional storage location override. 'project' forces project-local .aim directory, 'global' forces global directory. If not specified, uses automatic detection."
                },
                deletions: {
                  type: "array",
                  items: {
                    type: "object",
                    properties: {
                      entityName: { type: "string", description: "The name of the entity containing the observations" },
                      observations: {
                        type: "array",
                        items: { type: "string" },
                        description: "An array of observations to delete"
                      },
                    },
                    required: ["entityName", "observations"],
                  },
                },
              },
              required: ["deletions"],
            },
          },
  • KnowledgeGraphManager.deleteObservations method - the actual implementation logic. Loads the graph, filters out specified observations from matching entities, and saves the graph back.
    async deleteObservations(deletions: { entityName: string; observations: string[] }[], context?: string, location?: 'project' | 'global'): Promise<void> {
      const graph = await this.loadGraph(context, location);
      deletions.forEach(d => {
        const entity = graph.entities.find(e => e.name === d.entityName);
        if (entity) {
          entity.observations = entity.observations.filter(o => !d.observations.includes(o));
        }
      });
      await this.saveGraph(graph, context, location);
    }
Behavior4/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 clearly states that the memory is kept while only selected observations are removed. It explains the database selection behavior and location override logic. However, it does not mention error handling (e.g., if observations don't exist) or permissions, but the core behavior is well disclosed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with sections (DATABASE SELECTION, LOCATION OVERRIDE, EXAMPLES) and uses bullet-like formatting. It avoids tautology and provides necessary context. While slightly lengthy due to examples, each part adds value. Could be more concise, but it's organized and front-loaded.

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

Completeness4/5

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

Given the tool has 3 parameters, no output schema, and no annotations, the description covers the main behaviors: what the tool does, database/location selection, and multiple examples. It lacks explicit details on error cases or return values, but it is sufficient for an agent to invoke the tool correctly in most scenarios.

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?

Schema description coverage is 67% (context and location have descriptions, deletions does not at top level). The description adds value by explaining the deletions parameter through examples and stating that it removes selected observations. It clarifies the structure (array of objects with entityName and observations) and provides multiple usage patterns, enhancing understanding beyond the schema.

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 'Remove specific facts from a memory. Keeps the memory but removes selected observations.' This distinguishes it from siblings like aim_memory_forget (which likely removes entire memory) and aim_memory_add_facts (adds). The verb 'remove' and resource 'facts from a memory' are specific and unambiguous.

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 explicit guidance on when to use the location override and includes examples for different contexts (master, work, health) and locations (project, global). It implies the tool is for selective deletion without removing the entire memory, but does not explicitly state when not to use it compared to siblings like aim_memory_forget. The database selection section also adds context.

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/shaneholloman/mcp-knowledge-graph'

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