diff --git a/src/memory/index.ts b/src/memory/index.ts index b560bf1e53..7efbc27ad3 100644 --- a/src/memory/index.ts +++ b/src/memory/index.ts @@ -266,16 +266,12 @@ server.registerTool( description: "Create multiple new entities in the knowledge graph", inputSchema: { entities: z.array(EntitySchema) - }, - outputSchema: { - entities: z.array(EntitySchema) } }, async ({ entities }) => { const result = await knowledgeGraphManager.createEntities(entities); return { - content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }], - structuredContent: { entities: result } + content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }] }; } ); @@ -288,16 +284,12 @@ server.registerTool( description: "Create multiple new relations between entities in the knowledge graph. Relations should be in active voice", inputSchema: { relations: z.array(RelationSchema) - }, - outputSchema: { - relations: z.array(RelationSchema) } }, async ({ relations }) => { const result = await knowledgeGraphManager.createRelations(relations); return { - content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }], - structuredContent: { relations: result } + content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }] }; } ); @@ -313,19 +305,12 @@ server.registerTool( 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: { - results: z.array(z.object({ - entityName: z.string(), - addedObservations: z.array(z.string()) - })) } }, async ({ observations }) => { const result = await knowledgeGraphManager.addObservations(observations); return { - content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }], - structuredContent: { results: result } + content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }] }; } ); @@ -338,17 +323,12 @@ server.registerTool( description: "Delete multiple entities and their associated relations from the knowledge graph", inputSchema: { entityNames: z.array(z.string()).describe("An array of entity names to delete") - }, - outputSchema: { - success: z.boolean(), - message: z.string() } }, async ({ entityNames }) => { await knowledgeGraphManager.deleteEntities(entityNames); return { - content: [{ type: "text" as const, text: "Entities deleted successfully" }], - structuredContent: { success: true, message: "Entities deleted successfully" } + content: [{ type: "text" as const, text: "Entities deleted successfully" }] }; } ); @@ -364,17 +344,12 @@ server.registerTool( 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: { - success: z.boolean(), - message: z.string() } }, async ({ deletions }) => { await knowledgeGraphManager.deleteObservations(deletions); return { - content: [{ type: "text" as const, text: "Observations deleted successfully" }], - structuredContent: { success: true, message: "Observations deleted successfully" } + content: [{ type: "text" as const, text: "Observations deleted successfully" }] }; } ); @@ -387,17 +362,12 @@ server.registerTool( description: "Delete multiple relations from the knowledge graph", inputSchema: { relations: z.array(RelationSchema).describe("An array of relations to delete") - }, - outputSchema: { - success: z.boolean(), - message: z.string() } }, async ({ relations }) => { await knowledgeGraphManager.deleteRelations(relations); return { - content: [{ type: "text" as const, text: "Relations deleted successfully" }], - structuredContent: { success: true, message: "Relations deleted successfully" } + content: [{ type: "text" as const, text: "Relations deleted successfully" }] }; } ); @@ -408,17 +378,12 @@ server.registerTool( { title: "Read Graph", description: "Read the entire knowledge graph", - inputSchema: {}, - outputSchema: { - entities: z.array(EntitySchema), - relations: z.array(RelationSchema) - } + inputSchema: {} }, async () => { const graph = await knowledgeGraphManager.readGraph(); return { - content: [{ type: "text" as const, text: JSON.stringify(graph, null, 2) }], - structuredContent: { ...graph } + content: [{ type: "text" as const, text: JSON.stringify(graph, null, 2) }] }; } ); @@ -431,17 +396,12 @@ server.registerTool( description: "Search for nodes in the knowledge graph based on a query", inputSchema: { query: z.string().describe("The search query to match against entity names, types, and observation content") - }, - outputSchema: { - entities: z.array(EntitySchema), - relations: z.array(RelationSchema) } }, async ({ query }) => { const graph = await knowledgeGraphManager.searchNodes(query); return { - content: [{ type: "text" as const, text: JSON.stringify(graph, null, 2) }], - structuredContent: { ...graph } + content: [{ type: "text" as const, text: JSON.stringify(graph, null, 2) }] }; } ); @@ -454,17 +414,12 @@ server.registerTool( description: "Open specific nodes in the knowledge graph by their names", inputSchema: { names: z.array(z.string()).describe("An array of entity names to retrieve") - }, - outputSchema: { - entities: z.array(EntitySchema), - relations: z.array(RelationSchema) } }, async ({ names }) => { const graph = await knowledgeGraphManager.openNodes(names); return { - content: [{ type: "text" as const, text: JSON.stringify(graph, null, 2) }], - structuredContent: { ...graph } + content: [{ type: "text" as const, text: JSON.stringify(graph, null, 2) }] }; } );