Skip to main content
Glama
nebula-contrib

NebulaGraph MCP Server

list_spaces

Retrieve all available graph database spaces to explore data structures and relationships within NebulaGraph.

Instructions

List all available spaces Returns: The available spaces

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'list_spaces' tool, decorated with @mcp.tool() for registration in the MCP server. It connects to NebulaGraph, executes 'SHOW SPACES' query, and formats the list of available spaces as output.
    @mcp.tool()
    def list_spaces() -> str:
        """List all available spaces
        Returns:
            The available spaces
        """
        pool = get_connection_pool()
        session = pool.get_session(
            os.getenv("NEBULA_USER", "root"), os.getenv("NEBULA_PASSWORD", "nebula")
        )
    
        try:
            result = session.execute("SHOW SPACES")
            if result.is_succeeded():
                spaces = result.column_values("Name")
                return "Available spaces:\n" + "\n".join(f"- {space}" for space in spaces)
            return f"Failed to list spaces: {result.error_msg()}"
        finally:
            session.release()

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