@henrychong-ai/mcp-neo4j-knowledge-graph 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 (120) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +718 -0
  3. package/dist/KnowledgeGraphManager.d.ts +215 -0
  4. package/dist/KnowledgeGraphManager.js +910 -0
  5. package/dist/KnowledgeGraphManager.js.map +1 -0
  6. package/dist/callToolHandler.d.ts +5 -0
  7. package/dist/callToolHandler.js +26 -0
  8. package/dist/callToolHandler.js.map +1 -0
  9. package/dist/cli/neo4j-setup.d.ts +52 -0
  10. package/dist/cli/neo4j-setup.js +258 -0
  11. package/dist/cli/neo4j-setup.js.map +1 -0
  12. package/dist/config/paths.d.ts +13 -0
  13. package/dist/config/paths.js +41 -0
  14. package/dist/config/paths.js.map +1 -0
  15. package/dist/config/storage.d.ts +35 -0
  16. package/dist/config/storage.js +52 -0
  17. package/dist/config/storage.js.map +1 -0
  18. package/dist/embeddings/DefaultEmbeddingService.d.ts +64 -0
  19. package/dist/embeddings/DefaultEmbeddingService.js +139 -0
  20. package/dist/embeddings/DefaultEmbeddingService.js.map +1 -0
  21. package/dist/embeddings/EmbeddingJobManager.d.ts +212 -0
  22. package/dist/embeddings/EmbeddingJobManager.js +545 -0
  23. package/dist/embeddings/EmbeddingJobManager.js.map +1 -0
  24. package/dist/embeddings/EmbeddingService.d.ts +96 -0
  25. package/dist/embeddings/EmbeddingService.js +44 -0
  26. package/dist/embeddings/EmbeddingService.js.map +1 -0
  27. package/dist/embeddings/EmbeddingServiceFactory.d.ts +72 -0
  28. package/dist/embeddings/EmbeddingServiceFactory.js +147 -0
  29. package/dist/embeddings/EmbeddingServiceFactory.js.map +1 -0
  30. package/dist/embeddings/OpenAIEmbeddingService.d.ts +73 -0
  31. package/dist/embeddings/OpenAIEmbeddingService.js +195 -0
  32. package/dist/embeddings/OpenAIEmbeddingService.js.map +1 -0
  33. package/dist/embeddings/config.d.ts +83 -0
  34. package/dist/embeddings/config.js +65 -0
  35. package/dist/embeddings/config.js.map +1 -0
  36. package/dist/index.d.ts +4 -0
  37. package/dist/index.js +220 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/server/handlers/callToolHandler.d.ts +20 -0
  40. package/dist/server/handlers/callToolHandler.js +505 -0
  41. package/dist/server/handlers/callToolHandler.js.map +1 -0
  42. package/dist/server/handlers/listToolsHandler.d.ts +7 -0
  43. package/dist/server/handlers/listToolsHandler.js +511 -0
  44. package/dist/server/handlers/listToolsHandler.js.map +1 -0
  45. package/dist/server/handlers/toolHandlers/addObservations.d.ts +12 -0
  46. package/dist/server/handlers/toolHandlers/addObservations.js +99 -0
  47. package/dist/server/handlers/toolHandlers/addObservations.js.map +1 -0
  48. package/dist/server/handlers/toolHandlers/createEntities.d.ts +12 -0
  49. package/dist/server/handlers/toolHandlers/createEntities.js +20 -0
  50. package/dist/server/handlers/toolHandlers/createEntities.js.map +1 -0
  51. package/dist/server/handlers/toolHandlers/createRelations.d.ts +12 -0
  52. package/dist/server/handlers/toolHandlers/createRelations.js +20 -0
  53. package/dist/server/handlers/toolHandlers/createRelations.js.map +1 -0
  54. package/dist/server/handlers/toolHandlers/deleteEntities.d.ts +12 -0
  55. package/dist/server/handlers/toolHandlers/deleteEntities.js +20 -0
  56. package/dist/server/handlers/toolHandlers/deleteEntities.js.map +1 -0
  57. package/dist/server/handlers/toolHandlers/index.d.ts +8 -0
  58. package/dist/server/handlers/toolHandlers/index.js +9 -0
  59. package/dist/server/handlers/toolHandlers/index.js.map +1 -0
  60. package/dist/server/handlers/toolHandlers/readGraph.d.ts +12 -0
  61. package/dist/server/handlers/toolHandlers/readGraph.js +20 -0
  62. package/dist/server/handlers/toolHandlers/readGraph.js.map +1 -0
  63. package/dist/server/setup.d.ts +8 -0
  64. package/dist/server/setup.js +48 -0
  65. package/dist/server/setup.js.map +1 -0
  66. package/dist/storage/FileStorageProvider.d.ts +125 -0
  67. package/dist/storage/FileStorageProvider.js +322 -0
  68. package/dist/storage/FileStorageProvider.js.map +1 -0
  69. package/dist/storage/SearchResultCache.d.ts +102 -0
  70. package/dist/storage/SearchResultCache.js +258 -0
  71. package/dist/storage/SearchResultCache.js.map +1 -0
  72. package/dist/storage/StorageProvider.d.ts +171 -0
  73. package/dist/storage/StorageProvider.js +46 -0
  74. package/dist/storage/StorageProvider.js.map +1 -0
  75. package/dist/storage/StorageProviderFactory.d.ts +63 -0
  76. package/dist/storage/StorageProviderFactory.js +113 -0
  77. package/dist/storage/StorageProviderFactory.js.map +1 -0
  78. package/dist/storage/VectorStoreFactory.d.ts +43 -0
  79. package/dist/storage/VectorStoreFactory.js +41 -0
  80. package/dist/storage/VectorStoreFactory.js.map +1 -0
  81. package/dist/storage/neo4j/Neo4jConfig.d.ts +37 -0
  82. package/dist/storage/neo4j/Neo4jConfig.js +13 -0
  83. package/dist/storage/neo4j/Neo4jConfig.js.map +1 -0
  84. package/dist/storage/neo4j/Neo4jConnectionManager.d.ts +40 -0
  85. package/dist/storage/neo4j/Neo4jConnectionManager.js +58 -0
  86. package/dist/storage/neo4j/Neo4jConnectionManager.js.map +1 -0
  87. package/dist/storage/neo4j/Neo4jSchemaManager.d.ts +74 -0
  88. package/dist/storage/neo4j/Neo4jSchemaManager.js +224 -0
  89. package/dist/storage/neo4j/Neo4jSchemaManager.js.map +1 -0
  90. package/dist/storage/neo4j/Neo4jStorageProvider.d.ts +225 -0
  91. package/dist/storage/neo4j/Neo4jStorageProvider.js +1900 -0
  92. package/dist/storage/neo4j/Neo4jStorageProvider.js.map +1 -0
  93. package/dist/storage/neo4j/Neo4jVectorStore.d.ts +80 -0
  94. package/dist/storage/neo4j/Neo4jVectorStore.js +396 -0
  95. package/dist/storage/neo4j/Neo4jVectorStore.js.map +1 -0
  96. package/dist/types/entity-embedding.d.ts +156 -0
  97. package/dist/types/entity-embedding.js +2 -0
  98. package/dist/types/entity-embedding.js.map +1 -0
  99. package/dist/types/relation.d.ts +77 -0
  100. package/dist/types/relation.js +93 -0
  101. package/dist/types/relation.js.map +1 -0
  102. package/dist/types/temporalEntity.d.ts +55 -0
  103. package/dist/types/temporalEntity.js +66 -0
  104. package/dist/types/temporalEntity.js.map +1 -0
  105. package/dist/types/temporalRelation.d.ts +60 -0
  106. package/dist/types/temporalRelation.js +89 -0
  107. package/dist/types/temporalRelation.js.map +1 -0
  108. package/dist/types/vector-index.d.ts +48 -0
  109. package/dist/types/vector-index.js +2 -0
  110. package/dist/types/vector-index.js.map +1 -0
  111. package/dist/types/vector-store.d.ts +16 -0
  112. package/dist/types/vector-store.js +2 -0
  113. package/dist/types/vector-store.js.map +1 -0
  114. package/dist/utils/fs.d.ts +2 -0
  115. package/dist/utils/fs.js +3 -0
  116. package/dist/utils/fs.js.map +1 -0
  117. package/dist/utils/logger.d.ts +10 -0
  118. package/dist/utils/logger.js +35 -0
  119. package/dist/utils/logger.js.map +1 -0
  120. package/package.json +85 -0
