Skip to main content
Glama

get_entity_edge

Retrieve relationship connections between entities from graph memory using UUIDs to access structured document data efficiently.

Instructions

Get an entity edge from the graph memory by its UUID.

Args:
    uuid: UUID of the entity edge to retrieve

Returns:
    Entity edge dictionary containing edge details:
    {
        "uuid": "edge-uuid",
        "source_node_uuid": "source-uuid",
        "target_node_uuid": "target-uuid",
        "fact": "relationship description",
        "episodes": ["episode-uuid-1", "episode-uuid-2"],
        "valid_at": "2025-01-01T00:00:00Z",
        "invalid_at": null
    }

Example:
    get_entity_edge(uuid="edge-uuid-123")

@REQ: REQ-graphiti-chunk-mcp
@BP: BP-graphiti-chunk-mcp
@TASK: TASK-007-MCPTools

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uuidYes

Implementation Reference

  • MCP tool handler for 'get_entity_edge'. Decorated with @mcp.tool() for automatic registration and schema inference from type hints. Delegates to graphiti_tools.get_entity_edge_impl.
    @mcp.tool()
    async def get_entity_edge(uuid: str) -> Dict[str, Any]:
        """
        Get an entity edge from the graph memory by its UUID.
    
        Args:
            uuid: UUID of the entity edge to retrieve
    
        Returns:
            Entity edge dictionary containing edge details:
            {
                "uuid": "edge-uuid",
                "source_node_uuid": "source-uuid",
                "target_node_uuid": "target-uuid",
                "fact": "relationship description",
                "episodes": ["episode-uuid-1", "episode-uuid-2"],
                "valid_at": "2025-01-01T00:00:00Z",
                "invalid_at": null
            }
    
        Example:
            get_entity_edge(uuid="edge-uuid-123")
    
        @REQ: REQ-graphiti-chunk-mcp
        @BP: BP-graphiti-chunk-mcp
        @TASK: TASK-007-MCPTools
        """
        return await graphiti_tools.get_entity_edge_impl(uuid=uuid)
  • Helper implementation that creates GraphitiClient and calls client.get_entity_edge, with error handling.
    async def get_entity_edge_impl(uuid: str) -> Dict[str, Any]:
        """
        Get an entity edge from the graph memory by its UUID.
    
        @REQ: REQ-graphiti-chunk-mcp
        @BP: BP-graphiti-chunk-mcp
        @TASK: TASK-007-MCPTools
    
        Args:
            uuid: UUID of the entity edge to retrieve
    
        Returns:
            Entity edge dictionary containing edge details
    
        Raises:
            ToolError: If retrieval operation fails
        """
        try:
            client = get_graphiti_client()
            async with client:
                edge = await client.get_entity_edge(uuid)
                return edge
    
        except Exception as e:
            raise ToolError(
                "GET_ENTITY_EDGE_ERROR",
                f"Failed to get entity edge: {str(e)}"
            ) from e
  • Core implementation in GraphitiClient: calls underlying graphiti.get_edge and formats the response dictionary.
    async def get_entity_edge(self, edge_uuid: str) -> Dict[str, Any]:
        """
        Get an entity edge from Graphiti by its UUID.
    
        @REQ: REQ-graphiti-chunk-mcp
        @BP: BP-graphiti-chunk-mcp
        @TASK: TASK-007-MCPTools
    
        Args:
            edge_uuid: UUID of the entity edge to retrieve
    
        Returns:
            Dictionary containing edge details
    
        Raises:
            RuntimeError: If retrieval fails
        """
        try:
            logger.debug(f"Getting entity edge: {edge_uuid}")
    
            edge = await self.graphiti.get_edge(edge_uuid)
    
            if edge is None:
                raise RuntimeError(f"Entity edge not found: {edge_uuid}")
    
            logger.info(f"Entity edge retrieved successfully: {edge_uuid}")
    
            return {
                "uuid": edge.uuid,
                "source_node_uuid": edge.source_node_uuid,
                "target_node_uuid": edge.target_node_uuid,
                "fact": edge.fact,
                "fact_embedding": edge.fact_embedding,
                "episodes": edge.episodes,
                "expired_at": edge.expired_at,
                "valid_at": edge.valid_at,
                "invalid_at": edge.invalid_at,
            }
    
        except Exception as e:
            logger.error(f"Failed to get entity edge {edge_uuid}: {e}")
            raise RuntimeError(f"Failed to get entity edge: {e}") from e

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/leo7nel23/KnowkedgeSmith-MCP'

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