Skip to main content
Glama
j3k0

Elasticsearch Knowledge Graph for MCP

by j3k0

open_nodes

Retrieve detailed information about specific entities and their relationships within the Elasticsearch Knowledge Graph, enabling structured querying and analysis for AI models.

Instructions

Get details about specific entities in knowledge graph (memory) and their relations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
memory_zoneYesOptional memory zone to retrieve entities from. If not specified, uses the default zone.
namesYesNames of entities to retrieve

Implementation Reference

  • Handler implementation for the 'open_nodes' tool. Fetches specified entities and their inter-relations from the knowledge graph (using kgClient), formats the data, and returns it via formatResponse.
    else if (toolName === "open_nodes") { const names = params.names || []; const zone = params.memory_zone; // Get the entities const entities: ESEntity[] = []; for (const name of names) { const entity = await kgClient.getEntity(name, zone); if (entity) { entities.push(entity); } } // Format entities const formattedEntities = entities.map(e => ({ name: e.name, entityType: e.entityType, observations: e.observations })); // Get relations between these entities const entityNames = formattedEntities.map(e => e.name); const { relations } = await kgClient.getRelationsForEntities(entityNames, zone); // Map relations to the expected format const formattedRelations = relations.map(r => ({ from: r.from, to: r.to, type: r.relationType, fromZone: r.fromZone, toZone: r.toZone })); return formatResponse({ entities: formattedEntities, relations: formattedRelations }); }
  • JSON schema definition for the 'open_nodes' tool input, specifying properties 'names' (required array of strings) and 'memory_zone' (required string), returned in ListTools response for tool registration.
    { name: "open_nodes", description: "Get details about specific entities in knowledge graph (memory) and their relations", inputSchema: { type: "object", properties: { names: { type: "array", items: {type: "string"}, description: "Names of entities to retrieve" }, memory_zone: { type: "string", description: "Optional memory zone to retrieve entities from. If not specified, uses the default zone." } }, required: ["names", "memory_zone"], additionalProperties: false, "$schema": "http://json-schema.org/draft-07/schema#" } },
  • src/index.ts:649-651 (registration)
    Registration of all tools including 'open_nodes' via the ListToolsRequestHandler, which returns the tool list containing the schema for open_nodes.
    }); // Register the call tool handler to handle tool executions

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/j3k0/mcp-brain-tools'

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