Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 35 additions & 35 deletions src/memory/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,12 @@ server.registerTool(
{
title: "Create Entities",
description: "Create multiple new entities in the knowledge graph",
inputSchema: {
inputSchema: z.object({
entities: z.array(EntitySchema)
},
outputSchema: {
}),
outputSchema: z.object({
entities: z.array(EntitySchema)
}
})
},
async ({ entities }) => {
const result = await knowledgeGraphManager.createEntities(entities);
Expand All @@ -282,12 +282,12 @@ server.registerTool(
{
title: "Create Relations",
description: "Create multiple new relations between entities in the knowledge graph. Relations should be in active voice",
inputSchema: {
inputSchema: z.object({
relations: z.array(RelationSchema)
},
outputSchema: {
}),
outputSchema: z.object({
relations: z.array(RelationSchema)
}
})
},
async ({ relations }) => {
const result = await knowledgeGraphManager.createRelations(relations);
Expand All @@ -304,18 +304,18 @@ server.registerTool(
{
title: "Add Observations",
description: "Add new observations to existing entities in the knowledge graph",
inputSchema: {
inputSchema: z.object({
observations: z.array(z.object({
entityName: z.string().describe("The name of the entity to add the observations to"),
contents: z.array(z.string()).describe("An array of observation contents to add")
}))
},
outputSchema: {
}),
outputSchema: z.object({
results: z.array(z.object({
entityName: z.string(),
addedObservations: z.array(z.string())
}))
}
})
},
async ({ observations }) => {
const result = await knowledgeGraphManager.addObservations(observations);
Expand All @@ -332,13 +332,13 @@ server.registerTool(
{
title: "Delete Entities",
description: "Delete multiple entities and their associated relations from the knowledge graph",
inputSchema: {
inputSchema: z.object({
entityNames: z.array(z.string()).describe("An array of entity names to delete")
},
outputSchema: {
}),
outputSchema: z.object({
success: z.boolean(),
message: z.string()
}
})
},
async ({ entityNames }) => {
await knowledgeGraphManager.deleteEntities(entityNames);
Expand All @@ -355,16 +355,16 @@ server.registerTool(
{
title: "Delete Observations",
description: "Delete specific observations from entities in the knowledge graph",
inputSchema: {
inputSchema: z.object({
deletions: z.array(z.object({
entityName: z.string().describe("The name of the entity containing the observations"),
observations: z.array(z.string()).describe("An array of observations to delete")
}))
},
outputSchema: {
}),
outputSchema: z.object({
success: z.boolean(),
message: z.string()
}
})
},
async ({ deletions }) => {
await knowledgeGraphManager.deleteObservations(deletions);
Expand All @@ -381,13 +381,13 @@ server.registerTool(
{
title: "Delete Relations",
description: "Delete multiple relations from the knowledge graph",
inputSchema: {
inputSchema: z.object({
relations: z.array(RelationSchema).describe("An array of relations to delete")
},
outputSchema: {
}),
outputSchema: z.object({
success: z.boolean(),
message: z.string()
}
})
},
async ({ relations }) => {
await knowledgeGraphManager.deleteRelations(relations);
Expand All @@ -404,11 +404,11 @@ server.registerTool(
{
title: "Read Graph",
description: "Read the entire knowledge graph",
inputSchema: {},
outputSchema: {
inputSchema: z.object({}),
outputSchema: z.object({
entities: z.array(EntitySchema),
relations: z.array(RelationSchema)
}
})
},
async () => {
const graph = await knowledgeGraphManager.readGraph();
Expand All @@ -425,13 +425,13 @@ server.registerTool(
{
title: "Search Nodes",
description: "Search for nodes in the knowledge graph based on a query",
inputSchema: {
inputSchema: z.object({
query: z.string().describe("The search query to match against entity names, types, and observation content")
},
outputSchema: {
}),
outputSchema: z.object({
entities: z.array(EntitySchema),
relations: z.array(RelationSchema)
}
})
},
async ({ query }) => {
const graph = await knowledgeGraphManager.searchNodes(query);
Expand All @@ -448,13 +448,13 @@ server.registerTool(
{
title: "Open Nodes",
description: "Open specific nodes in the knowledge graph by their names",
inputSchema: {
inputSchema: z.object({
names: z.array(z.string()).describe("An array of entity names to retrieve")
},
outputSchema: {
}),
outputSchema: z.object({
entities: z.array(EntitySchema),
relations: z.array(RelationSchema)
}
})
},
async ({ names }) => {
const graph = await knowledgeGraphManager.openNodes(names);
Expand Down