Skip to main content
Glama

delete_observations

Remove specific observations from entities in a knowledge graph to maintain accurate semantic code indexing and search capabilities.

Instructions

Delete specific observations from entities in the knowledge graph

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deletionsYes

Implementation Reference

  • The primary handler for the 'delete_observations' tool. Validates the input arguments and delegates the deletion to the knowledge graph manager.
    export const deleteObservationsHandler: ToolHandler = async (args) => {
      if (!args.deletions || !Array.isArray(args.deletions)) {
        throw new Error("The 'deletions' parameter is required and must be an array");
      }
    
      // Valider chaque suppression
      for (const deletion of args.deletions) {
        if (!deletion.entityName || typeof deletion.entityName !== 'string') {
          throw new Error("Each deletion must have an 'entityName' string property");
        }
        if (!deletion.observations || !Array.isArray(deletion.observations)) {
          throw new Error("Each deletion must have an 'observations' array property");
        }
      }
    
      try {
        await knowledgeGraphManager.deleteObservations(args.deletions);
        return { 
          content: [{ 
            type: "text", 
            text: "Observations deleted successfully" 
          }] 
        };
      } catch (error) {
        console.error("Error in delete_observations tool:", error);
        throw error;
      }
    };
  • The tool definition including name, description, and input schema for 'delete_observations'.
    export const deleteObservationsTool: ToolDefinition = {
      name: "delete_observations",
      description: "Delete specific observations from entities in the knowledge graph",
      inputSchema: {
        type: "object",
        properties: {
          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"],
      },
    };
  • Core helper function in KnowledgeGraphManager that performs the actual deletion of observations by filtering the entity's observations array and saving the graph.
    async deleteObservations(deletions: DeletionInput[]): Promise<void> {
      const graph = await this.loadGraph();
      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);
    }
  • The auto-registration system that discovers and registers tools from build/tools/graph including delete_observations via its Tool and Handler exports.
    export const autoRegistry = new AutoRegistry();
    
    /**
     * Fonction utilitaire pour initialiser le registre automatique
  • Alternative schema definition for delete_observations in the graph tools array (possibly for manual use or dispatcher).
        name: "delete_observations",
        description: "Delete specific observations from entities in the knowledge graph",
        inputSchema: {
            type: "object",
            properties: {
                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"],
        },
    },
  • Dispatcher handler case for delete_observations in executeGraphTool function.
    case "delete_observations":
        await knowledgeGraphManager.deleteObservations(args.deletions);
        return { content: [{ type: "text", text: "Observations deleted successfully" }] };
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It states this is a deletion operation (implying destructive), but doesn't mention permissions needed, whether deletions are permanent/reversible, rate limits, or what happens to related data. For a destructive tool with zero annotation coverage, this is inadequate.

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 directly states the tool's function without unnecessary words. It's appropriately sized for a basic tool description and gets straight to the point.

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 destructive tool with no annotations, no output schema, and 0% schema description coverage, the description is insufficient. It doesn't explain what 'observations' are, how they relate to entities, what the deletion entails, or what the agent should expect as a result. More context is needed given the complexity and risk profile.

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 0%, so the schema provides no parameter documentation. The description mentions 'specific observations' and 'entities in the knowledge graph', which hints at the parameters but doesn't explain what entityName represents, what format observations take, or how deletions are processed. It adds marginal context but doesn't fully compensate for the coverage gap.

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 action ('Delete') and target ('specific observations from entities in the knowledge graph'), which distinguishes it from sibling tools like delete_entities or delete_relations. However, it doesn't specify what 'observations' are or how they differ from other graph elements, leaving some ambiguity.

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?

No guidance is provided on when to use this tool versus alternatives like delete_entities or delete_relations. The description implies it's for removing observations, but doesn't clarify prerequisites, dependencies, or scenarios where this is the appropriate choice among deletion tools.

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/ali-48/rag-mcp-server'

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