Skip to main content
Glama
yodakeisuke

Knowledge Graph Memory Server

by yodakeisuke

create_relations

Adds multiple connections between entities in a knowledge graph using active voice relations to build persistent memory for chat applications.

Instructions

Create multiple new relations between entities in the knowledge graph. Relations should be in active voice

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
relationsYes

Implementation Reference

  • Core handler function for creating relations. Loads the knowledge graph, filters out duplicate relations, appends new ones, saves to persistent storage, and returns the newly created relations.
    async createRelations(relations: Relation[]): Promise<Relation[]> { const graph = await this.loadGraph(); const newRelations = relations.filter(r => !graph.relations.some(existingRelation => existingRelation.from === r.from && existingRelation.to === r.to && existingRelation.relationType === r.relationType )); graph.relations.push(...newRelations); await this.saveGraph(graph); return newRelations; }
  • Type definition for Relation used in the create_relations tool input.
    interface Relation { from: string; to: string; relationType: string; }
  • index.ts:390-411 (registration)
    Tool registration in ListToolsRequestHandler, including name, description, and input schema for create_relations.
    { name: "create_relations", description: "Create multiple new relations between entities in the knowledge graph. Relations should be in active voice", inputSchema: { type: "object", properties: { relations: { type: "array", items: { type: "object", properties: { from: { type: "string", description: "The name of the entity where the relation starts" }, to: { type: "string", description: "The name of the entity where the relation ends" }, relationType: { type: "string", description: "The type of the relation" }, }, required: ["from", "to", "relationType"], }, }, }, required: ["relations"], }, },
  • index.ts:555-556 (registration)
    Dispatch handler in CallToolRequestHandler switch statement that invokes the createRelations function.
    case "create_relations": return createResponse(JSON.stringify(await knowledgeGraphManager.createRelations(args.relations as Relation[]), null, 2));

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yodakeisuke/mcp-memory-domain-knowledge'

If you have feedback or need assistance with the MCP directory API, please join our Discord server