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
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
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)})}]
- src/api/notebooks.py:93-107 (helper)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})
- src/server/databricks_mcp_server.py:145-148 (registration)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]: