list_notebooks
Enumerate notebooks within a specified workspace directory using the 'path' parameter to streamline resource management on Databricks MCP Server.
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 and registration for 'list_notebooks'. Calls the notebooks API and formats the response as MCP TextContent.@self.tool( 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)Underlying API helper function that performs the actual Databricks API request to list workspace items.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})