delete_observations
Remove specific observations from entities in the knowledge graph stored on the MCP Memory Server, enabling precise data management and optimization of stored information.
Instructions
Delete specific observations from entities in the knowledge graph
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| deletions | Yes |
Input Schema (JSON Schema)
{
"properties": {
"deletions": {
"items": {
"properties": {
"entityName": {
"description": "The name of the entity containing the observations",
"type": "string"
},
"observations": {
"description": "An array of observations to delete",
"items": {
"type": "string"
},
"type": "array"
}
},
"required": [
"entityName",
"observations"
],
"type": "object"
},
"type": "array"
}
},
"required": [
"deletions"
],
"type": "object"
}
Implementation Reference
- src/index.ts:111-120 (handler)The core handler function in the KnowledgeGraphManager class that deletes specified observations from the given entities by filtering them out from the entity's observations array and saving the updated graph.async deleteObservations(deletions: { entityName: string; observations: string[] }[]): 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); }
- src/index.ts:293-313 (schema)The JSON input schema defining the structure for the deletions parameter: an array of objects each specifying an entityName and the observations to delete.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"], },
- src/index.ts:290-314 (registration)The full tool registration object returned in the ListToolsRequestSchema handler, including name, description, and input schema.{ 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"], }, },
- src/index.ts:393-395 (registration)The switch case in the CallToolRequestSchema handler that dispatches the call to the deleteObservations method.case "delete_observations": await knowledgeGraphManager.deleteObservations(args.deletions as { entityName: string; observations: string[] }[]); return { content: [{ type: "text", text: "Observations deleted successfully" }] };