Skip to main content
Glama
nebula-contrib

NebulaGraph MCP Server

get_space_schema

Retrieve schema information for a specified space in NebulaGraph database to understand data structure and relationships.

Instructions

Get the schema information of the specified space Args: space: The space to get the schema for Returns: The schema information of the specified space

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
spaceYes

Implementation Reference

  • The handler function for the 'get_space_schema' MCP tool, decorated with @mcp.tool(). It takes a space name and returns its schema by calling the helper resource function.
    @mcp.tool()
    def get_space_schema(space: str) -> str:
        """Get the schema information of the specified space
        Args:
            space: The space to get the schema for
        Returns:
            The schema information of the specified space
        """
        return get_space_schema_resource(space)
  • Helper function (also registered as MCP resource) that implements the core logic for retrieving and formatting the schema (tags and edges) of a NebulaGraph space.
    @mcp.resource("schema://space/{space}")
    def get_space_schema_resource(space: str) -> str:
        """Get the schema information of the specified space
        Args:
            space: The space to get the schema for
        Returns:
            The schema information of the specified space
        """
        pool = get_connection_pool()
        session = pool.get_session(
            os.getenv("NEBULA_USER", "root"), os.getenv("NEBULA_PASSWORD", "nebula")
        )
    
        try:
            session.execute(f"USE {space}")
            # Get tags
            tags = session.execute("SHOW TAGS").column_values("Name")
            # Get edges
            edges = session.execute("SHOW EDGES").column_values("Name")
    
            schema = f"Space: {space}\n\nTags:\n"
            for tag in tags:
                tag_result = session.execute(f"DESCRIBE TAG {tag}")
                schema += f"\n{tag}:\n"
                # Iterate through all rows
                for i in range(tag_result.row_size()):
                    field = tag_result.row_values(i)
                    schema += f"  - {field[0]}: {field[1]}\n"
    
            schema += "\nEdges:\n"
            for edge in edges:
                edge_result = session.execute(f"DESCRIBE EDGE {edge}")
                schema += f"\n{edge}:\n"
                # Iterate through all rows
                for i in range(edge_result.row_size()):
                    field = edge_result.row_values(i)
                    schema += f"  - {field[0]}: {field[1]}\n"
    
            return schema
        finally:
            session.release()
  • Registration of the 'get_space_schema' tool using @mcp.tool() decorator.
    @mcp.tool()
    def get_space_schema(space: str) -> str:
        """Get the schema information of the specified space
        Args:
            space: The space to get the schema for
        Returns:
            The schema information of the specified space
        """
        return get_space_schema_resource(space)
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 this is a read operation ('Get'), but doesn't describe what 'schema information' includes, whether there are permissions required, rate limits, error conditions, or what format the return data takes. For a tool with zero annotation coverage, this is inadequate.

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

Conciseness4/5

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

The description is appropriately concise with three sentences that each serve a purpose: stating the tool's function, documenting the parameter, and describing the return. It's front-loaded with the core purpose first. The structure is clear but could be slightly more polished.

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?

Given the tool has no annotations, no output schema, and minimal parameter documentation, the description is incomplete. It doesn't explain what 'schema information' means in this context, what format it returns, or any behavioral aspects. For a tool that presumably returns structured data about schemas, this leaves too much undefined.

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?

Schema description coverage is 0%, so the description must compensate. It documents the single parameter ('space') and explains it's 'The space to get the schema for', which adds semantic meaning beyond the schema's basic type information. However, it doesn't explain what constitutes a valid 'space' value or provide examples, leaving significant gaps.

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 with a specific verb ('Get') and resource ('schema information of the specified space'). It distinguishes from siblings like 'list_spaces' (which lists spaces) and 'execute_query' (which runs queries). However, it doesn't explicitly differentiate from potential schema-related tools that might exist elsewhere.

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?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention prerequisites, when this tool is appropriate versus other schema discovery methods, or any constraints on its use. It simply states what the tool does without context.

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