Skip to main content
Glama
samhavens

Databricks MCP Server

by samhavens

list_notebooks

Retrieve a list of notebooks within a specified workspace directory on Databricks MCP Server for efficient workspace navigation and management.

Instructions

List notebooks in a workspace directory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Implementation Reference

  • MCP tool handler for 'list_notebooks' that delegates to the notebooks API and serializes the result to JSON string.
    @mcp.tool() async def list_notebooks(path: str) -> str: """List notebooks in a workspace directory""" logger.info(f"Listing notebooks in: {path}") try: result = await notebooks.list_notebooks(path) return json.dumps(result) except Exception as e: logger.error(f"Error listing notebooks: {str(e)}") return json.dumps({"error": str(e)})
  • Core helper function implementing the Databricks workspace/list API call to list notebooks/directories.
    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})
  • Registration of the 'list_notebooks' tool via @mcp.tool() decorator in the FastMCP server.
    @mcp.tool() async def list_notebooks(path: str) -> str: """List notebooks in a workspace directory""" logger.info(f"Listing notebooks in: {path}") try: result = await notebooks.list_notebooks(path) return json.dumps(result) except Exception as e: logger.error(f"Error listing notebooks: {str(e)}") return json.dumps({"error": str(e)})

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

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