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,482 @@
1
+ import { z } from 'zod';
2
+ // === CREATE ENTITIES TOOL ===
3
+ const createEntitiesCapability = {
4
+ description: 'Create multiple new entities in the knowledge graph with comprehensive metadata',
5
+ parameters: {
6
+ type: 'object',
7
+ properties: {
8
+ entities: {
9
+ type: 'array',
10
+ description: 'Array of entities to create in the knowledge graph',
11
+ items: {
12
+ type: 'object'
13
+ }
14
+ }
15
+ },
16
+ required: ['entities'],
17
+ },
18
+ };
19
+ const createEntitiesDescription = () => `<description>
20
+ Create multiple new entities in the knowledge graph with comprehensive metadata and observations.
21
+ **Essential for building the foundational structure of your knowledge representation.**
22
+ Use this tool to add new concepts, people, places, or any identifiable objects to your graph.
23
+ </description>
24
+
25
+ <importantNotes>
26
+ - (!important!) **Entities are the building blocks** of your knowledge graph - use descriptive names
27
+ - (!important!) EntityType helps categorize and filter entities (e.g., PERSON, CONCEPT, PLACE, TECHNOLOGY)
28
+ - (!important!) Observations provide context and evidence for the entity's existence or properties
29
+ - (!important!) **Avoid duplicate entities** - check if similar entities exist first using search_nodes
30
+ </importantNotes>
31
+
32
+ <whenToUseThisTool>
33
+ - When introducing new concepts, people, or objects into your knowledge base
34
+ - When processing documents and need to extract and formalize key entities
35
+ - When building domain-specific knowledge representations
36
+ - When creating structured data from unstructured text
37
+ - **Before creating relationships** - ensure both entities exist
38
+ - When migrating knowledge from other systems into the graph
39
+ </whenToUseThisTool>
40
+
41
+ <features>
42
+ - Batch creation of multiple entities in a single operation
43
+ - Automatic unique ID generation based on entity names
44
+ - Support for custom entity types for domain categorization
45
+ - Rich observation arrays for evidence and context
46
+ - Automatic deduplication (existing entities are ignored)
47
+ - Metadata support for extensible entity properties
48
+ </features>
49
+
50
+ <bestPractices>
51
+ - Use consistent naming conventions (e.g., "John Smith" not "john smith")
52
+ - Choose meaningful entityTypes that reflect your domain (PERSON, TECHNOLOGY, CONCEPT, etc.)
53
+ - Include rich observations that provide context and evidence
54
+ - Group related entity creation for better performance
55
+ - Use descriptive names that uniquely identify the entity
56
+ - Consider hierarchical naming for complex domains (e.g., "JavaScript.React.Hooks")
57
+ </bestPractices>
58
+
59
+ <parameters>
60
+ - entities: Array of entity objects, each containing:
61
+ - name: Unique identifier/name for the entity (string, required)
62
+ - entityType: Category/classification of the entity (string, required)
63
+ - observations: Array of contextual information and evidence (string[], required)
64
+ </parameters>
65
+
66
+ <examples>
67
+ - Adding people: {"entities": [{"name": "Albert Einstein", "entityType": "PERSON", "observations": ["Physicist who developed relativity theory", "Nobel Prize winner in 1921"]}]}
68
+ - Adding concepts: {"entities": [{"name": "Machine Learning", "entityType": "CONCEPT", "observations": ["Subset of artificial intelligence", "Focuses on learning from data"]}]}
69
+ - Adding technologies: {"entities": [{"name": "React", "entityType": "TECHNOLOGY", "observations": ["JavaScript library for building UIs", "Developed by Facebook"]}]}
70
+ </examples>`;
71
+ const createEntitiesSchema = {
72
+ entities: z.array(z.object({
73
+ name: z.string().describe('The unique name/identifier of the entity'),
74
+ entityType: z.string().describe('The category or type of the entity (e.g., PERSON, CONCEPT, TECHNOLOGY)'),
75
+ observations: z.array(z.string()).describe('Array of contextual observations about the entity'),
76
+ })).describe('Array of entities to create in the knowledge graph'),
77
+ };
78
+ export const createEntitiesTool = {
79
+ capability: createEntitiesCapability,
80
+ description: createEntitiesDescription,
81
+ schema: createEntitiesSchema,
82
+ };
83
+ // === CREATE RELATIONS TOOL ===
84
+ const createRelationsCapability = {
85
+ description: 'Create multiple relationships between entities in the knowledge graph',
86
+ parameters: {
87
+ type: 'object',
88
+ properties: {
89
+ relations: {
90
+ type: 'array',
91
+ description: 'Array of relationships to create between existing entities',
92
+ items: {
93
+ type: 'object'
94
+ }
95
+ }
96
+ },
97
+ required: ['relations'],
98
+ },
99
+ };
100
+ const createRelationsDescription = () => `<description>
101
+ Create multiple relationships between entities in the knowledge graph to establish connections and semantic links.
102
+ **Critical for building the interconnected structure that makes knowledge graphs powerful.**
103
+ Relationships define how entities relate to each other, enabling graph traversal and inference.
104
+ </description>
105
+
106
+ <importantNotes>
107
+ - (!important!) **Both entities must exist** before creating relationships - entities are auto-created if missing
108
+ - (!important!) Relationship types should be consistent and meaningful (e.g., IS_A, HAS, USES, IMPLEMENTS)
109
+ - (!important!) Direction matters: "from" → "to" represents the relationship direction
110
+ - (!important!) **Avoid redundant relationships** - check existing connections first
111
+ </importantNotes>
112
+
113
+ <whenToUseThisTool>
114
+ - When establishing semantic connections between concepts
115
+ - After creating entities that should be connected
116
+ - When processing text that implies relationships
117
+ - When building domain-specific ontologies
118
+ - When migrating relational data into graph format
119
+ - **Before querying graph paths** - ensure proper connectivity
120
+ </whenToUseThisTool>
121
+
122
+ <features>
123
+ - Batch creation of multiple relationships in one operation
124
+ - Automatic entity creation if referenced entities don't exist
125
+ - Support for custom relationship types
126
+ - Bidirectional relationship awareness
127
+ - Confidence scoring and metadata support
128
+ - Deduplication of identical relationships
129
+ </features>
130
+
131
+ <bestPractices>
132
+ - Use consistent relationship types across your domain
133
+ - Choose clear, unambiguous relationship names (IS_A, PART_OF, IMPLEMENTS)
134
+ - Consider both directions when appropriate (if A USES B, does B DEPEND_ON A?)
135
+ - Group related relationship creation for better performance
136
+ - Use verb-like relationship types that read naturally
137
+ - Document relationship semantics for complex domains
138
+ </bestPractices>
139
+
140
+ <parameters>
141
+ - relations: Array of relationship objects, each containing:
142
+ - from: Name of the source entity (string, required)
143
+ - to: Name of the target entity (string, required)
144
+ - relationType: Type/category of the relationship (string, required)
145
+ </parameters>
146
+
147
+ <examples>
148
+ - Inheritance: {"relations": [{"from": "Dog", "to": "Animal", "relationType": "IS_A"}]}
149
+ - Usage: {"relations": [{"from": "React", "to": "JavaScript", "relationType": "USES"}]}
150
+ - Composition: {"relations": [{"from": "Car", "to": "Engine", "relationType": "HAS"}]}
151
+ - Multiple: {"relations": [{"from": "Einstein", "to": "Relativity", "relationType": "DEVELOPED"}, {"from": "Relativity", "to": "Physics", "relationType": "PART_OF"}]}
152
+ </examples>`;
153
+ const createRelationsSchema = {
154
+ relations: z.array(z.object({
155
+ from: z.string().describe('Name of the source entity in the relationship'),
156
+ to: z.string().describe('Name of the target entity in the relationship'),
157
+ relationType: z.string().describe('Type of relationship (e.g., IS_A, HAS, USES, IMPLEMENTS)'),
158
+ })).describe('Array of relationships to create between entities'),
159
+ };
160
+ export const createRelationsTool = {
161
+ capability: createRelationsCapability,
162
+ description: createRelationsDescription,
163
+ schema: createRelationsSchema,
164
+ };
165
+ // === ADD OBSERVATIONS TOOL ===
166
+ const addObservationsCapability = {
167
+ description: 'Add new observations to existing entities to enrich their context and evidence',
168
+ parameters: {
169
+ type: 'object',
170
+ properties: {
171
+ observations: {
172
+ type: 'array',
173
+ description: 'Array of observation additions for specific entities',
174
+ items: {
175
+ type: 'object'
176
+ }
177
+ }
178
+ },
179
+ required: ['observations'],
180
+ },
181
+ };
182
+ const addObservationsDescription = () => `<description>
183
+ Add new observations to existing entities to continuously enrich their context, evidence, and understanding.
184
+ **Essential for keeping your knowledge graph current and comprehensive.**
185
+ Observations provide the factual foundation that supports entity existence and properties.
186
+ </description>
187
+
188
+ <importantNotes>
189
+ - (!important!) **Entity must exist** - this tool only adds to existing entities
190
+ - (!important!) Only new observations are added - duplicates are automatically filtered
191
+ - (!important!) Observations are cumulative - they build the entity's knowledge base
192
+ - (!important!) **Be specific and factual** - observations should be verifiable statements
193
+ </importantNotes>
194
+
195
+ <whenToUseThisTool>
196
+ - When you discover new information about existing entities
197
+ - After processing additional documents that mention known entities
198
+ - When updating entity knowledge from new sources
199
+ - When refining and expanding entity descriptions
200
+ - **Before making knowledge-based decisions** - ensure entities have sufficient context
201
+ - When correcting or expanding incomplete entity information
202
+ </whenToUseThisTool>
203
+
204
+ <features>
205
+ - Batch addition of observations to multiple entities
206
+ - Automatic duplicate filtering - no redundant observations
207
+ - Supports rich textual observations with context
208
+ - Maintains observation history and chronology
209
+ - Integrates with document processing workflows
210
+ - Enables incremental knowledge building
211
+ </features>
212
+
213
+ <bestPractices>
214
+ - Keep observations factual and specific rather than general
215
+ - Include source context when possible ("According to paper X...")
216
+ - Use consistent terminology across observations
217
+ - Add complementary observations that provide different perspectives
218
+ - Include temporal information when relevant ("As of 2024...")
219
+ - Group related observations by topic or source
220
+ </bestPractices>
221
+
222
+ <parameters>
223
+ - observations: Array of observation addition objects, each containing:
224
+ - entityName: Name of the existing entity to update (string, required)
225
+ - contents: Array of new observation strings to add (string[], required)
226
+ </parameters>
227
+
228
+ <examples>
229
+ - Scientific updates: {"observations": [{"entityName": "Quantum Computing", "contents": ["IBM achieved quantum advantage in 2024", "Shows promise for cryptography applications"]}]}
230
+ - Person details: {"observations": [{"entityName": "Marie Curie", "contents": ["First woman to win Nobel Prize", "Won Nobel Prizes in two different sciences"]}]}
231
+ - Technology evolution: {"observations": [{"entityName": "React", "contents": ["React 18 introduced concurrent features", "Widely adopted for enterprise applications"]}]}
232
+ </examples>`;
233
+ const addObservationsSchema = {
234
+ observations: z.array(z.object({
235
+ entityName: z.string().describe('Name of the existing entity to add observations to'),
236
+ contents: z.array(z.string()).describe('Array of new observation strings to add'),
237
+ })).describe('Array of observation additions for specific entities'),
238
+ };
239
+ export const addObservationsTool = {
240
+ capability: addObservationsCapability,
241
+ description: addObservationsDescription,
242
+ schema: addObservationsSchema,
243
+ };
244
+ // === HYBRID SEARCH TOOL ===
245
+ const hybridSearchCapability = {
246
+ description: 'Perform advanced hybrid search combining vector similarity with knowledge graph traversal',
247
+ parameters: {
248
+ type: 'object',
249
+ properties: {
250
+ query: {
251
+ type: 'string',
252
+ description: 'The search query to find relevant information'
253
+ },
254
+ limit: {
255
+ type: 'number',
256
+ description: 'Maximum number of results to return',
257
+ default: 5
258
+ },
259
+ useGraph: {
260
+ type: 'boolean',
261
+ description: 'Whether to enhance results with knowledge graph connections',
262
+ default: true
263
+ }
264
+ },
265
+ required: ['query'],
266
+ },
267
+ };
268
+ const hybridSearchDescription = () => `<description>
269
+ Perform sophisticated hybrid search that combines vector similarity with knowledge graph traversal for superior results.
270
+ **The most powerful search tool in the system** - leverages both semantic similarity and structural relationships.
271
+ Perfect for complex queries that benefit from both content matching and conceptual connections.
272
+ </description>
273
+
274
+ <importantNotes>
275
+ - (!important!) **Hybrid approach is more powerful** than pure vector or graph search alone
276
+ - (!important!) Graph enhancement finds related concepts even if not directly mentioned
277
+ - (!important!) Results include similarity scores, graph boost, and hybrid rankings
278
+ - (!important!) **Best results when knowledge graph is well-populated** with entities and relationships
279
+ </importantNotes>
280
+
281
+ <whenToUseThisTool>
282
+ - When you need comprehensive search across documents and knowledge
283
+ - For complex queries requiring conceptual understanding
284
+ - When exploring relationships between concepts
285
+ - **Before making decisions** - to gather all relevant information
286
+ - When researching topics that span multiple domains
287
+ - For discovery of implicit connections and patterns
288
+ </whenToUseThisTool>
289
+
290
+ <features>
291
+ - Vector similarity search using sentence transformers
292
+ - Knowledge graph traversal for conceptual enhancement
293
+ - Hybrid scoring combining multiple relevance signals
294
+ - Entity association highlighting
295
+ - Configurable result limits and graph usage
296
+ - Rich result metadata with multiple ranking scores
297
+ </features>
298
+
299
+ <bestPractices>
300
+ - Use natural language queries rather than keywords
301
+ - Enable graph enhancement for better conceptual coverage
302
+ - Start with broader queries, then narrow down based on results
303
+ - Review entity associations to understand why results were selected
304
+ - Use appropriate limits based on your analysis needs
305
+ - Combine with other tools for comprehensive knowledge exploration
306
+ </bestPractices>
307
+
308
+ <parameters>
309
+ - query: Natural language search query (string, required)
310
+ - limit: Maximum results to return, default 5 (number, optional)
311
+ - useGraph: Enable knowledge graph enhancement, default true (boolean, optional)
312
+ </parameters>
313
+
314
+ <examples>
315
+ - Conceptual search: {"query": "machine learning applications in healthcare", "limit": 10}
316
+ - Technical research: {"query": "React performance optimization techniques", "useGraph": true}
317
+ - Discovery mode: {"query": "Einstein's contributions to modern physics", "limit": 15}
318
+ - Quick lookup: {"query": "quantum computing advantages", "limit": 3, "useGraph": false}
319
+ </examples>`;
320
+ const hybridSearchSchema = {
321
+ query: z.string().describe('The search query to find relevant information'),
322
+ limit: z.number().optional().default(5).describe('Maximum number of results to return'),
323
+ useGraph: z.boolean().optional().default(true).describe('Whether to enhance results with knowledge graph connections'),
324
+ };
325
+ export const hybridSearchTool = {
326
+ capability: hybridSearchCapability,
327
+ description: hybridSearchDescription,
328
+ schema: hybridSearchSchema,
329
+ };
330
+ // === EMBED ALL ENTITIES TOOL ===
331
+ const embedAllEntitiesCapability = {
332
+ description: 'Generate semantic embeddings for all entities in the knowledge graph to enable vector search',
333
+ parameters: {
334
+ type: 'object',
335
+ properties: {},
336
+ required: [],
337
+ },
338
+ };
339
+ const embedAllEntitiesDescription = () => `<description>
340
+ Generate semantic vector embeddings for all entities in the knowledge graph to enable semantic search.
341
+ **Essential for upgrading your knowledge graph to use semantic vector search instead of pattern matching.**
342
+ This tool creates embeddings from entity names, types, and observations for powerful semantic discovery.
343
+ </description>
344
+
345
+ <importantNotes>
346
+ - (!important!) **Processes all entities** in the knowledge graph at once
347
+ - (!important!) **Enables semantic search** - required for vector-based entity discovery
348
+ - (!important!) **Replaces pattern matching** with intelligent similarity search
349
+ - (!important!) **Automatic for new entities** - only needed once for existing entities
350
+ </importantNotes>
351
+
352
+ <whenToUseThisTool>
353
+ - **After importing existing entities** that don't have embeddings yet
354
+ - When upgrading from pattern-based to semantic search
355
+ - When entities have been created without automatic embedding generation
356
+ - After significant updates to entity observations that require re-embedding
357
+ - When setting up semantic search capabilities for the first time
358
+ </whenToUseThisTool>
359
+
360
+ <features>
361
+ - Batch processing of all entities in the knowledge graph
362
+ - Generates embeddings from entity names, types, and observations
363
+ - Creates searchable vector representations using sentence transformers
364
+ - Enables semantic similarity search across all entities
365
+ - Automatic handling of embedding generation and storage
366
+ - Progress reporting for large entity collections
367
+ </features>
368
+
369
+ <bestPractices>
370
+ - Run once after importing entities from other systems
371
+ - Use when transitioning from pattern-based to semantic search
372
+ - Monitor progress output for large knowledge graphs
373
+ - Ensure embedding model is properly initialized before running
374
+ - Consider running after major entity data updates
375
+ - Use as a one-time setup tool for existing knowledge graphs
376
+ </bestPractices>
377
+
378
+ <parameters>
379
+ - No parameters required - processes all entities automatically
380
+ </parameters>
381
+
382
+ <examples>
383
+ - Initial setup: {} (no parameters needed)
384
+ - After import: {} (processes all existing entities)
385
+ - Post-migration: {} (enables semantic search for imported data)
386
+ </examples>`;
387
+ const embedAllEntitiesSchema = {
388
+ // No parameters needed
389
+ };
390
+ export const embedAllEntitiesTool = {
391
+ capability: embedAllEntitiesCapability,
392
+ description: embedAllEntitiesDescription,
393
+ schema: embedAllEntitiesSchema,
394
+ };
395
+ // === GET DETAILED CONTEXT TOOL ===
396
+ const getDetailedContextCapability = {
397
+ description: 'Retrieve detailed context for a specific chunk including surrounding content',
398
+ parameters: {
399
+ type: 'object',
400
+ properties: {
401
+ chunkId: {
402
+ type: 'string',
403
+ description: 'ID of the chunk to get detailed context for'
404
+ },
405
+ includeSurrounding: {
406
+ type: 'boolean',
407
+ description: 'Whether to include surrounding chunks for better context',
408
+ default: true
409
+ }
410
+ },
411
+ required: ['chunkId'],
412
+ },
413
+ };
414
+ const getDetailedContextDescription = () => `<description>
415
+ Retrieve comprehensive detailed context for a specific chunk, including the full text and surrounding content.
416
+ **Essential companion to hybridSearch** - use this to get complete context after reviewing search summaries.
417
+ Perfect drill-down tool for exploring the full content behind search result highlights.
418
+ </description>
419
+
420
+ <importantNotes>
421
+ - (!important!) **Use after hybridSearch** - to explore full context of interesting results
422
+ - (!important!) **Returns complete chunk text** - not just summaries or highlights
423
+ - (!important!) **Includes surrounding chunks** - for better context understanding
424
+ - (!important!) **Shows entity associations** - to understand knowledge graph connections
425
+ </importantNotes>
426
+
427
+ <whenToUseThisTool>
428
+ - **After reviewing hybridSearch results** - to get full context of interesting chunks
429
+ - When search summaries indicate relevant content that needs complete analysis
430
+ - When you need full text for decision making or detailed understanding
431
+ - When exploring content around a specific passage or concept
432
+ - For reading complete passages in their original document context
433
+ - When entity associations in search results warrant deeper investigation
434
+ </whenToUseThisTool>
435
+
436
+ <features>
437
+ - Complete chunk text retrieval without truncation
438
+ - Automatic surrounding chunk inclusion for context
439
+ - Entity association information for knowledge graph insights
440
+ - Document metadata and title for source identification
441
+ - Structured context with clear before/after chunk positioning
442
+ - Efficient lookup by chunk ID from search results
443
+ </features>
444
+
445
+ <bestPractices>
446
+ - Use hybridSearch first to identify relevant chunks of interest
447
+ - Review search summaries before requesting detailed context
448
+ - Use surrounding context to understand passage flow and meaning
449
+ - Pay attention to entity associations for related concept exploration
450
+ - Combine with additional searches based on detailed context insights
451
+ - Use for final verification when making knowledge-based decisions
452
+ </bestPractices>
453
+
454
+ <parameters>
455
+ - chunkId: Chunk ID from search results (string, required)
456
+ - includeSurrounding: Include before/after chunks, default true (boolean, optional)
457
+ </parameters>
458
+
459
+ <examples>
460
+ - Full context: {"chunkId": "doc1_chunk_5"}
461
+ - Context only: {"chunkId": "doc1_chunk_5", "includeSurrounding": false}
462
+ - From search: {"chunkId": "advanced_delivery_features_technical_chunk_2"}
463
+ </examples>`;
464
+ const getDetailedContextSchema = {
465
+ chunkId: z.string().describe('ID of the chunk to get detailed context for'),
466
+ includeSurrounding: z.boolean().optional().default(true).describe('Whether to include surrounding chunks for better context'),
467
+ };
468
+ export const getDetailedContextTool = {
469
+ capability: getDetailedContextCapability,
470
+ description: getDetailedContextDescription,
471
+ schema: getDetailedContextSchema,
472
+ };
473
+ // Export all knowledge graph tools
474
+ export const knowledgeGraphTools = {
475
+ createEntities: createEntitiesTool,
476
+ createRelations: createRelationsTool,
477
+ addObservations: addObservationsTool,
478
+ hybridSearch: hybridSearchTool,
479
+ embedAllEntities: embedAllEntitiesTool,
480
+ getDetailedContext: getDetailedContextTool,
481
+ };
482
+ //# sourceMappingURL=knowledge-graph-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"knowledge-graph-tools.js","sour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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAiD7D,CAAC;AAEb,MAAM,wBAAwB,GAAkB;IAC9C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6CAA6C,CAAC;IAC3E,kBAAkB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,0DAA0D,CAAC;CAC9H,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAmB;IACpD,UAAU,EAAE,4BAA4B;IACxC,WAAW,EAAE,6BAA6B;IAC1C,MAAM,EAAE,wBAAwB;CACjC,CAAC;AAEF,mCAAmC;AACnC,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,cAAc,EAAE,kBAAkB;IAClC,eAAe,EAAE,mBAAmB;IACpC,eAAe,EAAE,mBAAmB;IACpC,YAAY,EAAE,gBAAgB;IAC9B,gBAAgB,EAAE,oBAAoB;IACtC,kBAAkB,EAAE,sBAAsB;CAC3C,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { ToolDefinition } from './types.js';
2
+ export declare const migrationTools: Record<string, ToolDefinition>;
3
+ //# sourceMappingURL=migration-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-tools.d.ts","sourceRoot":"","sources":["../../../src/tools/migration-tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CA2KzD,CAAC"}
@@ -0,0 +1,172 @@
1
+ import { z } from 'zod';
2
+ export const migrationTools = {
3
+ getMigrationStatus: {
4
+ capability: {
5
+ description: 'Get database migration status and list all migrations',
6
+ parameters: {
7
+ type: 'object',
8
+ properties: {},
9
+ required: [],
10
+ },
11
+ },
12
+ description: (settings) => `
13
+ **Get Database Migration Status**
14
+
15
+ Shows the current database schema version and lists all available migrations with their status.
16
+
17
+ **Purpose:**
18
+ - Check which migrations have been applied
19
+ - See pending migrations that need to be run
20
+ - Verify database schema version
21
+
22
+ **Returns:**
23
+ - Current schema version
24
+ - List of all migrations with applied status
25
+ - Summary of pending migrations
26
+
27
+ **Example:**
28
+ \`\`\`json
29
+ {
30
+ "currentVersion": 4,
31
+ "migrations": [
32
+ {
33
+ "version": 1,
34
+ "description": "Initial schema",
35
+ "applied": true,
36
+ "applied_at": "2024-01-01T10:00:00Z"
37
+ },
38
+ {
39
+ "version": 5,
40
+ "description": "New feature",
41
+ "applied": false
42
+ }
43
+ ],
44
+ "pendingCount": 1
45
+ }
46
+ \`\`\`
47
+
48
+ **Use Cases:**
49
+ - Before running migrations to see what will be applied
50
+ - Troubleshooting database schema issues
51
+ - Verifying successful migration completion
52
+ `.trim(),
53
+ schema: {},
54
+ },
55
+ runMigrations: {
56
+ capability: {
57
+ description: 'Run all pending database migrations',
58
+ parameters: {
59
+ type: 'object',
60
+ properties: {},
61
+ required: [],
62
+ },
63
+ },
64
+ description: (settings) => `
65
+ **Run Database Migrations**
66
+
67
+ Applies all pending database migrations to bring the schema up to the latest version.
68
+
69
+ **Purpose:**
70
+ - Update database schema to support new features
71
+ - Apply incremental schema changes safely
72
+ - Maintain database version consistency
73
+
74
+ **Safety:**
75
+ - Migrations run in transactions (atomic)
76
+ - Failed migrations are rolled back automatically
77
+ - Schema version is tracked for consistency
78
+
79
+ **Returns:**
80
+ - Number of migrations applied
81
+ - New current version
82
+ - Details of applied migrations
83
+
84
+ **Example:**
85
+ \`\`\`json
86
+ {
87
+ "applied": 2,
88
+ "currentVersion": 5,
89
+ "appliedMigrations": [
90
+ {
91
+ "version": 4,
92
+ "description": "Add chunk_type support"
93
+ },
94
+ {
95
+ "version": 5,
96
+ "description": "Disable foreign keys"
97
+ }
98
+ ]
99
+ }
100
+ \`\`\`
101
+
102
+ **Use Cases:**
103
+ - After updating the application to a new version
104
+ - Setting up a fresh database
105
+ - Recovering from schema inconsistencies
106
+ `.trim(),
107
+ schema: {},
108
+ },
109
+ rollbackMigration: {
110
+ capability: {
111
+ description: 'Rollback database to a specific migration version',
112
+ parameters: {
113
+ type: 'object',
114
+ properties: {
115
+ targetVersion: {
116
+ type: 'number',
117
+ description: 'Target schema version to rollback to',
118
+ },
119
+ },
120
+ required: ['targetVersion'],
121
+ },
122
+ },
123
+ description: (settings) => `
124
+ **Rollback Database Migration**
125
+
126
+ Rolls back the database schema to a specific version by reversing applied migrations.
127
+
128
+ **Purpose:**
129
+ - Revert problematic schema changes
130
+ - Downgrade to a previous stable version
131
+ - Recover from migration issues
132
+
133
+ **Parameters:**
134
+ - \`targetVersion\`: The schema version to rollback to (must be lower than current)
135
+
136
+ **Safety:**
137
+ - Only migrations with rollback support can be reversed
138
+ - Rollbacks run in transactions (atomic)
139
+ - Data loss may occur depending on the migration
140
+
141
+ **Returns:**
142
+ - Number of migrations rolled back
143
+ - New current version
144
+ - Details of rolled back migrations
145
+
146
+ **Example:**
147
+ \`\`\`json
148
+ {
149
+ "rolledBack": 1,
150
+ "currentVersion": 3,
151
+ "rolledBackMigrations": [
152
+ {
153
+ "version": 4,
154
+ "description": "Add chunk_type support"
155
+ }
156
+ ]
157
+ }
158
+ \`\`\`
159
+
160
+ **Use Cases:**
161
+ - Reverting a problematic migration
162
+ - Downgrading for compatibility
163
+ - Testing migration rollback procedures
164
+
165
+ **⚠️ Warning:** Rollbacks may cause data loss. Use with caution in production.
166
+ `.trim(),
167
+ schema: {
168
+ targetVersion: z.number().min(0).describe('Target schema version to rollback to'),
169
+ },
170
+ },
171
+ };
172
+ //# sourceMappingURL=migration-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-tools.js","sourceRoot":"","sources":["../../../src/tools/migration-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,cAAc,GAAmC;IAC5D,kBAAkB,EAAE;QA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