Skip to main content
Glama

list_files

Retrieve a list of files and directories within a specified DBFS path on Databricks MCP Server to manage and access Databricks resources efficiently.

Instructions

List files and directories in a DBFS path with parameter: dbfs_path (required)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Implementation Reference

  • Registration of the 'list_files' tool using the FastMCP decorator, specifying name and description (implicit schema).
    @self.tool( name="list_files", description="List files and directories in a DBFS path with parameter: dbfs_path (required)", )
  • The MCP tool handler function that processes params, calls the dbfs helper, and returns TextContent.
    async def list_files(params: Dict[str, Any]) -> List[TextContent]: logger.info(f"Listing files with params: {params}") try: result = await dbfs.list_files(params.get("dbfs_path")) return [{"text": json.dumps(result)}] except Exception as e: logger.error(f"Error listing files: {str(e)}") return [{"text": json.dumps({"error": str(e)})}]
  • Core helper function implementing the DBFS list API call via make_api_request.
    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})

Other Tools

Related Tools

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

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