@@ -0,0 +1,511 @@
1
+ /**
2
+ * Handles the ListTools request.
3
+ * Returns a list of all available tools with their schemas.
4
+ */
5
+ export async function handleListToolsRequest() {
6
+ // Define the base tools without the temporal-specific ones
7
+ const baseTools = [
8
+ {
9
+ name: 'create_entities',
10
+ description: 'Create multiple new entities in your Memento MCP knowledge graph memory system',
11
+ inputSchema: {
12
+ type: 'object',
13
+ properties: {
14
+ entities: {
15
+ type: 'array',
16
+ items: {
17
+ type: 'object',
18
+ properties: {
19
+ name: {
20
+ type: 'string',
21
+ description: 'The name of the entity',
22
+ },
23
+ entityType: {
24
+ type: 'string',
25
+ description: 'The type of the entity',
26
+ },
27
+ observations: {
28
+ type: 'array',
29
+ items: {
30
+ type: 'string',
31
+ },
32
+ description: 'An array of observation contents associated with the entity',
33
+ },
34
+ // Temporal fields - optional
35
+ id: { type: 'string', description: 'Optional entity ID' },
36
+ version: { type: 'number', description: 'Optional entity version' },
37
+ createdAt: { type: 'number', description: 'Optional creation timestamp' },
38
+ updatedAt: { type: 'number', description: 'Optional update timestamp' },
39
+ validFrom: { type: 'number', description: 'Optional validity start timestamp' },
40
+ validTo: { type: 'number', description: 'Optional validity end timestamp' },
41
+ changedBy: { type: 'string', description: 'Optional user/system identifier' },
42
+ },
43
+ required: ['name', 'entityType', 'observations'],
44
+ },
45
+ },
46
+ },
47
+ required: ['entities'],
48
+ },
49
+ },
50
+ {
51
+ name: 'create_relations',
52
+ description: 'Create multiple new relations between entities in your Memento MCP knowledge graph memory. Relations should be in active voice',
53
+ inputSchema: {
54
+ type: 'object',
55
+ properties: {
56
+ relations: {
57
+ type: 'array',
58
+ items: {
59
+ type: 'object',
60
+ properties: {
61
+ from: {
62
+ type: 'string',
63
+ description: 'The name of the entity where the relation starts',
64
+ },
65
+ to: {
66
+ type: 'string',
67
+ description: 'The name of the entity where the relation ends',
68
+ },
69
+ relationType: {
70
+ type: 'string',
71
+ description: 'The type of the relation',
72
+ },
73
+ strength: {
74
+ type: 'number',
75
+ description: 'Optional strength of relation (0.0 to 1.0)',
76
+ },
77
+ confidence: {
78
+ type: 'number',
79
+ description: 'Optional confidence level in relation accuracy (0.0 to 1.0)',
80
+ },
81
+ metadata: {
82
+ type: 'object',
83
+ description: 'Optional metadata about the relation (source, timestamps, tags, etc.)',
84
+ additionalProperties: true,
85
+ },
86
+ // Temporal fields - optional
87
+ id: { type: 'string', description: 'Optional relation ID' },
88
+ version: { type: 'number', description: 'Optional relation version' },
89
+ createdAt: { type: 'number', description: 'Optional creation timestamp' },
90
+ updatedAt: { type: 'number', description: 'Optional update timestamp' },
91
+ validFrom: { type: 'number', description: 'Optional validity start timestamp' },
92
+ validTo: { type: 'number', description: 'Optional validity end timestamp' },
93
+ changedBy: { type: 'string', description: 'Optional user/system identifier' },
94
+ },
95
+ required: ['from', 'to', 'relationType'],
96
+ },
97
+ },
98
+ },
99
+ required: ['relations'],
100
+ },
101
+ },
102
+ {
103
+ name: 'add_observations',
104
+ description: 'Add new observations to existing entities in your Memento MCP knowledge graph memory',
105
+ inputSchema: {
106
+ type: 'object',
107
+ properties: {
108
+ observations: {
109
+ type: 'array',
110
+ items: {
111
+ type: 'object',
112
+ properties: {
113
+ entityName: {
114
+ type: 'string',
115
+ description: 'The name of the entity to add the observations to',
116
+ },
117
+ contents: {
118
+ type: 'array',
119
+ items: { type: 'string' },
120
+ description: 'An array of observation contents to add',
121
+ },
122
+ // Optional parameters at the observation level
123
+ strength: {
124
+ type: 'number',
125
+ description: 'Strength value (0.0 to 1.0) for this specific observation',
126
+ },
127
+ confidence: {
128
+ type: 'number',
129
+ description: 'Confidence level (0.0 to 1.0) for this specific observation',
130
+ },
131
+ metadata: {
132
+ type: 'object',
133
+ description: 'Metadata for this specific observation',
134
+ additionalProperties: true,
135
+ },
136
+ },
137
+ required: ['entityName', 'contents'],
138
+ },
139
+ },
140
+ // Optional parameters at the top level (apply to all observations)
141
+ strength: {
142
+ type: 'number',
143
+ description: 'Default strength value (0.0 to 1.0) for all observations',
144
+ },
145
+ confidence: {
146
+ type: 'number',
147
+ description: 'Default confidence level (0.0 to 1.0) for all observations',
148
+ },
149
+ metadata: {
150
+ type: 'object',
151
+ description: 'Default metadata for all observations',
152
+ additionalProperties: true,
153
+ },
154
+ },
155
+ required: ['observations'],
156
+ },
157
+ },
158
+ {
159
+ name: 'delete_entities',
160
+ description: 'Delete multiple entities and their associated relations from your Memento MCP knowledge graph memory',
161
+ inputSchema: {
162
+ type: 'object',
163
+ properties: {
164
+ entityNames: {
165
+ type: 'array',
166
+ items: { type: 'string' },
167
+ description: 'An array of entity names to delete',
168
+ },
169
+ },
170
+ required: ['entityNames'],
171
+ },
172
+ },
173
+ {
174
+ name: 'delete_observations',
175
+ description: 'Delete specific observations from entities in your Memento MCP knowledge graph memory',
176
+ inputSchema: {
177
+ type: 'object',
178
+ properties: {
179
+ deletions: {
180
+ type: 'array',
181
+ items: {
182
+ type: 'object',
183
+ properties: {
184
+ entityName: {
185
+ type: 'string',
186
+ description: 'The name of the entity containing the observations',
187
+ },
188
+ observations: {
189
+ type: 'array',
190
+ items: { type: 'string' },
191
+ description: 'An array of observations to delete',
192
+ },
193
+ },
194
+ required: ['entityName', 'observations'],
195
+ },
196
+ },
197
+ },
198
+ required: ['deletions'],
199
+ },
200
+ },
201
+ {
202
+ name: 'delete_relations',
203
+ description: 'Delete multiple relations from your Memento MCP knowledge graph memory',
204
+ inputSchema: {
205
+ type: 'object',
206
+ properties: {
207
+ relations: {
208
+ type: 'array',
209
+ items: {
210
+ type: 'object',
211
+ properties: {
212
+ from: {
213
+ type: 'string',
214
+ description: 'The name of the entity where the relation starts',
215
+ },
216
+ to: {
217
+ type: 'string',
218
+ description: 'The name of the entity where the relation ends',
219
+ },
220
+ relationType: { type: 'string', description: 'The type of the relation' },
221
+ },
222
+ required: ['from', 'to', 'relationType'],
223
+ },
224
+ description: 'An array of relations to delete',
225
+ },
226
+ },
227
+ required: ['relations'],
228
+ },
229
+ },
230
+ {
231
+ name: 'get_relation',
232
+ description: 'Get a specific relation with its enhanced properties from your Memento MCP knowledge graph memory',
233
+ inputSchema: {
234
+ type: 'object',
235
+ properties: {
236
+ from: {
237
+ type: 'string',
238
+ description: 'The name of the entity where the relation starts',
239
+ },
240
+ to: {
241
+ type: 'string',
242
+ description: 'The name of the entity where the relation ends',
243
+ },
244
+ relationType: {
245
+ type: 'string',
246
+ description: 'The type of the relation',
247
+ },
248
+ },
249
+ required: ['from', 'to', 'relationType'],
250
+ },
251
+ },
252
+ {
253
+ name: 'update_relation',
254
+ description: 'Update an existing relation with enhanced properties in your Memento MCP knowledge graph memory',
255
+ inputSchema: {
256
+ type: 'object',
257
+ properties: {
258
+ relation: {
259
+ type: 'object',
260
+ properties: {
261
+ from: {
262
+ type: 'string',
263
+ description: 'The name of the entity where the relation starts',
264
+ },
265
+ to: {
266
+ type: 'string',
267
+ description: 'The name of the entity where the relation ends',
268
+ },
269
+ relationType: {
270
+ type: 'string',
271
+ description: 'The type of the relation',
272
+ },
273
+ strength: {
274
+ type: 'number',
275
+ description: 'Optional strength of relation (0.0 to 1.0)',
276
+ },
277
+ confidence: {
278
+ type: 'number',
279
+ description: 'Optional confidence level in relation accuracy (0.0 to 1.0)',
280
+ },
281
+ metadata: {
282
+ type: 'object',
283
+ description: 'Optional metadata about the relation (source, timestamps, tags, etc.)',
284
+ additionalProperties: true,
285
+ },
286
+ // Temporal fields - optional
287
+ id: { type: 'string', description: 'Optional relation ID' },
288
+ version: { type: 'number', description: 'Optional relation version' },
289
+ createdAt: { type: 'number', description: 'Optional creation timestamp' },
290
+ updatedAt: { type: 'number', description: 'Optional update timestamp' },
291
+ validFrom: { type: 'number', description: 'Optional validity start timestamp' },
292
+ validTo: { type: 'number', description: 'Optional validity end timestamp' },
293
+ changedBy: { type: 'string', description: 'Optional user/system identifier' },
294
+ },
295
+ required: ['from', 'to', 'relationType'],
296
+ },
297
+ },
298
+ required: ['relation'],
299
+ },
300
+ },
301
+ {
302
+ name: 'read_graph',
303
+ description: 'Read the entire Memento MCP knowledge graph memory system',
304
+ inputSchema: {
305
+ type: 'object',
306
+ properties: {
307
+ random_string: {
308
+ type: 'string',
309
+ description: 'Dummy parameter for no-parameter tools',
310
+ },
311
+ },
312
+ },
313
+ },
314
+ {
315
+ name: 'search_nodes',
316
+ description: 'Search for nodes in your Memento MCP knowledge graph memory based on a query',
317
+ inputSchema: {
318
+ type: 'object',
319
+ properties: {
320
+ query: {
321
+ type: 'string',
322
+ description: 'The search query to match against entity names, types, and observation content',
323
+ },
324
+ },
325
+ required: ['query'],
326
+ },
327
+ },
328
+ {
329
+ name: 'open_nodes',
330
+ description: 'Open specific nodes in your Memento MCP knowledge graph memory by their names',
331
+ inputSchema: {
332
+ type: 'object',
333
+ properties: {
334
+ names: {
335
+ type: 'array',
336
+ items: { type: 'string' },
337
+ description: 'An array of entity names to retrieve',
338
+ },
339
+ },
340
+ required: ['names'],
341
+ },
342
+ },
343
+ {
344
+ name: 'semantic_search',
345
+ description: 'Search for entities semantically using vector embeddings and similarity in your Memento MCP knowledge graph memory',
346
+ inputSchema: {
347
+ type: 'object',
348
+ properties: {
349
+ query: {
350
+ type: 'string',
351
+ description: 'The text query to search for semantically',
352
+ },
353
+ limit: {
354
+ type: 'number',
355
+ description: 'Maximum number of results to return (default: 10)',
356
+ },
357
+ min_similarity: {
358
+ type: 'number',
359
+ description: 'Minimum similarity threshold from 0.0 to 1.0 (default: 0.6)',
360
+ },
361
+ entity_types: {
362
+ type: 'array',
363
+ items: { type: 'string' },
364
+ description: 'Filter results by entity types',
365
+ },
366
+ hybrid_search: {
367
+ type: 'boolean',
368
+ description: 'Whether to combine keyword and semantic search (default: true)',
369
+ },
370
+ semantic_weight: {
371
+ type: 'number',
372
+ description: 'Weight of semantic results in hybrid search from 0.0 to 1.0 (default: 0.6)',
373
+ },
374
+ },
375
+ required: ['query'],
376
+ },
377
+ },
378
+ {
379
+ name: 'get_entity_embedding',
380
+ description: 'Get the vector embedding for a specific entity from your Memento MCP knowledge graph memory',
381
+ inputSchema: {
382
+ type: 'object',
383
+ properties: {
384
+ entity_name: {
385
+ type: 'string',
386
+ description: 'The name of the entity to get the embedding for',
387
+ },
388
+ },
389
+ required: ['entity_name'],
390
+ },
391
+ },
392
+ ];
393
+ // Define the temporal-specific tools
394
+ const temporalTools = [
395
+ {
396
+ name: 'get_entity_history',
397
+ description: 'Get the version history of an entity from your Memento MCP knowledge graph memory',
398
+ inputSchema: {
399
+ type: 'object',
400
+ properties: {
401
+ entityName: {
402
+ type: 'string',
403
+ description: 'The name of the entity to retrieve history for',
404
+ },
405
+ },
406
+ required: ['entityName'],
407
+ },
408
+ },
409
+ {
410
+ name: 'get_relation_history',
411
+ description: 'Get the version history of a relation from your Memento MCP knowledge graph memory',
412
+ inputSchema: {
413
+ type: 'object',
414
+ properties: {
415
+ from: {
416
+ type: 'string',
417
+ description: 'The name of the entity where the relation starts',
418
+ },
419
+ to: {
420
+ type: 'string',
421
+ description: 'The name of the entity where the relation ends',
422
+ },
423
+ relationType: {
424
+ type: 'string',
425
+ description: 'The type of the relation',
426
+ },
427
+ },
428
+ required: ['from', 'to', 'relationType'],
429
+ },
430
+ },
431
+ {
432
+ name: 'get_graph_at_time',
433
+ description: 'Get your Memento MCP knowledge graph memory as it existed at a specific point in time',
434
+ inputSchema: {
435
+ type: 'object',
436
+ properties: {
437
+ timestamp: {
438
+ type: 'number',
439
+ description: 'The timestamp (in milliseconds since epoch) to query the graph at',
440
+ },
441
+ },
442
+ required: ['timestamp'],
443
+ },
444
+ },
445
+ {
446
+ name: 'get_decayed_graph',
447
+ description: 'Get your Memento MCP knowledge graph memory with confidence values decayed based on time',
448
+ inputSchema: {
449
+ type: 'object',
450
+ properties: {
451
+ reference_time: {
452
+ type: 'number',
453
+ description: 'Optional reference timestamp (in milliseconds since epoch) for decay calculation',
454
+ },
455
+ decay_factor: {
456
+ type: 'number',
457
+ description: 'Optional decay factor override (normally calculated from half-life)',
458
+ },
459
+ },
460
+ },
461
+ },
462
+ ];
463
+ // Add debug tools only when DEBUG is enabled
464
+ const debugTools = [
465
+ {
466
+ name: 'force_generate_embedding',
467
+ description: 'Forcibly generate and store an embedding for an entity in your Memento MCP knowledge graph memory',
468
+ inputSchema: {
469
+ type: 'object',
470
+ properties: {
471
+ entity_name: {
472
+ type: 'string',
473
+ description: 'Name of the entity to generate embedding for',
474
+ },
475
+ },
476
+ required: ['entity_name'],
477
+ },
478
+ },
479
+ {
480
+ name: 'debug_embedding_config',
481
+ description: 'Debug tool to check embedding configuration and status of your Memento MCP knowledge graph memory system',
482
+ inputSchema: {
483
+ type: 'object',
484
+ properties: {
485
+ random_string: {
486
+ type: 'string',
487
+ description: 'Dummy parameter for no-parameter tools',
488
+ },
489
+ },
490
+ },
491
+ },
492
+ {
493
+ name: 'diagnose_vector_search',
494
+ description: 'Diagnostic tool to directly query Neo4j database for entity embeddings, bypassing application abstractions',
495
+ inputSchema: {
496
+ type: 'object',
497
+ properties: {
498
+ random_string: {
499
+ type: 'string',
500
+ description: 'Dummy parameter for no-parameter tools',
501
+ },
502
+ },
503
+ },
504
+ },
505
+ ];
506
+ // Return the list of tools with debug tools conditionally included
507
+ return {
508
+ tools: [...baseTools, ...temporalTools, ...(process.env.DEBUG === 'true' ? debugTools : [])],
509
+ };
510
+ }
511
+ //# sourceMappingURL=listToolsHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listToolsHandler.js","sourceRoot":"","sources":["../../../src/server/handlers/listToolsHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB;IAC1C,2DAA2D;IAC3D,MAAM,SAAS,GAAG;QAChB;YACE,IAAI,EAAE,iBAAiB;YACvB,WAAW,EAAE,gFAAgF;YAC7F,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,QAAQ,EAAE;wBACR,IAAI,EAAE,OAAO;wBACb,KAAK,EAAE;4BACL,IAAI,EAAE,QAAQ;4BACd,UAAU,EAAE;gCACV,IAAI,EAAE;oCACJ,IAAI,EAAE,QAAQ;oCACd,WAAW,EAAE,wBAAwB;iCACtC;gCACD,UAAU,EAAE;oCACV,IAAI,EAAE,QAAQ;oCACd,WAAW,EAAE,wBAAwB;iCACtC;gCACD,YAAY,EAAE;oCACZ,IAAI,EAAE,OAAO;oCACb,KAAK,EAAE;wCACL,IAAI,EAAE,QAAQ;qCACf;oCACD,WAAW,EAAE,6DAA6D;iCAC3E;gCACD,6BAA6B;gCAC7B,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,oBAAoB,EAAE;gCACzD,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,yBAAyB,EAAE;gCACnE,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6BAA6B,EAAE;gCACzE,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,2BAA2B,EAAE;gCACvE,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,E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,SAAS,EAAE,GAAG,aAAa,EAAE,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;KAC7F,CAAC;AACJ,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Handles the add_observations tool request
3
+ * @param args The arguments for the tool request
4
+ * @param knowledgeGraphManager The KnowledgeGraphManager instance
5
+ * @returns A response object with the result content
6
+ */
7
+ export declare function handleAddObservations(args: Record<string, unknown>, knowledgeGraphManager: any): Promise<{
8
+ content: Array<{
9
+ type: string;
10
+ text: string;
11
+ }>;
12
+ }>;
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Handles the add_observations tool request
3
+ * @param args The arguments for the tool request
4
+ * @param knowledgeGraphManager The KnowledgeGraphManager instance
5
+ * @returns A response object with the result content
6
+ */
7
+ export async function handleAddObservations(args,
8
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
+ knowledgeGraphManager) {
10
+ try {
11
+ // Enhanced logging for debugging
12
+ process.stderr.write(`[DEBUG] addObservations handler called at ${new Date().toISOString()}\n`);
13
+ process.stderr.write(`[DEBUG] FULL ARGS: ${JSON.stringify(args, null, 2)}\n`);
14
+ process.stderr.write(`[DEBUG] ARGS KEYS: ${Object.keys(args).join(', ')}\n`);
15
+ process.stderr.write(`[DEBUG] ARGS TYPES: ${Object.keys(args)
16
+ .map((k) => `${k}: ${typeof args[k]}`)
17
+ .join(', ')}\n`);
18
+ // Validate the observations array
19
+ if (!args.observations || !Array.isArray(args.observations)) {
20
+ throw new Error('Invalid observations: must be an array');
21
+ }
22
+ // Add default values for required parameters
23
+ const defaultStrength = 0.9;
24
+ const defaultConfidence = 0.95;
25
+ // Force add strength to args if it doesn't exist
26
+ if (args.strength === undefined) {
27
+ process.stderr.write(`[DEBUG] Adding default strength value: ${defaultStrength}\n`);
28
+ args.strength = defaultStrength;
29
+ }
30
+ // Ensure each observation has the required fields
31
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
32
+ const processedObservations = args.observations.map((obs) => {
33
+ // Validate required fields
34
+ if (!obs.entityName) {
35
+ throw new Error('Missing required parameter: entityName');
36
+ }
37
+ if (!obs.contents || !Array.isArray(obs.contents)) {
38
+ throw new Error('Missing required parameter: contents (must be an array)');
39
+ }
40
+ // Always set strength value
41
+ const obsStrength = obs.strength !== undefined ? obs.strength : args.strength;
42
+ process.stderr.write(`[DEBUG] Processing observation for ${obs.entityName}, using strength: ${obsStrength}\n`);
43
+ // Set defaults for each observation
44
+ return {
45
+ entityName: obs.entityName,
46
+ contents: obs.contents,
47
+ strength: obsStrength,
48
+ confidence: obs.confidence !== undefined ? obs.confidence : args.confidence || defaultConfidence,
49
+ metadata: obs.metadata || args.metadata || { source: 'API call' },
50
+ };
51
+ });
52
+ // Call knowledgeGraphManager
53
+ process.stderr.write(`[DEBUG] Calling knowledgeGraphManager.addObservations with ${processedObservations.length} observations\n`);
54
+ process.stderr.write(`[DEBUG] PROCESSED: ${JSON.stringify(processedObservations, null, 2)}\n`);
55
+ const result = await knowledgeGraphManager.addObservations(processedObservations);
56
+ process.stderr.write(`[DEBUG] addObservations result: ${JSON.stringify(result, null, 2)}\n`);
57
+ return {
58
+ content: [
59
+ {
60
+ type: 'text',
61
+ text: JSON.stringify({
62
+ result,
63
+ debug: {
64
+ timestamp: Date.now(),
65
+ input_args: args,
66
+ processed_observations: processedObservations,
67
+ tool_version: 'v2 with debug info',
68
+ },
69
+ }, null, 2),
70
+ },
71
+ ],
72
+ };
73
+ }
74
+ catch (error) {
75
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
76
+ const err = error;
77
+ // Enhanced error logging for debugging
78
+ process.stderr.write(`[ERROR] addObservations error: ${err.message}\n`);
79
+ process.stderr.write(`[ERROR] Stack trace: ${err.stack || 'No stack trace available'}\n`);
80
+ return {
81
+ content: [
82
+ {
83
+ type: 'text',
84
+ text: JSON.stringify({
85
+ error: err.message,
86
+ debug: {
87
+ timestamp: Date.now(),
88
+ input_args: args || 'No args available',
89
+ error_type: err.constructor.name,
90
+ error_stack: err.stack?.split('\n') || 'No stack trace',
91
+ tool_version: 'v2 with debug info',
92
+ },
93
+ }, null, 2),
94
+ },
95
+ ],
96
+ };
97
+ }
98
+ }
99
+ //# sourceMappingURL=addObservations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addObservations.js","sourceRoot":"","sources":["../../../../src/server/handlers/toolHandlers/addObservations.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,IAA6B;AAC7B,8DAA8D;AAC9D,qBAA0B;IAE1B,IAAI,CAAC;QACH,iCAAiC;QACjC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,6CAA6C,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QAChG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,sBAAsB,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;QAC9E,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,sBAAsB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7E,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,uBAAuB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;aACrC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;aACrC,IAAI,CAAC,IAAI,CAAC,IAAI,CAClB,CAAC;QAEF,kCAAkC;QAClC,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;YAC5D,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,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L,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;wBACE,KAAK,EAAE,GAAG,CAAC,OAAO;wBAClB,KAAK,EAAE;4BACL,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;4BACrB,UAAU,EAAE,IAAI,IAAI,mBAAmB;4BACvC,UAAU,EAAE,GAAG,CAAC,WAAW,CAAC,IAAI;4BAChC,WAAW,EAAE,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,gBAAgB;4BACvD,YAAY,EAAE,oBAAoB;yBACnC;qBACF,EACD,IAAI,EACJ,CAAC,CACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Handles the create_entities tool request
3
+ * @param args The arguments for the tool request
4
+ * @param knowledgeGraphManager The KnowledgeGraphManager instance
5
+ * @returns A response object with the result content
6
+ */
7
+ export declare function handleCreateEntities(args: Record<string, unknown>, knowledgeGraphManager: any): Promise<{
8
+ content: Array<{
9
+ type: string;
10
+ text: string;
11
+ }>;
12
+ }>;