Skip to main content
Glama
samhavens

Databricks MCP Server

by samhavens

list_files

Retrieve and display files and directories from Databricks File System (DBFS) by specifying a path. Streamlines file management within Databricks environments.

Instructions

List files and directories in DBFS

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dbfs_pathNo/

Implementation Reference

  • The MCP tool handler for 'list_files'. Decorated with @mcp.tool(), it handles the tool execution by calling the dbfs.list_files helper and returning 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 API function that performs the actual Databricks DBFS list API call.
    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