Skip to main content
Glama

search_memory_facts

Search graph memory for relevant facts using queries, group filters, or node references to retrieve structured information.

Instructions

Search the graph memory for relevant facts.

Args:
    query: The search query
    group_ids: Optional list of group IDs to filter results
    max_facts: Maximum number of facts to return (default: 10)
    center_node_uuid: Optional UUID of a node to center the search around

Returns:
    List of fact dictionaries containing search results

Example:
    search_memory_facts(
        query="implementation dependencies",
        group_ids=["knowledge-smith"],
        max_facts=10
    )

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
group_idsNo
max_factsNo
center_node_uuidNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler for 'search_memory_facts'. Registers the tool via @mcp.tool() and delegates to graphiti_tools.search_facts_impl.
    @mcp.tool()
    async def search_memory_facts(
        query: str,
        group_ids: Optional[List[str]] = None,
        max_facts: int = 10,
        center_node_uuid: Optional[str] = None,
    ) -> List[Dict[str, Any]]:
        """
        Search the graph memory for relevant facts.
    
        Args:
            query: The search query
            group_ids: Optional list of group IDs to filter results
            max_facts: Maximum number of facts to return (default: 10)
            center_node_uuid: Optional UUID of a node to center the search around
    
        Returns:
            List of fact dictionaries containing search results
    
        Example:
            search_memory_facts(
                query="implementation dependencies",
                group_ids=["knowledge-smith"],
                max_facts=10
            )
    
        @REQ: REQ-graphiti-chunk-mcp
        @BP: BP-graphiti-chunk-mcp
        @TASK: TASK-007-MCPTools
        """
        return await graphiti_tools.search_facts_impl(
            query=query,
            group_ids=group_ids,
            max_facts=max_facts,
            center_node_uuid=center_node_uuid,
        )
  • Core implementation of search_memory_facts logic. Creates GraphitiClient and calls client.search_facts to perform the graph search.
    async def search_facts_impl(
        query: str,
        group_ids: Optional[List[str]] = None,
        max_facts: int = 10,
        center_node_uuid: Optional[str] = None,
    ) -> List[Dict[str, Any]]:
        """
        Search the graph memory for relevant facts.
    
        @REQ: REQ-graphiti-chunk-mcp
        @BP: BP-graphiti-chunk-mcp
        @TASK: TASK-007-MCPTools
    
        Args:
            query: The search query
            group_ids: Optional list of group IDs to filter results
            max_facts: Maximum number of facts to return (default: 10)
            center_node_uuid: Optional UUID of a node to center the search around
    
        Returns:
            List of fact dictionaries containing search results
    
        Raises:
            ToolError: If search operation fails
        """
        try:
            client = get_graphiti_client()
            async with client:
                results = await client.search_facts(
                    query=query,
                    center_node_uuid=center_node_uuid,
                    group_ids=group_ids,
                    max_facts=max_facts,
                )
                return results
    
        except Exception as e:
            raise ToolError(
                "SEARCH_FACTS_ERROR",
                f"Failed to search facts: {str(e)}"
            ) from e
  • The @mcp.tool() decorator registers 'search_memory_facts' as an MCP tool.
    @mcp.tool()
    async def search_memory_facts(
        query: str,
        group_ids: Optional[List[str]] = None,
        max_facts: int = 10,
        center_node_uuid: Optional[str] = None,
    ) -> List[Dict[str, Any]]:
        """
        Search the graph memory for relevant facts.
    
        Args:
            query: The search query
            group_ids: Optional list of group IDs to filter results
            max_facts: Maximum number of facts to return (default: 10)
            center_node_uuid: Optional UUID of a node to center the search around
    
        Returns:
            List of fact dictionaries containing search results
    
        Example:
            search_memory_facts(
                query="implementation dependencies",
                group_ids=["knowledge-smith"],
                max_facts=10
            )
    
        @REQ: REQ-graphiti-chunk-mcp
        @BP: BP-graphiti-chunk-mcp
        @TASK: TASK-007-MCPTools
        """
        return await graphiti_tools.search_facts_impl(
            query=query,
            group_ids=group_ids,
            max_facts=max_facts,
            center_node_uuid=center_node_uuid,
        )
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the tool 'returns' results but doesn't describe what happens during execution (e.g., search algorithm, performance characteristics, error conditions, or rate limits). For a search tool with zero annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (purpose, args, returns, example) and uses minimal, purposeful sentences. Every element adds value without redundancy, and the example provides concrete usage guidance efficiently.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (4 parameters, 1 required) and the presence of an output schema (which handles return value documentation), the description provides adequate context. The parameter semantics are well-covered, and the example adds practical guidance. The main gap is the lack of behavioral context and usage guidelines relative to siblings.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description provides clear semantic explanations for all 4 parameters in the 'Args' section, adding meaningful context beyond the schema's 0% description coverage. Each parameter is explained with purpose and defaults where applicable, fully compensating for the schema's lack of descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('search') and resource ('graph memory for relevant facts'), making the purpose immediately understandable. However, it doesn't differentiate this tool from its sibling 'search_memory_nodes', which appears to be a related search operation, so it doesn't achieve the highest score for sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'search_memory_nodes' or other siblings. There's no mention of prerequisites, appropriate contexts, or exclusions, leaving the agent with minimal usage direction beyond the basic purpose.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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