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.
Files changed (38) hide show
  1. package/README.md +292 -0
  2. package/dist/index.d.ts +3 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +1654 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/src/migrations/migration-manager.d.ts +28 -0
  7. package/dist/src/migrations/migration-manager.d.ts.map +1 -0
  8. package/dist/src/migrations/migration-manager.js +111 -0
  9. package/dist/src/migrations/migration-manager.js.map +1 -0
  10. package/dist/src/migrations/migrations.d.ts +3 -0
  11. package/dist/src/migrations/migrations.d.ts.map +1 -0
  12. package/dist/src/migrations/migrations.js +181 -0
  13. package/dist/src/migrations/migrations.js.map +1 -0
  14. package/dist/src/tools/graph-query-tools.d.ts +16 -0
  15. package/dist/src/tools/graph-query-tools.d.ts.map +1 -0
  16. package/dist/src/tools/graph-query-tools.js +452 -0
  17. package/dist/src/tools/graph-query-tools.js.map +1 -0
  18. package/dist/src/tools/knowledge-graph-tools.d.ts +16 -0
  19. package/dist/src/tools/knowledge-graph-tools.d.ts.map +1 -0
  20. package/dist/src/tools/knowledge-graph-tools.js +482 -0
  21. package/dist/src/tools/knowledge-graph-tools.js.map +1 -0
  22. package/dist/src/tools/migration-tools.d.ts +3 -0
  23. package/dist/src/tools/migration-tools.d.ts.map +1 -0
  24. package/dist/src/tools/migration-tools.js +172 -0
  25. package/dist/src/tools/migration-tools.js.map +1 -0
  26. package/dist/src/tools/rag-tools.d.ts +20 -0
  27. package/dist/src/tools/rag-tools.d.ts.map +1 -0
  28. package/dist/src/tools/rag-tools.js +524 -0
  29. package/dist/src/tools/rag-tools.js.map +1 -0
  30. package/dist/src/tools/tool-registry.d.ts +82 -0
  31. package/dist/src/tools/tool-registry.d.ts.map +1 -0
  32. package/dist/src/tools/tool-registry.js +185 -0
  33. package/dist/src/tools/tool-registry.js.map +1 -0
  34. package/dist/src/tools/types.d.ts +34 -0
  35. package/dist/src/tools/types.d.ts.map +1 -0
  36. package/dist/src/tools/types.js +2 -0
  37. package/dist/src/tools/types.js.map +1 -0
  38. package/package.json +39 -0
