Skip to main content
Glama
samhavens

Databricks MCP Server

by samhavens

list_files

Browse and view files and directories in Databricks DBFS to manage data storage and access within the Databricks environment.

Instructions

List files and directories in DBFS

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dbfs_pathNo/

Implementation Reference

  • The MCP tool handler for 'list_files', registered via @mcp.tool() decorator. Calls the underlying dbfs.list_files helper and returns JSON response.
    @mcp.tool() async def list_files(dbfs_path: str = "/") -> str: """List files and directories in DBFS""" logger.info(f"Listing files in: {dbfs_path}") try: result = await dbfs.list_files(dbfs_path) return json.dumps(result) except Exception as e: logger.error(f"Error listing files: {str(e)}") return json.dumps({"error": str(e)})
  • Supporting helper function in the DBFS API module that performs the actual Databricks API call to list files in DBFS.
    async def list_files(dbfs_path: str) -> Dict[str, Any]: """ List files and directories in a DBFS path. Args: dbfs_path: The path to list Returns: Response containing the directory listing Raises: DatabricksAPIError: If the API request fails """ logger.info(f"Listing files in DBFS path: {dbfs_path}") return make_api_request("GET", "/api/2.0/dbfs/list", params={"path": dbfs_path})

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