Skip to main content
Glama
nebula-contrib

NebulaGraph MCP Server

find_path

Discover connections between two nodes in a NebulaGraph database by identifying paths based on specified depth and space parameters.

Instructions

Find paths between two vertices Args: src: The source vertex ID dst: The destination vertex ID space: The space to use depth: The maximum path depth limit: The maximum number of paths to return Returns: The path results

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
srcYes
dstYes
spaceYes
depthNo
limitNo

Implementation Reference

  • The 'find_path' tool handler registered with @mcp.tool(). It delegates the execution to the get_path_resource helper function.
    @mcp.tool()
    def find_path(src: str, dst: str, space: str, depth: int = 3, limit: int = 10) -> str:
        """Find paths between two vertices
        Args:
            src: The source vertex ID
            dst: The destination vertex ID
            space: The space to use
            depth: The maximum path depth
            limit: The maximum number of paths to return
        Returns:
            The path results
        """
        return get_path_resource(space, src, dst, depth, limit)
  • Supporting helper function that performs the actual NebulaGraph query (FIND ALL PATH) to find paths between source and destination vertices and formats the output.
    @mcp.resource("path://space/{space}/from/{src}/to/{dst}/depth/{depth}/limit/{limit}")
    def get_path_resource(space: str, src: str, dst: str, depth: int, limit: int) -> str:
        """Get the path between two vertices
        Args:
            space: The space to use
            src: The source vertex ID
            dst: The destination vertex ID
            depth: The maximum path depth
            limit: The maximum number of paths to return
        Returns:
            The path between the source and destination vertices
        """
        pool = get_connection_pool()
        session = pool.get_session(
            os.getenv("NEBULA_USER", "root"), os.getenv("NEBULA_PASSWORD", "nebula")
        )
    
        try:
            session.execute(f"USE {space}")
    
            query = f"""FIND ALL PATH WITH PROP FROM "{src}" TO "{dst}" OVER * BIDIRECT UPTO {depth} STEPS
                      YIELD PATH AS paths | LIMIT {limit}"""
    
            result = session.execute(query)
            if result.is_succeeded():
                # Format the path results
                if result.row_size() > 0:
                    output = f"Find paths from {src} to {dst}: \n\n"
    
                    # Iterate through all paths
                    for i in range(result.row_size()):
                        path = result.row_values(i)[
                            0
                        ]  # The path should be in the first column
                        output += f"Path {i + 1}:\n{path}\n\n"
    
                    return output
                return f"No paths found from {src} to {dst}"
            else:
                return f"Query failed: {result.error_msg()}"
        finally:
            session.release()
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states what the tool does but doesn't describe important behavioral traits: whether this is a read-only operation, computational complexity, timeout risks, authentication requirements, or rate limits. The description is minimal and lacks behavioral context beyond the basic function.

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

Conciseness3/5

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

The description is structured with clear sections (Args, Returns) but includes redundant information. The parameter listing repeats what's in the schema without adding value. 'Returns: The path results' is vague and doesn't earn its place. The core purpose statement is front-loaded but could be more efficient.

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

Completeness2/5

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

For a 5-parameter tool with no annotations and no output schema, the description is incomplete. It doesn't explain what a 'path' consists of, what format the results take, error conditions, or performance characteristics. The agent lacks sufficient context to use this tool effectively beyond basic parameter passing.

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

Parameters3/5

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

The description lists all 5 parameters with brief labels, but with 0% schema description coverage, it doesn't fully compensate. It adds basic meaning (e.g., 'src' is 'source vertex ID') but lacks details on format, constraints, or examples. The schema provides titles and types, but the description adds minimal semantic value beyond what's already in the schema structure.

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 tool's purpose: 'Find paths between two vertices' which is a specific verb+resource combination. It distinguishes itself from sibling tools like 'find_neighbors' (which likely finds adjacent vertices) and 'execute_query' (more general). However, it doesn't explicitly differentiate from siblings beyond the core function.

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. There's no mention of prerequisites, when this tool is appropriate compared to 'find_neighbors' or 'execute_query', or any constraints on usage. The agent must infer usage from the tool name and parameters alone.

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/nebula-contrib/nebulagraph-mcp-server'

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