Skip to main content
Glama
JustTryAI

Databricks MCP Server

list_notebooks

Retrieve a list of notebooks from a specified workspace directory in Databricks. Use this tool to view available notebooks for development or analysis tasks.

Instructions

List notebooks in a workspace directory with parameter: path (required)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Implementation Reference

  • MCP tool handler for 'list_notebooks': decorator registers the tool and the function wraps the API call to list notebooks in a Databricks workspace directory, handling params and errors.
        name="list_notebooks",
        description="List notebooks in a workspace directory with parameter: path (required)",
    )
    async def list_notebooks(params: Dict[str, Any]) -> List[TextContent]:
        logger.info(f"Listing notebooks with params: {params}")
        try:
            result = await notebooks.list_notebooks(params.get("path"))
            return [{"text": json.dumps(result)}]
        except Exception as e:
            logger.error(f"Error listing notebooks: {str(e)}")
            return [{"text": json.dumps({"error": str(e)})}]
  • Helper function implementing the core logic: calls Databricks /api/2.0/workspace/list API to retrieve the list of notebooks/files in the specified path.
    async def list_notebooks(path: str) -> Dict[str, Any]:
        """
        List notebooks in a workspace directory.
        
        Args:
            path: The path to list
            
        Returns:
            Response containing the directory listing
            
        Raises:
            DatabricksAPIError: If the API request fails
        """
        logger.info(f"Listing notebooks in path: {path}")
        return make_api_request("GET", "/api/2.0/workspace/list", params={"path": path})
  • Tool registration via @self.tool decorator specifying name and description (input schema inferred).
        name="list_notebooks",
        description="List notebooks in a workspace directory with parameter: path (required)",
    )
    async def list_notebooks(params: Dict[str, Any]) -> List[TextContent]:

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/JustTryAI/databricks-mcp-server'

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