@199-bio/engram 0.3.1 → 0.3.2
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/dist/index.js +1 -148
- package/package.json +1 -1
- package/src/index.ts +1 -170
package/dist/index.js
CHANGED
|
@@ -42,7 +42,7 @@ async function initialize() {
|
|
|
42
42
|
// ============ MCP Server ============
|
|
43
43
|
const server = new Server({
|
|
44
44
|
name: "engram",
|
|
45
|
-
version: "0.3.
|
|
45
|
+
version: "0.3.2",
|
|
46
46
|
}, {
|
|
47
47
|
capabilities: {
|
|
48
48
|
tools: {},
|
|
@@ -136,91 +136,6 @@ const TOOLS = [
|
|
|
136
136
|
openWorldHint: false,
|
|
137
137
|
},
|
|
138
138
|
},
|
|
139
|
-
{
|
|
140
|
-
name: "create_entity",
|
|
141
|
-
description: "ADVANCED: Manually create an entity. Rarely needed - remember auto-extracts entities. Only use when: (1) creating an entity that won't appear in any memory content, or (2) correcting entity type after auto-extraction.",
|
|
142
|
-
inputSchema: {
|
|
143
|
-
type: "object",
|
|
144
|
-
properties: {
|
|
145
|
-
name: {
|
|
146
|
-
type: "string",
|
|
147
|
-
description: "Entity name (e.g., 'John Smith', 'Paris', 'Machine Learning')",
|
|
148
|
-
},
|
|
149
|
-
type: {
|
|
150
|
-
type: "string",
|
|
151
|
-
enum: ["person", "place", "concept", "event", "organization"],
|
|
152
|
-
description: "Type of entity",
|
|
153
|
-
},
|
|
154
|
-
},
|
|
155
|
-
required: ["name", "type"],
|
|
156
|
-
},
|
|
157
|
-
annotations: {
|
|
158
|
-
title: "Create Entity",
|
|
159
|
-
readOnlyHint: false,
|
|
160
|
-
destructiveHint: false,
|
|
161
|
-
idempotentHint: true,
|
|
162
|
-
openWorldHint: false,
|
|
163
|
-
},
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
name: "observe",
|
|
167
|
-
description: "ADVANCED: Add a fact to an EXISTING entity without creating a memory. Rarely needed - use remember instead, which stores the content AND links it to entities. Only use observe for adding metadata or corrections to entities.",
|
|
168
|
-
inputSchema: {
|
|
169
|
-
type: "object",
|
|
170
|
-
properties: {
|
|
171
|
-
entity: {
|
|
172
|
-
type: "string",
|
|
173
|
-
description: "Entity name to add observation to (must already exist)",
|
|
174
|
-
},
|
|
175
|
-
observation: {
|
|
176
|
-
type: "string",
|
|
177
|
-
description: "The fact or observation to record",
|
|
178
|
-
},
|
|
179
|
-
confidence: {
|
|
180
|
-
type: "number",
|
|
181
|
-
description: "Confidence in this observation (0-1)",
|
|
182
|
-
default: 1.0,
|
|
183
|
-
},
|
|
184
|
-
},
|
|
185
|
-
required: ["entity", "observation"],
|
|
186
|
-
},
|
|
187
|
-
annotations: {
|
|
188
|
-
title: "Add Observation",
|
|
189
|
-
readOnlyHint: false,
|
|
190
|
-
destructiveHint: false,
|
|
191
|
-
idempotentHint: false,
|
|
192
|
-
openWorldHint: false,
|
|
193
|
-
},
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
name: "relate",
|
|
197
|
-
description: "ADVANCED: Manually create a relationship between two entities. Rarely needed - remember auto-extracts relationships from text. Only use when: (1) the relationship wasn't captured by auto-extraction, or (2) you need to add a relationship not mentioned in any memory.",
|
|
198
|
-
inputSchema: {
|
|
199
|
-
type: "object",
|
|
200
|
-
properties: {
|
|
201
|
-
from: {
|
|
202
|
-
type: "string",
|
|
203
|
-
description: "Source entity name",
|
|
204
|
-
},
|
|
205
|
-
to: {
|
|
206
|
-
type: "string",
|
|
207
|
-
description: "Target entity name",
|
|
208
|
-
},
|
|
209
|
-
relation: {
|
|
210
|
-
type: "string",
|
|
211
|
-
description: "Type of relationship (e.g., 'sibling', 'works_at', 'knows', 'located_in')",
|
|
212
|
-
},
|
|
213
|
-
},
|
|
214
|
-
required: ["from", "to", "relation"],
|
|
215
|
-
},
|
|
216
|
-
annotations: {
|
|
217
|
-
title: "Create Relationship",
|
|
218
|
-
readOnlyHint: false,
|
|
219
|
-
destructiveHint: false,
|
|
220
|
-
idempotentHint: true,
|
|
221
|
-
openWorldHint: false,
|
|
222
|
-
},
|
|
223
|
-
},
|
|
224
139
|
{
|
|
225
140
|
name: "query_entity",
|
|
226
141
|
description: "Get all stored information about a specific person, place, or organization. Use after recall to get deeper details about an entity mentioned in search results.",
|
|
@@ -392,68 +307,6 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
392
307
|
],
|
|
393
308
|
};
|
|
394
309
|
}
|
|
395
|
-
case "create_entity": {
|
|
396
|
-
const { name: entityName, type } = args;
|
|
397
|
-
const entity = graph.getOrCreateEntity(entityName, type);
|
|
398
|
-
return {
|
|
399
|
-
content: [
|
|
400
|
-
{
|
|
401
|
-
type: "text",
|
|
402
|
-
text: JSON.stringify({
|
|
403
|
-
success: true,
|
|
404
|
-
entity: {
|
|
405
|
-
id: entity.id,
|
|
406
|
-
name: entity.name,
|
|
407
|
-
type: entity.type,
|
|
408
|
-
},
|
|
409
|
-
}, null, 2),
|
|
410
|
-
},
|
|
411
|
-
],
|
|
412
|
-
};
|
|
413
|
-
}
|
|
414
|
-
case "observe": {
|
|
415
|
-
const { entity: entityName, observation, confidence = 1.0 } = args;
|
|
416
|
-
// Ensure entity exists
|
|
417
|
-
const entity = graph.getOrCreateEntity(entityName, "person");
|
|
418
|
-
// Add observation
|
|
419
|
-
const obs = graph.addObservation(entity.id, observation, undefined, confidence);
|
|
420
|
-
return {
|
|
421
|
-
content: [
|
|
422
|
-
{
|
|
423
|
-
type: "text",
|
|
424
|
-
text: JSON.stringify({
|
|
425
|
-
success: true,
|
|
426
|
-
entity: entity.name,
|
|
427
|
-
observation_id: obs.id,
|
|
428
|
-
}, null, 2),
|
|
429
|
-
},
|
|
430
|
-
],
|
|
431
|
-
};
|
|
432
|
-
}
|
|
433
|
-
case "relate": {
|
|
434
|
-
const { from, to, relation } = args;
|
|
435
|
-
// Ensure both entities exist
|
|
436
|
-
const fromEntity = graph.getOrCreateEntity(from, "person");
|
|
437
|
-
const toEntity = graph.getOrCreateEntity(to, "person");
|
|
438
|
-
// Create relation
|
|
439
|
-
const rel = graph.relate(fromEntity.id, toEntity.id, relation);
|
|
440
|
-
return {
|
|
441
|
-
content: [
|
|
442
|
-
{
|
|
443
|
-
type: "text",
|
|
444
|
-
text: JSON.stringify({
|
|
445
|
-
success: true,
|
|
446
|
-
relation: {
|
|
447
|
-
id: rel.id,
|
|
448
|
-
from: fromEntity.name,
|
|
449
|
-
to: toEntity.name,
|
|
450
|
-
type: rel.type,
|
|
451
|
-
},
|
|
452
|
-
}, null, 2),
|
|
453
|
-
},
|
|
454
|
-
],
|
|
455
|
-
};
|
|
456
|
-
}
|
|
457
310
|
case "query_entity": {
|
|
458
311
|
const { entity: entityName } = args;
|
|
459
312
|
const details = graph.getEntityDetails(entityName);
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -60,7 +60,7 @@ async function initialize(): Promise<void> {
|
|
|
60
60
|
const server = new Server(
|
|
61
61
|
{
|
|
62
62
|
name: "engram",
|
|
63
|
-
version: "0.3.
|
|
63
|
+
version: "0.3.2",
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
66
|
capabilities: {
|
|
@@ -159,91 +159,6 @@ const TOOLS = [
|
|
|
159
159
|
openWorldHint: false,
|
|
160
160
|
},
|
|
161
161
|
},
|
|
162
|
-
{
|
|
163
|
-
name: "create_entity",
|
|
164
|
-
description: "ADVANCED: Manually create an entity. Rarely needed - remember auto-extracts entities. Only use when: (1) creating an entity that won't appear in any memory content, or (2) correcting entity type after auto-extraction.",
|
|
165
|
-
inputSchema: {
|
|
166
|
-
type: "object" as const,
|
|
167
|
-
properties: {
|
|
168
|
-
name: {
|
|
169
|
-
type: "string",
|
|
170
|
-
description: "Entity name (e.g., 'John Smith', 'Paris', 'Machine Learning')",
|
|
171
|
-
},
|
|
172
|
-
type: {
|
|
173
|
-
type: "string",
|
|
174
|
-
enum: ["person", "place", "concept", "event", "organization"],
|
|
175
|
-
description: "Type of entity",
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
required: ["name", "type"],
|
|
179
|
-
},
|
|
180
|
-
annotations: {
|
|
181
|
-
title: "Create Entity",
|
|
182
|
-
readOnlyHint: false,
|
|
183
|
-
destructiveHint: false,
|
|
184
|
-
idempotentHint: true,
|
|
185
|
-
openWorldHint: false,
|
|
186
|
-
},
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
name: "observe",
|
|
190
|
-
description: "ADVANCED: Add a fact to an EXISTING entity without creating a memory. Rarely needed - use remember instead, which stores the content AND links it to entities. Only use observe for adding metadata or corrections to entities.",
|
|
191
|
-
inputSchema: {
|
|
192
|
-
type: "object" as const,
|
|
193
|
-
properties: {
|
|
194
|
-
entity: {
|
|
195
|
-
type: "string",
|
|
196
|
-
description: "Entity name to add observation to (must already exist)",
|
|
197
|
-
},
|
|
198
|
-
observation: {
|
|
199
|
-
type: "string",
|
|
200
|
-
description: "The fact or observation to record",
|
|
201
|
-
},
|
|
202
|
-
confidence: {
|
|
203
|
-
type: "number",
|
|
204
|
-
description: "Confidence in this observation (0-1)",
|
|
205
|
-
default: 1.0,
|
|
206
|
-
},
|
|
207
|
-
},
|
|
208
|
-
required: ["entity", "observation"],
|
|
209
|
-
},
|
|
210
|
-
annotations: {
|
|
211
|
-
title: "Add Observation",
|
|
212
|
-
readOnlyHint: false,
|
|
213
|
-
destructiveHint: false,
|
|
214
|
-
idempotentHint: false,
|
|
215
|
-
openWorldHint: false,
|
|
216
|
-
},
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
name: "relate",
|
|
220
|
-
description: "ADVANCED: Manually create a relationship between two entities. Rarely needed - remember auto-extracts relationships from text. Only use when: (1) the relationship wasn't captured by auto-extraction, or (2) you need to add a relationship not mentioned in any memory.",
|
|
221
|
-
inputSchema: {
|
|
222
|
-
type: "object" as const,
|
|
223
|
-
properties: {
|
|
224
|
-
from: {
|
|
225
|
-
type: "string",
|
|
226
|
-
description: "Source entity name",
|
|
227
|
-
},
|
|
228
|
-
to: {
|
|
229
|
-
type: "string",
|
|
230
|
-
description: "Target entity name",
|
|
231
|
-
},
|
|
232
|
-
relation: {
|
|
233
|
-
type: "string",
|
|
234
|
-
description: "Type of relationship (e.g., 'sibling', 'works_at', 'knows', 'located_in')",
|
|
235
|
-
},
|
|
236
|
-
},
|
|
237
|
-
required: ["from", "to", "relation"],
|
|
238
|
-
},
|
|
239
|
-
annotations: {
|
|
240
|
-
title: "Create Relationship",
|
|
241
|
-
readOnlyHint: false,
|
|
242
|
-
destructiveHint: false,
|
|
243
|
-
idempotentHint: true,
|
|
244
|
-
openWorldHint: false,
|
|
245
|
-
},
|
|
246
|
-
},
|
|
247
162
|
{
|
|
248
163
|
name: "query_entity",
|
|
249
164
|
description: "Get all stored information about a specific person, place, or organization. Use after recall to get deeper details about an entity mentioned in search results.",
|
|
@@ -440,90 +355,6 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
440
355
|
};
|
|
441
356
|
}
|
|
442
357
|
|
|
443
|
-
case "create_entity": {
|
|
444
|
-
const { name: entityName, type } = args as {
|
|
445
|
-
name: string;
|
|
446
|
-
type: "person" | "place" | "concept" | "event" | "organization";
|
|
447
|
-
};
|
|
448
|
-
|
|
449
|
-
const entity = graph.getOrCreateEntity(entityName, type);
|
|
450
|
-
|
|
451
|
-
return {
|
|
452
|
-
content: [
|
|
453
|
-
{
|
|
454
|
-
type: "text" as const,
|
|
455
|
-
text: JSON.stringify({
|
|
456
|
-
success: true,
|
|
457
|
-
entity: {
|
|
458
|
-
id: entity.id,
|
|
459
|
-
name: entity.name,
|
|
460
|
-
type: entity.type,
|
|
461
|
-
},
|
|
462
|
-
}, null, 2),
|
|
463
|
-
},
|
|
464
|
-
],
|
|
465
|
-
};
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
case "observe": {
|
|
469
|
-
const { entity: entityName, observation, confidence = 1.0 } = args as {
|
|
470
|
-
entity: string;
|
|
471
|
-
observation: string;
|
|
472
|
-
confidence?: number;
|
|
473
|
-
};
|
|
474
|
-
|
|
475
|
-
// Ensure entity exists
|
|
476
|
-
const entity = graph.getOrCreateEntity(entityName, "person");
|
|
477
|
-
|
|
478
|
-
// Add observation
|
|
479
|
-
const obs = graph.addObservation(entity.id, observation, undefined, confidence);
|
|
480
|
-
|
|
481
|
-
return {
|
|
482
|
-
content: [
|
|
483
|
-
{
|
|
484
|
-
type: "text" as const,
|
|
485
|
-
text: JSON.stringify({
|
|
486
|
-
success: true,
|
|
487
|
-
entity: entity.name,
|
|
488
|
-
observation_id: obs.id,
|
|
489
|
-
}, null, 2),
|
|
490
|
-
},
|
|
491
|
-
],
|
|
492
|
-
};
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
case "relate": {
|
|
496
|
-
const { from, to, relation } = args as {
|
|
497
|
-
from: string;
|
|
498
|
-
to: string;
|
|
499
|
-
relation: string;
|
|
500
|
-
};
|
|
501
|
-
|
|
502
|
-
// Ensure both entities exist
|
|
503
|
-
const fromEntity = graph.getOrCreateEntity(from, "person");
|
|
504
|
-
const toEntity = graph.getOrCreateEntity(to, "person");
|
|
505
|
-
|
|
506
|
-
// Create relation
|
|
507
|
-
const rel = graph.relate(fromEntity.id, toEntity.id, relation);
|
|
508
|
-
|
|
509
|
-
return {
|
|
510
|
-
content: [
|
|
511
|
-
{
|
|
512
|
-
type: "text" as const,
|
|
513
|
-
text: JSON.stringify({
|
|
514
|
-
success: true,
|
|
515
|
-
relation: {
|
|
516
|
-
id: rel.id,
|
|
517
|
-
from: fromEntity.name,
|
|
518
|
-
to: toEntity.name,
|
|
519
|
-
type: rel.type,
|
|
520
|
-
},
|
|
521
|
-
}, null, 2),
|
|
522
|
-
},
|
|
523
|
-
],
|
|
524
|
-
};
|
|
525
|
-
}
|
|
526
|
-
|
|
527
358
|
case "query_entity": {
|
|
528
359
|
const { entity: entityName } = args as { entity: string };
|
|
529
360
|
|