rag-memory-epf-mcp 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +292 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1654 -0
- package/dist/index.js.map +1 -0
- package/dist/src/migrations/migration-manager.d.ts +28 -0
- package/dist/src/migrations/migration-manager.d.ts.map +1 -0
- package/dist/src/migrations/migration-manager.js +111 -0
- package/dist/src/migrations/migration-manager.js.map +1 -0
- package/dist/src/migrations/migrations.d.ts +3 -0
- package/dist/src/migrations/migrations.d.ts.map +1 -0
- package/dist/src/migrations/migrations.js +181 -0
- package/dist/src/migrations/migrations.js.map +1 -0
- package/dist/src/tools/graph-query-tools.d.ts +16 -0
- package/dist/src/tools/graph-query-tools.d.ts.map +1 -0
- package/dist/src/tools/graph-query-tools.js +452 -0
- package/dist/src/tools/graph-query-tools.js.map +1 -0
- package/dist/src/tools/knowledge-graph-tools.d.ts +16 -0
- package/dist/src/tools/knowledge-graph-tools.d.ts.map +1 -0
- package/dist/src/tools/knowledge-graph-tools.js +482 -0
- package/dist/src/tools/knowledge-graph-tools.js.map +1 -0
- package/dist/src/tools/migration-tools.d.ts +3 -0
- package/dist/src/tools/migration-tools.d.ts.map +1 -0
- package/dist/src/tools/migration-tools.js +172 -0
- package/dist/src/tools/migration-tools.js.map +1 -0
- package/dist/src/tools/rag-tools.d.ts +20 -0
- package/dist/src/tools/rag-tools.d.ts.map +1 -0
- package/dist/src/tools/rag-tools.js +524 -0
- package/dist/src/tools/rag-tools.js.map +1 -0
- package/dist/src/tools/tool-registry.d.ts +82 -0
- package/dist/src/tools/tool-registry.d.ts.map +1 -0
- package/dist/src/tools/tool-registry.js +185 -0
- package/dist/src/tools/tool-registry.js.map +1 -0
- package/dist/src/tools/types.d.ts +34 -0
- package/dist/src/tools/types.d.ts.map +1 -0
- package/dist/src/tools/types.js +2 -0
- package/dist/src/tools/types.js.map +1 -0
- package/package.json +39 -0
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
// === READ GRAPH TOOL ===
|
|
3
|
+
const readGraphCapability = {
|
|
4
|
+
description: 'Read and retrieve the entire knowledge graph structure',
|
|
5
|
+
parameters: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {},
|
|
8
|
+
required: [],
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
const readGraphDescription = () => `<description>
|
|
12
|
+
Read and retrieve the complete knowledge graph structure including all entities and relationships.
|
|
13
|
+
**Provides comprehensive view of your entire knowledge base structure.**
|
|
14
|
+
Essential for understanding graph composition, debugging, and exporting knowledge.
|
|
15
|
+
</description>
|
|
16
|
+
|
|
17
|
+
<importantNotes>
|
|
18
|
+
- (!important!) **Returns complete graph** - may be large for extensive knowledge bases
|
|
19
|
+
- (!important!) Includes all entities with their observations and metadata
|
|
20
|
+
- (!important!) Shows all relationships with their types and directions
|
|
21
|
+
- (!important!) **Use with caution** on very large graphs - consider search_nodes for targeted queries
|
|
22
|
+
</importantNotes>
|
|
23
|
+
|
|
24
|
+
<whenToUseThisTool>
|
|
25
|
+
- When you need a complete overview of your knowledge graph
|
|
26
|
+
- For debugging relationship structures and entity compositions
|
|
27
|
+
- **Before major restructuring** - to understand current state
|
|
28
|
+
- When exporting knowledge graph data to other systems
|
|
29
|
+
- For generating comprehensive reports or visualizations
|
|
30
|
+
- When validating graph integrity and completeness
|
|
31
|
+
</whenToUseThisTool>
|
|
32
|
+
|
|
33
|
+
<features>
|
|
34
|
+
- Complete entity enumeration with full details
|
|
35
|
+
- Comprehensive relationship mapping with types
|
|
36
|
+
- Structured output suitable for processing or visualization
|
|
37
|
+
- Includes entity observations and metadata
|
|
38
|
+
- Shows relationship directionality and semantics
|
|
39
|
+
- Real-time reflection of current graph state
|
|
40
|
+
</features>
|
|
41
|
+
|
|
42
|
+
<bestPractices>
|
|
43
|
+
- Use search_nodes or open_nodes for large graphs to avoid overwhelming output
|
|
44
|
+
- Consider filtering results post-retrieval for specific analysis needs
|
|
45
|
+
- Cache results if doing multiple operations on static graph state
|
|
46
|
+
- Use for periodic backup or version control of knowledge structure
|
|
47
|
+
- Combine with statistics tools for comprehensive analysis
|
|
48
|
+
- Consider performance impact on very large graphs
|
|
49
|
+
</bestPractices>
|
|
50
|
+
|
|
51
|
+
<parameters>
|
|
52
|
+
- None required - returns complete knowledge graph structure
|
|
53
|
+
</parameters>
|
|
54
|
+
|
|
55
|
+
<examples>
|
|
56
|
+
- Complete export: {} (no parameters needed)
|
|
57
|
+
- Pre-analysis snapshot: {} (capture current state before modifications)
|
|
58
|
+
- Debug investigation: {} (understand full graph structure for troubleshooting)
|
|
59
|
+
</examples>`;
|
|
60
|
+
const readGraphSchema = {};
|
|
61
|
+
export const readGraphTool = {
|
|
62
|
+
capability: readGraphCapability,
|
|
63
|
+
description: readGraphDescription,
|
|
64
|
+
schema: readGraphSchema,
|
|
65
|
+
};
|
|
66
|
+
// === SEARCH NODES TOOL ===
|
|
67
|
+
const searchNodesCapability = {
|
|
68
|
+
description: 'Search for entities in the knowledge graph using semantic vector similarity',
|
|
69
|
+
parameters: {
|
|
70
|
+
type: 'object',
|
|
71
|
+
properties: {
|
|
72
|
+
query: {
|
|
73
|
+
type: 'string',
|
|
74
|
+
description: 'Natural language search query for semantic similarity matching'
|
|
75
|
+
},
|
|
76
|
+
limit: {
|
|
77
|
+
type: 'number',
|
|
78
|
+
description: 'Maximum number of results to return',
|
|
79
|
+
default: 10
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
required: ['query'],
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
const searchNodesDescription = () => `<description>
|
|
86
|
+
Search for specific nodes (entities) in the knowledge graph using semantic vector similarity.
|
|
87
|
+
**Perfect for intelligent entity discovery using natural language queries.**
|
|
88
|
+
Uses semantic embeddings to find conceptually similar entities, even without exact keyword matches.
|
|
89
|
+
</description>
|
|
90
|
+
|
|
91
|
+
<importantNotes>
|
|
92
|
+
- (!important!) **Semantic vector search** - finds conceptually similar entities, not just keyword matches
|
|
93
|
+
- (!important!) **Requires entity embeddings** - run embedAllEntities first for existing entities
|
|
94
|
+
- (!important!) **Returns similarity scores** with matching entities and their relationships
|
|
95
|
+
- (!important!) More intelligent than traditional pattern matching - understands context and meaning
|
|
96
|
+
</importantNotes>
|
|
97
|
+
|
|
98
|
+
<whenToUseThisTool>
|
|
99
|
+
- When looking for entities conceptually related to your query
|
|
100
|
+
- **Before creating new entities** - to discover existing similar concepts
|
|
101
|
+
- When exploring knowledge domains using natural language
|
|
102
|
+
- For intelligent entity discovery without knowing exact names
|
|
103
|
+
- When building semantic subgraphs around particular concepts
|
|
104
|
+
- For content-aware entity exploration and research
|
|
105
|
+
</whenToUseThisTool>
|
|
106
|
+
|
|
107
|
+
<features>
|
|
108
|
+
- Semantic similarity search using sentence transformers
|
|
109
|
+
- Natural language query processing for entity discovery
|
|
110
|
+
- Similarity scoring for result ranking and relevance
|
|
111
|
+
- Returns complete entity information including observations
|
|
112
|
+
- Includes relationships between semantically similar entities
|
|
113
|
+
- Configurable result limits for focused or broad exploration
|
|
114
|
+
</features>
|
|
115
|
+
|
|
116
|
+
<bestPractices>
|
|
117
|
+
- Use natural language descriptions rather than exact keywords
|
|
118
|
+
- Try conceptual queries like "artificial intelligence frameworks" or "database technologies"
|
|
119
|
+
- Start with broader queries, then refine based on similarity scores
|
|
120
|
+
- Ensure entities have embeddings (use embedAllEntities for existing entities)
|
|
121
|
+
- Review similarity scores to understand conceptual relevance
|
|
122
|
+
- Combine with openNodes for detailed analysis of interesting findings
|
|
123
|
+
</bestPractices>
|
|
124
|
+
|
|
125
|
+
<parameters>
|
|
126
|
+
- query: Natural language search query for semantic entity discovery (string, required)
|
|
127
|
+
- limit: Maximum number of similar entities to return, default 10 (number, optional)
|
|
128
|
+
</parameters>
|
|
129
|
+
|
|
130
|
+
<examples>
|
|
131
|
+
- Conceptual search: {"query": "machine learning frameworks", "limit": 5}
|
|
132
|
+
- Technology discovery: {"query": "web development tools"}
|
|
133
|
+
- Domain exploration: {"query": "quantum physics concepts", "limit": 15}
|
|
134
|
+
- Semantic similarity: {"query": "data visualization libraries"}
|
|
135
|
+
- Research queries: {"query": "renewable energy technologies"}
|
|
136
|
+
</examples>`;
|
|
137
|
+
const searchNodesSchema = {
|
|
138
|
+
query: z.string().describe('Natural language search query for semantic entity discovery'),
|
|
139
|
+
limit: z.number().optional().default(10).describe('Maximum number of similar entities to return'),
|
|
140
|
+
};
|
|
141
|
+
export const searchNodesTool = {
|
|
142
|
+
capability: searchNodesCapability,
|
|
143
|
+
description: searchNodesDescription,
|
|
144
|
+
schema: searchNodesSchema,
|
|
145
|
+
};
|
|
146
|
+
// === OPEN NODES TOOL ===
|
|
147
|
+
const openNodesCapability = {
|
|
148
|
+
description: 'Retrieve specific entities and their relationships by exact names',
|
|
149
|
+
parameters: {
|
|
150
|
+
type: 'object',
|
|
151
|
+
properties: {
|
|
152
|
+
names: {
|
|
153
|
+
type: 'array',
|
|
154
|
+
description: 'Array of exact entity names to retrieve'
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
required: ['names'],
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
const openNodesDescription = () => `<description>
|
|
161
|
+
Retrieve specific entities and their interconnected relationships by providing exact entity names.
|
|
162
|
+
**Ideal for focused analysis of known entities and their connection patterns.**
|
|
163
|
+
Returns detailed subgraph showing how specified entities relate to each other.
|
|
164
|
+
</description>
|
|
165
|
+
|
|
166
|
+
<importantNotes>
|
|
167
|
+
- (!important!) **Requires exact entity names** - use search_nodes first if uncertain
|
|
168
|
+
- (!important!) Returns entities with full details and observations
|
|
169
|
+
- (!important!) **Shows relationships between specified entities** - perfect for connection analysis
|
|
170
|
+
- (!important!) More precise than search - use when you know exactly what you want
|
|
171
|
+
</importantNotes>
|
|
172
|
+
|
|
173
|
+
<whenToUseThisTool>
|
|
174
|
+
- When you have specific entity names and want detailed information
|
|
175
|
+
- **For analyzing relationships** between known entities
|
|
176
|
+
- When building focused subgraphs around particular entities
|
|
177
|
+
- For validating specific entity data and connections
|
|
178
|
+
- When following up on search results with detailed exploration
|
|
179
|
+
- For debugging specific entity or relationship issues
|
|
180
|
+
</whenToUseThisTool>
|
|
181
|
+
|
|
182
|
+
<features>
|
|
183
|
+
- Exact entity retrieval by name
|
|
184
|
+
- Complete entity details including all observations
|
|
185
|
+
- Relationship mapping between specified entities
|
|
186
|
+
- Structured output showing entity interconnections
|
|
187
|
+
- Efficient lookup for known entity names
|
|
188
|
+
- Suitable for building focused knowledge subsets
|
|
189
|
+
</features>
|
|
190
|
+
|
|
191
|
+
<bestPractices>
|
|
192
|
+
- Use exact entity names as they appear in your knowledge graph
|
|
193
|
+
- Combine related entities in single request for relationship analysis
|
|
194
|
+
- Use after search_nodes to explore interesting findings in detail
|
|
195
|
+
- Verify entity names if you get empty results
|
|
196
|
+
- Group logically related entities for coherent subgraph analysis
|
|
197
|
+
- Use for validating entity relationships and data quality
|
|
198
|
+
</bestPractices>
|
|
199
|
+
|
|
200
|
+
<parameters>
|
|
201
|
+
- names: Array of exact entity names to retrieve with relationships (string[], required)
|
|
202
|
+
</parameters>
|
|
203
|
+
|
|
204
|
+
<examples>
|
|
205
|
+
- Single entity: {"names": ["Albert Einstein"]}
|
|
206
|
+
- Related entities: {"names": ["React", "JavaScript", "Facebook"]}
|
|
207
|
+
- Research analysis: {"names": ["Machine Learning", "Neural Networks", "Deep Learning"]}
|
|
208
|
+
- Validation check: {"names": ["Entity1", "Entity2", "Entity3"]}
|
|
209
|
+
</examples>`;
|
|
210
|
+
const openNodesSchema = {
|
|
211
|
+
names: z.array(z.string()).describe('Array of exact entity names to retrieve with their relationships'),
|
|
212
|
+
};
|
|
213
|
+
export const openNodesTool = {
|
|
214
|
+
capability: openNodesCapability,
|
|
215
|
+
description: openNodesDescription,
|
|
216
|
+
schema: openNodesSchema,
|
|
217
|
+
};
|
|
218
|
+
// === DELETE ENTITIES TOOL ===
|
|
219
|
+
const deleteEntitiesCapability = {
|
|
220
|
+
description: 'Delete multiple entities and their associated relationships from the knowledge graph',
|
|
221
|
+
parameters: {
|
|
222
|
+
type: 'object',
|
|
223
|
+
properties: {
|
|
224
|
+
entityNames: {
|
|
225
|
+
type: 'array',
|
|
226
|
+
description: 'Array of entity names to delete from the knowledge graph'
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
required: ['entityNames'],
|
|
230
|
+
},
|
|
231
|
+
};
|
|
232
|
+
const deleteEntitiesDescription = () => `<description>
|
|
233
|
+
Delete multiple entities and their associated relationships from the knowledge graph.
|
|
234
|
+
**Permanent operation that removes entities and all their connections.**
|
|
235
|
+
Use with caution as this operation cannot be undone and affects graph structure.
|
|
236
|
+
</description>
|
|
237
|
+
|
|
238
|
+
<importantNotes>
|
|
239
|
+
- (!important!) **Permanent deletion** - cannot be undone without backup
|
|
240
|
+
- (!important!) **Removes all relationships** involving the deleted entities
|
|
241
|
+
- (!important!) Affects graph connectivity - may orphan related entities
|
|
242
|
+
- (!important!) **Use search_nodes first** to verify entities before deletion
|
|
243
|
+
</importantNotes>
|
|
244
|
+
|
|
245
|
+
<whenToUseThisTool>
|
|
246
|
+
- When removing obsolete or incorrect entities from your graph
|
|
247
|
+
- **After careful verification** of entities to be deleted
|
|
248
|
+
- When cleaning up duplicate or redundant entities
|
|
249
|
+
- When restructuring knowledge domains
|
|
250
|
+
- When removing entities that are no longer relevant
|
|
251
|
+
- For knowledge base maintenance and cleanup operations
|
|
252
|
+
</whenToUseThisTool>
|
|
253
|
+
|
|
254
|
+
<features>
|
|
255
|
+
- Batch deletion of multiple entities
|
|
256
|
+
- Automatic cleanup of associated relationships
|
|
257
|
+
- Maintains graph integrity after deletion
|
|
258
|
+
- Cascading removal of entity references
|
|
259
|
+
- Safe handling of dependencies and connections
|
|
260
|
+
- Efficient bulk deletion operations
|
|
261
|
+
</features>
|
|
262
|
+
|
|
263
|
+
<bestPractices>
|
|
264
|
+
- ALWAYS verify entity names and impact before deletion
|
|
265
|
+
- Use search_nodes to understand entity connections first
|
|
266
|
+
- Consider archiving instead of deleting for important historical data
|
|
267
|
+
- Backup your knowledge graph before major deletion operations
|
|
268
|
+
- Delete in small batches for large cleanup operations
|
|
269
|
+
- Review relationship impacts on remaining entities
|
|
270
|
+
</bestPractices>
|
|
271
|
+
|
|
272
|
+
<parameters>
|
|
273
|
+
- entityNames: Array of exact entity names to delete (string[], required)
|
|
274
|
+
</parameters>
|
|
275
|
+
|
|
276
|
+
<examples>
|
|
277
|
+
- Remove duplicates: {"entityNames": ["Duplicate Entity 1", "Duplicate Entity 2"]}
|
|
278
|
+
- Clean obsolete: {"entityNames": ["Old Technology", "Deprecated Framework"]}
|
|
279
|
+
- Single removal: {"entityNames": ["Incorrect Entity"]}
|
|
280
|
+
</examples>`;
|
|
281
|
+
const deleteEntitiesSchema = {
|
|
282
|
+
entityNames: z.array(z.string()).describe('Array of exact entity names to permanently delete'),
|
|
283
|
+
};
|
|
284
|
+
export const deleteEntitiesTool = {
|
|
285
|
+
capability: deleteEntitiesCapability,
|
|
286
|
+
description: deleteEntitiesDescription,
|
|
287
|
+
schema: deleteEntitiesSchema,
|
|
288
|
+
};
|
|
289
|
+
// === DELETE RELATIONS TOOL ===
|
|
290
|
+
const deleteRelationsCapability = {
|
|
291
|
+
description: 'Delete specific relationships from the knowledge graph while preserving entities',
|
|
292
|
+
parameters: {
|
|
293
|
+
type: 'object',
|
|
294
|
+
properties: {
|
|
295
|
+
relations: {
|
|
296
|
+
type: 'array',
|
|
297
|
+
description: 'Array of specific relationships to delete'
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
required: ['relations'],
|
|
301
|
+
},
|
|
302
|
+
};
|
|
303
|
+
const deleteRelationsDescription = () => `<description>
|
|
304
|
+
Delete specific relationships from the knowledge graph while preserving the entities themselves.
|
|
305
|
+
**Precise operation for removing incorrect or obsolete connections.**
|
|
306
|
+
Allows fine-tuned graph structure modification without losing entity information.
|
|
307
|
+
</description>
|
|
308
|
+
|
|
309
|
+
<importantNotes>
|
|
310
|
+
- (!important!) **Entities remain intact** - only relationships are removed
|
|
311
|
+
- (!important!) Requires exact relationship specification (from, to, type)
|
|
312
|
+
- (!important!) **May affect graph connectivity** - could isolate entities
|
|
313
|
+
- (!important!) Permanent operation - verify relationships before deletion
|
|
314
|
+
</importantNotes>
|
|
315
|
+
|
|
316
|
+
<whenToUseThisTool>
|
|
317
|
+
- When correcting incorrect relationships between entities
|
|
318
|
+
- **For fine-tuning graph structure** without losing entities
|
|
319
|
+
- When relationships become obsolete but entities remain valid
|
|
320
|
+
- When restructuring relationship types or semantics
|
|
321
|
+
- For removing duplicate or redundant relationships
|
|
322
|
+
- When debugging relationship connectivity issues
|
|
323
|
+
</whenToUseThisTool>
|
|
324
|
+
|
|
325
|
+
<features>
|
|
326
|
+
- Precise relationship removal by exact specification
|
|
327
|
+
- Preserves entities while modifying connections
|
|
328
|
+
- Batch deletion of multiple relationships
|
|
329
|
+
- Maintains entity integrity during relationship removal
|
|
330
|
+
- Supports complex relationship cleanup operations
|
|
331
|
+
- Safe handling of graph structure modifications
|
|
332
|
+
</features>
|
|
333
|
+
|
|
334
|
+
<bestPractices>
|
|
335
|
+
- Verify relationship details before deletion using search tools
|
|
336
|
+
- Consider impact on graph connectivity and traversal paths
|
|
337
|
+
- Use read_graph or open_nodes to understand relationship context
|
|
338
|
+
- Delete relationships in logical groups for coherent operations
|
|
339
|
+
- Test relationship queries after deletion to verify expected behavior
|
|
340
|
+
- Document reasons for relationship removal for future reference
|
|
341
|
+
</bestPractices>
|
|
342
|
+
|
|
343
|
+
<parameters>
|
|
344
|
+
- relations: Array of relationship objects to delete, each containing:
|
|
345
|
+
- from: Name of the source entity (string, required)
|
|
346
|
+
- to: Name of the target entity (string, required)
|
|
347
|
+
- relationType: Type of relationship to delete (string, required)
|
|
348
|
+
</parameters>
|
|
349
|
+
|
|
350
|
+
<examples>
|
|
351
|
+
- Remove incorrect: {"relations": [{"from": "Entity A", "to": "Entity B", "relationType": "INCORRECT_RELATION"}]}
|
|
352
|
+
- Clean duplicates: {"relations": [{"from": "React", "to": "JavaScript", "relationType": "DUPLICATE_USES"}]}
|
|
353
|
+
- Restructure: {"relations": [{"from": "Old Connection", "to": "Target", "relationType": "OBSOLETE"}]}
|
|
354
|
+
</examples>`;
|
|
355
|
+
const deleteRelationsSchema = {
|
|
356
|
+
relations: z.array(z.object({
|
|
357
|
+
from: z.string().describe('Name of the source entity in the relationship to delete'),
|
|
358
|
+
to: z.string().describe('Name of the target entity in the relationship to delete'),
|
|
359
|
+
relationType: z.string().describe('Type of relationship to delete'),
|
|
360
|
+
})).describe('Array of specific relationships to delete'),
|
|
361
|
+
};
|
|
362
|
+
export const deleteRelationsTool = {
|
|
363
|
+
capability: deleteRelationsCapability,
|
|
364
|
+
description: deleteRelationsDescription,
|
|
365
|
+
schema: deleteRelationsSchema,
|
|
366
|
+
};
|
|
367
|
+
// === DELETE OBSERVATIONS TOOL ===
|
|
368
|
+
const deleteObservationsCapability = {
|
|
369
|
+
description: 'Delete specific observations from entities while preserving the entities themselves',
|
|
370
|
+
parameters: {
|
|
371
|
+
type: 'object',
|
|
372
|
+
properties: {
|
|
373
|
+
deletions: {
|
|
374
|
+
type: 'array',
|
|
375
|
+
description: 'Array of observation deletions for specific entities'
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
required: ['deletions'],
|
|
379
|
+
},
|
|
380
|
+
};
|
|
381
|
+
const deleteObservationsDescription = () => `<description>
|
|
382
|
+
Delete specific observations from entities while preserving the entities and other observations.
|
|
383
|
+
**Precise content management for refining entity information.**
|
|
384
|
+
Allows selective removal of outdated, incorrect, or redundant observations.
|
|
385
|
+
</description>
|
|
386
|
+
|
|
387
|
+
<importantNotes>
|
|
388
|
+
- (!important!) **Entities remain intact** - only specified observations are removed
|
|
389
|
+
- (!important!) Requires exact observation text matching
|
|
390
|
+
- (!important!) **Other observations preserved** - selective removal only
|
|
391
|
+
- (!important!) Use carefully - observations provide entity context and evidence
|
|
392
|
+
</importantNotes>
|
|
393
|
+
|
|
394
|
+
<whenToUseThisTool>
|
|
395
|
+
- When removing outdated or incorrect observations from entities
|
|
396
|
+
- **For content quality management** and information accuracy
|
|
397
|
+
- When observations become irrelevant or superseded
|
|
398
|
+
- When correcting entity information without full rebuilding
|
|
399
|
+
- For removing duplicate or redundant observations
|
|
400
|
+
- When refining entity descriptions for clarity
|
|
401
|
+
</whenToUseThisTool>
|
|
402
|
+
|
|
403
|
+
<features>
|
|
404
|
+
- Selective observation removal by exact text matching
|
|
405
|
+
- Preserves entities and other observations
|
|
406
|
+
- Batch processing of multiple observation deletions
|
|
407
|
+
- Maintains entity integrity during content updates
|
|
408
|
+
- Supports precise information management
|
|
409
|
+
- Safe handling of entity content modifications
|
|
410
|
+
</features>
|
|
411
|
+
|
|
412
|
+
<bestPractices>
|
|
413
|
+
- Verify exact observation text before deletion using search or open tools
|
|
414
|
+
- Consider whether updating is better than deleting observations
|
|
415
|
+
- Remove observations that are clearly incorrect or outdated
|
|
416
|
+
- Maintain enough observations to preserve entity context
|
|
417
|
+
- Group related observation deletions for coherent operations
|
|
418
|
+
- Document reasons for observation removal when significant
|
|
419
|
+
</bestPractices>
|
|
420
|
+
|
|
421
|
+
<parameters>
|
|
422
|
+
- deletions: Array of observation deletion objects, each containing:
|
|
423
|
+
- entityName: Name of the entity containing observations to delete (string, required)
|
|
424
|
+
- observations: Array of exact observation texts to remove (string[], required)
|
|
425
|
+
</parameters>
|
|
426
|
+
|
|
427
|
+
<examples>
|
|
428
|
+
- Remove outdated: {"deletions": [{"entityName": "Technology X", "observations": ["Discontinued in 2020", "No longer supported"]}]}
|
|
429
|
+
- Fix errors: {"deletions": [{"entityName": "Person Y", "observations": ["Incorrect birth year 1980"]}]}
|
|
430
|
+
- Clean duplicates: {"deletions": [{"entityName": "Concept Z", "observations": ["Duplicate description text"]}]}
|
|
431
|
+
</examples>`;
|
|
432
|
+
const deleteObservationsSchema = {
|
|
433
|
+
deletions: z.array(z.object({
|
|
434
|
+
entityName: z.string().describe('Name of the entity containing observations to delete'),
|
|
435
|
+
observations: z.array(z.string()).describe('Array of exact observation texts to remove'),
|
|
436
|
+
})).describe('Array of observation deletion specifications'),
|
|
437
|
+
};
|
|
438
|
+
export const deleteObservationsTool = {
|
|
439
|
+
capability: deleteObservationsCapability,
|
|
440
|
+
description: deleteObservationsDescription,
|
|
441
|
+
schema: deleteObservationsSchema,
|
|
442
|
+
};
|
|
443
|
+
// Export all graph query tools
|
|
444
|
+
export const graphQueryTools = {
|
|
445
|
+
readGraph: readGraphTool,
|
|
446
|
+
searchNodes: searchNodesTool,
|
|
447
|
+
openNodes: openNodesTool,
|
|
448
|
+
deleteEntities: deleteEntitiesTool,
|
|
449
|
+
deleteRelations: deleteRelationsTool,
|
|
450
|
+
deleteObservations: deleteObservationsTool,
|
|
451
|
+
};
|
|
452
|
+
//# sourceMappingURL=graph-query-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-query-tools.js","sourceRoot":"","sources":["../../../src/tools/graph-query-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,0BAA0B;AAE1B,MAAM,mBAAmB,GAAuB;IAC9C,WAAW,EAAE,wDAAwD;IACrE,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,EAAE;QACd,QAAQ,EAAE,EAAE;KACb;CACF,CAAC;AAEF,MAAM,oBAAoB,GAAgC,GAAG,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAgDpD,CAAC;AAEb,MAAM,eAAe,GAAkB,EAAE,CAAC;AAE1C,MAAM,CAAC,MAAM,aAAa,GAAmB;IAC3C,UAAU,EAAE,mBAAmB;IAC/B,WAAW,EAAE,oBAAoB;IACjC,MAAM,EAAE,eAAe;CACxB,CAAC;A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AAQ,CAAC,4CAA4C,CAAC;KACzF,CAAC,CAAC,CAAC,QAAQ,CAAC,8CAA8C,CAAC;CAC7D,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAmB;IACpD,UAAU,EAAE,4BAA4B;IACxC,WAAW,EAAE,6BAA6B;IAC1C,MAAM,EAAE,wBAAwB;CACjC,CAAC;AAEF,+BAA+B;AAC/B,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,SAAS,EAAE,aAAa;IACxB,WAAW,EAAE,eAAe;IAC5B,SAAS,EAAE,aAAa;IACxB,cAAc,EAAE,kBAAkB;IAClC,eAAe,EAAE,mBAAmB;IACpC,kBAAkB,EAAE,sBAAsB;CAC3C,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ToolDefinition } from './types.js';
|
|
2
|
+
export declare const createEntitiesTool: ToolDefinition;
|
|
3
|
+
export declare const createRelationsTool: ToolDefinition;
|
|
4
|
+
export declare const addObservationsTool: ToolDefinition;
|
|
5
|
+
export declare const hybridSearchTool: ToolDefinition;
|
|
6
|
+
export declare const embedAllEntitiesTool: ToolDefinition;
|
|
7
|
+
export declare const getDetailedContextTool: ToolDefinition;
|
|
8
|
+
export declare const knowledgeGraphTools: {
|
|
9
|
+
createEntities: ToolDefinition;
|
|
10
|
+
createRelations: ToolDefinition;
|
|
11
|
+
addObservations: ToolDefinition;
|
|
12
|
+
hybridSearch: ToolDefinition;
|
|
13
|
+
embedAllEntities: ToolDefinition;
|
|
14
|
+
getDetailedContext: ToolDefinition;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=knowledge-graph-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"knowledge-graph-tools.d.ts","sourceRoot":"","sources":["../../../src/tools/knowledge-graph-tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAmD,MAAM,YAAY,CAAC;AAkF7F,eAAO,MAAM,kBAAkB,EAAE,cAIhC,CAAC;AAmFF,eAAO,MAAM,mBAAmB,EAAE,cAIjC,CAAC;AAgFF,eAAO,MAAM,mBAAmB,EAAE,cAIjC,CAAC;AAuFF,eAAO,MAAM,gBAAgB,EAAE,cAI9B,CAAC;AAkEF,eAAO,MAAM,oBAAoB,EAAE,cAIlC,CAAC;AA+EF,eAAO,MAAM,sBAAsB,EAAE,cAIpC,CAAC;AAGF,eAAO,MAAM,mBAAmB;;;;;;;CAO/B,CAAC"}
|