Skip to main content
Glama
yodakeisuke

Knowledge Graph Memory Server

by yodakeisuke

create_relations

Define and establish new connections between entities in a knowledge graph, enabling structured data storage and retrieval for persistent memory in 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

  • The core handler function in KnowledgeGraphManager that executes the create_relations tool logic: loads the knowledge graph, filters out duplicate relations, appends new relations, saves the graph, and returns the newly added 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; }
  • index.ts:390-411 (registration)
    Registers the 'create_relations' tool in the ListToolsRequest response, including its name, description, and input schema.
    { 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"], }, },
  • Dispatches the CallToolRequest for 'create_relations' to the KnowledgeGraphManager.createRelations method, serializes the result, and returns it in the expected MCP format.
    case "create_relations": return createResponse(JSON.stringify(await knowledgeGraphManager.createRelations(args.relations as Relation[]), null, 2));
  • TypeScript interface defining the structure of a Relation used by the create_relations tool.
    interface Relation { from: string; to: string; relationType: string; }
  • JSON schema defining the input parameters for the create_relations tool, specifying an array of relations with from, to, and relationType fields.
    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"], },

Other Tools

Related Tools

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