@@ -0,0 +1,20 @@
1
+ import { ToolDefinition } from './types.js';
2
+ export declare const storeDocumentTool: ToolDefinition;
3
+ export declare const chunkDocumentTool: ToolDefinition;
4
+ export declare const embedChunksTool: ToolDefinition;
5
+ export declare const extractTermsTool: ToolDefinition;
6
+ export declare const linkEntitiesToDocumentTool: ToolDefinition;
7
+ export declare const getKnowledgeGraphStatsTool: ToolDefinition;
8
+ export declare const deleteDocumentsTool: ToolDefinition;
9
+ export declare const listDocumentsTool: ToolDefinition;
10
+ export declare const ragTools: {
11
+ storeDocument: ToolDefinition;
12
+ chunkDocument: ToolDefinition;
13
+ embedChunks: ToolDefinition;
14
+ extractTerms: ToolDefinition;
15
+ linkEntitiesToDocument: ToolDefinition;
16
+ getKnowledgeGraphStats: ToolDefinition;
17
+ deleteDocuments: ToolDefinition;
18
+ listDocuments: ToolDefinition;
19
+ };
20
+ //# sourceMappingURL=rag-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rag-tools.d.ts","sourceRoot":"","sources":["../../../src/tools/rag-tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAmD,MAAM,YAAY,CAAC;AAgE7F,eAAO,MAAM,iBAAiB,EAAE,cAI/B,CAAC;AAiEF,eAAO,MAAM,iBAAiB,EAAE,cAI/B,CAAC;AAoDF,eAAO,MAAM,eAAe,EAAE,cAI7B,CAAC;AA0EF,eAAO,MAAM,gBAAgB,EAAE,cAI9B,CAAC;AA0DF,eAAO,MAAM,0BAA0B,EAAE,cAIxC,CAAC;AAiEF,eAAO,MAAM,0BAA0B,EAAE,cAIxC,CAAC;AAuEF,eAAO,MAAM,mBAAmB,EAAE,cAIjC,CAAC;AAsEF,eAAO,MAAM,iBAAiB,EAAE,cAI/B,CAAC;AAGF,eAAO,MAAM,QAAQ;;;;;;;;;CASpB,CAAC"}
@@ -0,0 +1,524 @@
1
+ import { z } from 'zod';
2
+ // === STORE DOCUMENT TOOL ===
3
+ const storeDocumentCapability = {
4
+ description: 'Store a document in the system without automatic processing',
5
+ parameters: {
6
+ type: 'object',
7
+ properties: {
8
+ id: {
9
+ type: 'string',
10
+ description: 'Unique identifier for the document'
11
+ },
12
+ content: {
13
+ type: 'string',
14
+ description: 'The full text content of the document'
15
+ },
16
+ metadata: {
17
+ type: 'object',
18
+ description: 'Additional metadata for the document (optional)',
19
+ additionalProperties: true,
20
+ optional: true
21
+ }
22
+ },
23
+ required: ['id', 'content'],
24
+ },
25
+ };
26
+ const storeDocumentDescription = () => `<description>
27
+ Store a document in the system for later processing. **Simple document storage without automatic extraction.**
28
+ AI agents can then choose which processing steps to apply using other tools.
29
+ </description>
30
+
31
+ <importantNotes>
32
+ - (!important!) **Document ID must be unique** - existing documents with same ID will be replaced
33
+ - (!important!) **No automatic processing** - just stores the document text and metadata
34
+ - (!important!) **AI agents control processing** - use other tools for chunking, embedding, extraction
35
+ </importantNotes>
36
+
37
+ <whenToUseThisTool>
38
+ - When you want to store documents for later processing
39
+ - **Before applying specific processing steps** like chunking or extraction
40
+ - When you need custom document processing workflows
41
+ - When storing documents of different types that need different handling
42
+ </whenToUseThisTool>
43
+
44
+ <bestPractices>
45
+ - Use descriptive document IDs that indicate source or content type
46
+ - Include relevant metadata (author, date, source, domain, etc.)
47
+ - Consider document preprocessing before storage
48
+ - Use this as the first step in custom processing workflows
49
+ </bestPractices>
50
+
51
+ <examples>
52
+ - Research paper: {"id": "einstein_1905_relativity", "content": "On the Electrodynamics of Moving Bodies...", "metadata": {"author": "Albert Einstein", "year": 1905, "type": "scientific_paper"}}
53
+ - Business doc: {"id": "quarterly_report_q3", "content": "Q3 2024 Performance Summary...", "metadata": {"type": "financial", "quarter": "Q3", "year": 2024}}
54
+ </examples>`;
55
+ const storeDocumentSchema = {
56
+ id: z.string().describe('Unique identifier for the document'),
57
+ content: z.string().describe('The full text content of the document'),
58
+ metadata: z.record(z.any()).optional().describe('Additional metadata for the document'),
59
+ };
60
+ export const storeDocumentTool = {
61
+ capability: storeDocumentCapability,
62
+ description: storeDocumentDescription,
63
+ schema: storeDocumentSchema,
64
+ };
65
+ // === CHUNK DOCUMENT TOOL ===
66
+ const chunkDocumentCapability = {
67
+ description: 'Create text chunks from a stored document with configurable options',
68
+ parameters: {
69
+ type: 'object',
70
+ properties: {
71
+ documentId: {
72
+ type: 'string',
73
+ description: 'ID of the stored document to chunk'
74
+ },
75
+ maxTokens: {
76
+ type: 'number',
77
+ description: 'Maximum tokens per chunk (default: 200)',
78
+ optional: true
79
+ },
80
+ overlap: {
81
+ type: 'number',
82
+ description: 'Number of overlapping tokens between chunks (default: 20)',
83
+ optional: true
84
+ }
85
+ },
86
+ required: ['documentId'],
87
+ },
88
+ };
89
+ const chunkDocumentDescription = () => `<description>
90
+ Create text chunks from a stored document with configurable chunking parameters.
91
+ **Gives AI agents control over how documents are segmented for processing.**
92
+ </description>
93
+
94
+ <importantNotes>
95
+ - (!important!) **Document must be stored first** using storeDocument
96
+ - (!important!) **Configurable chunking** - adjust maxTokens and overlap as needed
97
+ - (!important!) **Replaces existing chunks** for the document if any exist
98
+ </importantNotes>
99
+
100
+ <whenToUseThisTool>
101
+ - After storing a document with storeDocument
102
+ - When you need specific chunk sizes for different document types
103
+ - **Before embedding chunks** for vector search
104
+ - When optimizing chunk size for your use case
105
+ </whenToUseThisTool>
106
+
107
+ <bestPractices>
108
+ - Smaller chunks (100-150 tokens) for precise retrieval
109
+ - Larger chunks (300-500 tokens) for context preservation
110
+ - Use overlap (10-30 tokens) to maintain continuity
111
+ - Consider document type when choosing chunk size
112
+ </bestPractices>
113
+
114
+ <examples>
115
+ - Default chunking: {"documentId": "doc1"}
116
+ - Custom size: {"documentId": "doc1", "maxTokens": 150, "overlap": 30}
117
+ - Large context: {"documentId": "legal_doc", "maxTokens": 400, "overlap": 50}
118
+ </examples>`;
119
+ const chunkDocumentSchema = {
120
+ documentId: z.string().describe('ID of the stored document to chunk'),
121
+ maxTokens: z.number().default(200).optional().describe('Maximum tokens per chunk'),
122
+ overlap: z.number().default(20).optional().describe('Number of overlapping tokens'),
123
+ };
124
+ export const chunkDocumentTool = {
125
+ capability: chunkDocumentCapability,
126
+ description: chunkDocumentDescription,
127
+ schema: chunkDocumentSchema,
128
+ };
129
+ // === EMBED CHUNKS TOOL ===
130
+ const embedChunksCapability = {
131
+ description: 'Generate vector embeddings for document chunks',
132
+ parameters: {
133
+ type: 'object',
134
+ properties: {
135
+ documentId: {
136
+ type: 'string',
137
+ description: 'ID of the document whose chunks to embed'
138
+ }
139
+ },
140
+ required: ['documentId'],
141
+ },
142
+ };
143
+ const embedChunksDescription = () => `<description>
144
+ Generate vector embeddings for all chunks of a document to enable semantic search.
145
+ **Required for vector similarity search and hybrid search capabilities.**
146
+ </description>
147
+
148
+ <importantNotes>
149
+ - (!important!) **Document must be chunked first** using chunkDocument
150
+ - (!important!) **Generates embeddings** using sentence transformer model
151
+ - (!important!) **Enables vector search** - required for hybridSearch functionality
152
+ </importantNotes>
153
+
154
+ <whenToUseThisTool>
155
+ - After chunking a document with chunkDocument
156
+ - **Before performing vector searches** on the document
157
+ - When building a searchable knowledge base
158
+ - When enabling semantic similarity matching
159
+ </whenToUseThisTool>
160
+
161
+ <bestPractices>
162
+ - Embed chunks after finalizing chunk parameters
163
+ - Monitor embedding quality with test searches
164
+ - Re-embed if changing to a different embedding model
165
+ - Consider computational cost for large document sets
166
+ </bestPractices>
167
+
168
+ <examples>
169
+ - Embed all chunks: {"documentId": "research_paper_1"}
170
+ - After chunking: {"documentId": "technical_manual"}
171
+ </examples>`;
172
+ const embedChunksSchema = {
173
+ documentId: z.string().describe('ID of the document whose chunks to embed'),
174
+ };
175
+ export const embedChunksTool = {
176
+ capability: embedChunksCapability,
177
+ description: embedChunksDescription,
178
+ schema: embedChunksSchema,
179
+ };
180
+ // === EXTRACT TERMS TOOL ===
181
+ const extractTermsCapability = {
182
+ description: 'Extract potential entities/terms from a document with configurable patterns',
183
+ parameters: {
184
+ type: 'object',
185
+ properties: {
186
+ documentId: {
187
+ type: 'string',
188
+ description: 'ID of the document to extract terms from'
189
+ },
190
+ minLength: {
191
+ type: 'number',
192
+ description: 'Minimum term length (default: 3)',
193
+ optional: true
194
+ },
195
+ includeCapitalized: {
196
+ type: 'boolean',
197
+ description: 'Include capitalized words as potential entities (default: true)',
198
+ optional: true
199
+ },
200
+ customPatterns: {
201
+ type: 'array',
202
+ description: 'Custom regex patterns for domain-specific terms (optional)',
203
+ items: { type: 'string' },
204
+ optional: true
205
+ }
206
+ },
207
+ required: ['documentId'],
208
+ },
209
+ };
210
+ const extractTermsDescription = () => `<description>
211
+ Extract potential entity terms from a document using configurable patterns.
212
+ **Simple, flexible term extraction without hardcoded domain bias.**
213
+ AI agents can review results and decide which terms to convert to entities.
214
+ </description>
215
+
216
+ <importantNotes>
217
+ - (!important!) **Document must be stored first** using storeDocument
218
+ - (!important!) **Configurable extraction** - no hardcoded domain assumptions
219
+ - (!important!) **Returns candidates** - AI agent decides which to use
220
+ - (!important!) **No automatic entity creation** - use createEntities for that
221
+ </importantNotes>
222
+
223
+ <whenToUseThisTool>
224
+ - When you need entity candidates from document text
225
+ - **As input for manual entity creation** decisions
226
+ - When applying domain-specific extraction patterns
227
+ - When exploring what entities might exist in documents
228
+ </whenToUseThisTool>
229
+
230
+ <bestPractices>
231
+ - Review extracted terms before creating entities
232
+ - Use domain-specific patterns for specialized documents
233
+ - Combine with manual entity creation for best results
234
+ - Filter results based on relevance to your use case
235
+ </bestPractices>
236
+
237
+ <examples>
238
+ - Basic extraction: {"documentId": "doc1"}
239
+ - Custom settings: {"documentId": "doc1", "minLength": 4, "includeCapitalized": true}
240
+ - Medical terms: {"documentId": "medical_paper", "customPatterns": ["\\\\b\\\\w+itis\\\\b", "\\\\b\\\\w+oma\\\\b"]}
241
+ </examples>`;
242
+ const extractTermsSchema = {
243
+ documentId: z.string().describe('ID of the document to extract terms from'),
244
+ minLength: z.number().default(3).optional().describe('Minimum term length'),
245
+ includeCapitalized: z.boolean().default(true).optional().describe('Include capitalized words'),
246
+ customPatterns: z.array(z.string()).optional().describe('Custom regex patterns for domain terms'),
247
+ };
248
+ export const extractTermsTool = {
249
+ capability: extractTermsCapability,
250
+ description: extractTermsDescription,
251
+ schema: extractTermsSchema,
252
+ };
253
+ // === LINK ENTITIES TO DOCUMENT TOOL ===
254
+ const linkEntitiesToDocumentCapability = {
255
+ description: 'Explicitly link entities to a document for graph-enhanced search',
256
+ parameters: {
257
+ type: 'object',
258
+ properties: {
259
+ documentId: {
260
+ type: 'string',
261
+ description: 'ID of the document to link entities to'
262
+ },
263
+ entityNames: {
264
+ type: 'array',
265
+ description: 'Names of entities to link to the document',
266
+ items: { type: 'string' }
267
+ }
268
+ },
269
+ required: ['documentId', 'entityNames'],
270
+ },
271
+ };
272
+ const linkEntitiesToDocumentDescription = () => `<description>
273
+ Explicitly link existing entities to a document to enable graph-enhanced search.
274
+ **Creates associations between entities and documents for better search results.**
275
+ </description>
276
+
277
+ <importantNotes>
278
+ - (!important!) **Entities must exist** - create them first with createEntities
279
+ - (!important!) **Document must be stored** - use storeDocument first
280
+ - (!important!) **Explicit linking** - AI agent controls which entities are associated
281
+ </importantNotes>
282
+
283
+ <whenToUseThisTool>
284
+ - After creating entities related to a document
285
+ - **To enable graph-enhanced search** on document content
286
+ - When building explicit knowledge connections
287
+ - When entities are mentioned or relevant to the document
288
+ </whenToUseThisTool>
289
+
290
+ <bestPractices>
291
+ - Link entities that are actually mentioned in the document
292
+ - Include both explicit mentions and relevant concepts
293
+ - Use after manual entity creation for precision
294
+ - Consider both direct and indirect entity relationships
295
+ </bestPractices>
296
+
297
+ <examples>
298
+ - Link research entities: {"documentId": "ml_paper", "entityNames": ["Machine Learning", "Neural Networks", "Deep Learning"]}
299
+ - Business entities: {"documentId": "quarterly_report", "entityNames": ["Q3 2024", "Revenue", "Growth Strategy"]}
300
+ </examples>`;
301
+ const linkEntitiesToDocumentSchema = {
302
+ documentId: z.string().describe('ID of the document to link entities to'),
303
+ entityNames: z.array(z.string()).describe('Names of entities to link to the document'),
304
+ };
305
+ export const linkEntitiesToDocumentTool = {
306
+ capability: linkEntitiesToDocumentCapability,
307
+ description: linkEntitiesToDocumentDescription,
308
+ schema: linkEntitiesToDocumentSchema,
309
+ };
310
+ // === GET KNOWLEDGE GRAPH STATS TOOL ===
311
+ const getStatsCapability = {
312
+ description: 'Get comprehensive statistics about the knowledge graph and RAG system state',
313
+ parameters: {
314
+ type: 'object',
315
+ properties: {},
316
+ required: [],
317
+ },
318
+ };
319
+ const getStatsDescription = () => `<description>
320
+ Get comprehensive statistics about your knowledge graph and RAG system to understand its current state and content.
321
+ **Essential for monitoring system health and understanding your knowledge base composition.**
322
+ Provides insights into entities, relationships, documents, and overall system utilization.
323
+ </description>
324
+
325
+ <importantNotes>
326
+ - (!important!) **Real-time statistics** - reflects current system state
327
+ - (!important!) Includes breakdowns by type for entities and relationships
328
+ - (!important!) Shows document and chunk counts for RAG system health
329
+ - (!important!) **Use regularly** to monitor system growth and balance
330
+ </importantNotes>
331
+
332
+ <whenToUseThisTool>
333
+ - **Before major operations** - to understand current system state
334
+ - When planning knowledge base expansion or optimization
335
+ - For debugging and troubleshooting system issues
336
+ - When generating reports on knowledge base contents
337
+ - After bulk operations to verify results
338
+ - When analyzing knowledge domain coverage
339
+ </whenToUseThisTool>
340
+
341
+ <features>
342
+ - Complete entity counts with type breakdowns
343
+ - Relationship statistics with type distributions
344
+ - Document and chunk inventory
345
+ - Vector index health indicators
346
+ - Knowledge graph connectivity metrics
347
+ - Growth and utilization analytics
348
+ </features>
349
+
350
+ <bestPractices>
351
+ - Check stats before and after major operations
352
+ - Monitor entity type distributions for domain balance
353
+ - Track relationship diversity for graph connectivity
354
+ - Use stats to identify knowledge gaps or imbalances
355
+ - Regular monitoring helps detect processing issues
356
+ - Document stats over time for trend analysis
357
+ </bestPractices>
358
+
359
+ <parameters>
360
+ - None required - returns comprehensive system statistics
361
+ </parameters>
362
+
363
+ <examples>
364
+ - System health check: {} (no parameters needed)
365
+ - Post-processing verification: {} (check stats after adding documents)
366
+ - Planning analysis: {} (understand current state before expansion)
367
+ </examples>`;
368
+ const getStatsSchema = {};
369
+ export const getKnowledgeGraphStatsTool = {
370
+ capability: getStatsCapability,
371
+ description: getStatsDescription,
372
+ schema: getStatsSchema,
373
+ };
374
+ // === DELETE DOCUMENT(S) TOOL ===
375
+ const deleteDocumentsCapability = {
376
+ description: 'Delete one or multiple documents and all their associated data',
377
+ parameters: {
378
+ type: 'object',
379
+ properties: {
380
+ documentIds: {
381
+ type: 'array',
382
+ description: 'Document ID(s) to delete - can be a single string or array of strings',
383
+ items: { type: 'string' }
384
+ }
385
+ },
386
+ required: ['documentIds'],
387
+ },
388
+ };
389
+ const deleteDocumentsDescription = () => `<description>
390
+ Delete one or multiple documents and all their associated data including chunks, embeddings, and entity associations.
391
+ **Flexible tool that handles both single and bulk document deletion.**
392
+ Ensures no orphaned data remains after document removal.
393
+ </description>
394
+
395
+ <importantNotes>
396
+ - (!important!) **Permanent deletion** - cannot be undone without backup
397
+ - (!important!) **Flexible input** - accepts single document ID or array of IDs
398
+ - (!important!) **Cascades to all related data** - chunks, embeddings, entity links
399
+ - (!important!) **Continues on errors** - won't stop if some documents don't exist
400
+ </importantNotes>
401
+
402
+ <whenToUseThisTool>
403
+ - When removing one or more obsolete documents
404
+ - **After verification** of document(s) to be deleted using listDocuments
405
+ - When cleaning up test or temporary documents
406
+ - For knowledge base maintenance and cleanup operations
407
+ </whenToUseThisTool>
408
+
409
+ <features>
410
+ - Single or bulk deletion in one tool
411
+ - Automatic cascade deletion for each document
412
+ - Detailed reporting of successful/failed deletions
413
+ - Error resilience - continues processing on failures
414
+ - Maintains system integrity across all deletions
415
+ </features>
416
+
417
+ <bestPractices>
418
+ - ALWAYS verify document IDs before deletion using listDocuments
419
+ - Use getKnowledgeGraphStats to understand impact
420
+ - Consider backing up important documents before deletion
421
+ - Monitor system stats after deletion to verify cleanup
422
+ </bestPractices>
423
+
424
+ <parameters>
425
+ - documentIds: Single document ID (string) or array of document IDs (string[])
426
+ </parameters>
427
+
428
+ <examples>
429
+ - Single document: {"documentIds": "old_manual_v1"}
430
+ - Multiple documents: {"documentIds": ["test_doc_1", "test_doc_2", "test_doc_3"]}
431
+ - Clean all test docs: {"documentIds": ["demo1", "demo2", "sample1", "sample2"]}
432
+ </examples>`;
433
+ const deleteDocumentsSchema = {
434
+ documentIds: z.union([
435
+ z.string().describe('Single document ID to delete'),
436
+ z.array(z.string()).describe('Array of document IDs to delete')
437
+ ]).describe('Document ID(s) to delete - can be a single string or array of strings'),
438
+ };
439
+ export const deleteDocumentsTool = {
440
+ capability: deleteDocumentsCapability,
441
+ description: deleteDocumentsDescription,
442
+ schema: deleteDocumentsSchema,
443
+ };
444
+ // === LIST DOCUMENTS TOOL ===
445
+ const listDocumentsCapability = {
446
+ description: 'List all documents in the knowledge base with their metadata',
447
+ parameters: {
448
+ type: 'object',
449
+ properties: {
450
+ includeMetadata: {
451
+ type: 'boolean',
452
+ description: 'Include document metadata in results (default: true)',
453
+ optional: true
454
+ }
455
+ },
456
+ required: [],
457
+ },
458
+ };
459
+ const listDocumentsDescription = () => `<description>
460
+ List all documents currently stored in the knowledge base with their IDs and metadata.
461
+ **Essential for discovering what documents exist before performing operations.**
462
+ Provides overview of document collection for maintenance and organization.
463
+ </description>
464
+
465
+ <importantNotes>
466
+ - (!important!) **Shows all documents** regardless of chunking or embedding status
467
+ - (!important!) **Includes metadata** for document identification and categorization
468
+ - (!important!) **Real-time listing** - reflects current database state
469
+ - (!important!) **Use before deletion** to verify what exists
470
+ </importantNotes>
471
+
472
+ <whenToUseThisTool>
473
+ - **Before deletion operations** to see what documents exist
474
+ - When auditing document collections
475
+ - For discovering orphaned or forgotten documents
476
+ - When planning document organization or cleanup
477
+ - For debugging document-related issues
478
+ </whenToUseThisTool>
479
+
480
+ <features>
481
+ - Complete document inventory with IDs
482
+ - Optional metadata inclusion for context
483
+ - Document creation timestamps
484
+ - Efficient listing without content retrieval
485
+ - Suitable for large document collections
486
+ </features>
487
+
488
+ <bestPractices>
489
+ - Use regularly to maintain awareness of document collection
490
+ - Check before bulk operations to verify targets
491
+ - Review metadata to identify document purposes
492
+ - Use for planning cleanup and organization strategies
493
+ - Monitor document growth over time
494
+ </bestPractices>
495
+
496
+ <parameters>
497
+ - includeMetadata: Whether to include metadata (boolean, optional, default: true)
498
+ </parameters>
499
+
500
+ <examples>
501
+ - Full listing: {} (no parameters needed)
502
+ - IDs only: {"includeMetadata": false}
503
+ - Complete inventory: {"includeMetadata": true}
504
+ </examples>`;
505
+ const listDocumentsSchema = {
506
+ includeMetadata: z.boolean().default(true).optional().describe('Include document metadata in results'),
507
+ };
508
+ export const listDocumentsTool = {
509
+ capability: listDocumentsCapability,
510
+ description: listDocumentsDescription,
511
+ schema: listDocumentsSchema,
512
+ };
513
+ // Export all RAG tools
514
+ export const ragTools = {
515
+ storeDocument: storeDocumentTool,
516
+ chunkDocument: chunkDocumentTool,
517
+ embedChunks: embedChunksTool,
518
+ extractTerms: extractTermsTool,
519
+ linkEntitiesToDocument: linkEntitiesToDocumentTool,
520
+ getKnowledgeGraphStats: getKnowledgeGraphStatsTool,
521
+ deleteDocuments: deleteDocumentsTool,
522
+ listDocuments: listDocumentsTool,
523
+ };
524
+ //# sourceMappingURL=rag-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rag-tools.js","sourceRoot":"","sources":["../../../src/tools/rag-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,8BAA8B;AAE9B,MAAM,uBAAuB,GAAuB;IAClD,WAAW,EAAE,6DAA6D;IAC1E,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,EAAE,EAAE;gBACF,IAAI,EAAE,QAAQ;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AAI,EAAE,SAAS;gBACf,WAAW,EAAE,sDAAsD;gBACnE,QAAQ,EAAE,IAAI;aACf;SACF;QACD,QAAQ,EAAE,EAAE;KACb;CACF,CAAC;AAEF,MAAM,wBAAwB,GAAgC,GAAG,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA6CxD,CAAC;AAEb,MAAM,mBAAmB,GAAkB;IACzC,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,sCAAsC,CAAC;CACvG,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAmB;IAC/C,UAAU,EAAE,uBAAuB;IACnC,WAAW,EAAE,wBAAwB;IACrC,MAAM,EAAE,mBAAmB;CAC5B,CAAC;AAEF,uBAAuB;AACvB,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,aAAa,EAAE,iBAAiB;IAChC,aAAa,EAAE,iBAAiB;IAChC,WAAW,EAAE,eAAe;IAC5B,YAAY,EAAE,gBAAgB;IAC9B,sBAAsB,EAAE,0BAA0B;IAClD,sBAAsB,EAAE,0BAA0B;IAClD,eAAe,EAAE,mBAAmB;IACpC,aAAa,EAAE,iBAAiB;CACjC,CAAC"}
@@ -0,0 +1,82 @@
1
+ import { ToolDefinition, MCPTool } from './types.js';
2
+ export declare const allTools: {
3
+ readGraph: ToolDefinition;
4
+ searchNodes: ToolDefinition;
5
+ openNodes: ToolDefinition;
6
+ deleteEntities: ToolDefinition;
7
+ deleteRelations: ToolDefinition;
8
+ deleteObservations: ToolDefinition;
9
+ storeDocument: ToolDefinition;
10
+ chunkDocument: ToolDefinition;
11
+ embedChunks: ToolDefinition;
12
+ extractTerms: ToolDefinition;
13
+ linkEntitiesToDocument: ToolDefinition;
14
+ getKnowledgeGraphStats: ToolDefinition;
15
+ deleteDocuments: ToolDefinition;
16
+ listDocuments: ToolDefinition;
17
+ createEntities: ToolDefinition;
18
+ createRelations: ToolDefinition;
19
+ addObservations: ToolDefinition;
20
+ hybridSearch: ToolDefinition;
21
+ embedAllEntities: ToolDefinition;
22
+ getDetailedContext: ToolDefinition;
23
+ };
24
+ export declare const globalSettings: {
25
+ version: string;
26
+ systemName: string;
27
+ defaultTimeout: number;
28
+ };
29
+ /**
30
+ * Convert a structured ToolDefinition to MCP tool format
31
+ */
32
+ export declare function convertToMCPTool(name: string, toolDef: ToolDefinition): MCPTool;
33
+ /**
34
+ * Get all tools in MCP format
35
+ */
36
+ export declare function getAllMCPTools(): MCPTool[];
37
+ /**
38
+ * Get a specific tool definition by name
39
+ */
40
+ export declare function getToolDefinition(name: string): ToolDefinition | undefined;
41
+ /**
42
+ * Validate tool arguments using Zod schema
43
+ */
44
+ export declare function validateToolArgs<T>(toolName: string, args: any): T;
45
+ /**
46
+ * Get tool names organized by category
47
+ */
48
+ export declare function getToolsByCategory(): {
49
+ knowledgeGraph: string[];
50
+ rag: string[];
51
+ graphQuery: string[];
52
+ migration: string[];
53
+ all: string[];
54
+ };
55
+ /**
56
+ * Get comprehensive tool documentation
57
+ */
58
+ export declare function getToolDocumentation(toolName: string): string;
59
+ /**
60
+ * Get system information and tool summary
61
+ */
62
+ export declare function getSystemInfo(): {
63
+ system: {
64
+ version: string;
65
+ systemName: string;
66
+ defaultTimeout: number;
67
+ };
68
+ toolCounts: {
69
+ knowledgeGraph: number;
70
+ rag: number;
71
+ graphQuery: number;
72
+ total: number;
73
+ };
74
+ availableTools: {
75
+ knowledgeGraph: string[];
76
+ rag: string[];
77
+ graphQuery: string[];
78
+ migration: string[];
79
+ all: string[];
80
+ };
81
+ };
82
+ //# sourceMappingURL=tool-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-registry.d.ts","sourceRoot":"","sources":["../../../src/tools/tool-registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAOrD,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;CAMpB,CAAC;AAGF,eAAO,MAAM,cAAc;;;;CAI1B,CAAC;AAEF;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAyB/E;AA6FD;;GAEG;AACH,wBAAgB,cAAc,IAAI,OAAO,EAAE,CAI1C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAE1E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,CAQlE;AAED;;GAEG;AACH,wBAAgB,kBAAkB;;;;;;EAQjC;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAO7D;AAED;;GAEG;AACH,wBAAgB,aAAa;;;;;;;;;;;;;;;;;;;EAY5B"}