Skip to main content
Glama
Xuanwo

MCP Server for Apache OpenDAL™

by Xuanwo

list

Retrieve directory contents from OpenDAL storage services by specifying the resource URI. Lists files and folder details for efficient data management.

Instructions

List files in OpenDAL service Args: uri: resource URI, e.g. mys3://path/to/dir Returns: String containing directory content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uriYes

Implementation Reference

  • The main handler for the 'list' MCP tool. Decorated with @mcp.tool() for automatic registration. Parses the URI, ensures directory path ends with '/', lists entries via OpendalResource.list(), and returns their string representation.
    @mcp.tool() async def list(uri: str) -> str: """ List files in OpenDAL service Args: uri: resource URI, e.g. mys3://path/to/dir Returns: String containing directory content """ logger.debug(f"Listing directory content: {uri}") try: resource, path = parse_uri(uri) # Ensure directory path ends with a slash if path and not path.endswith("/"): path = path + "/" entries = await resource.list(path) return str(entries) except Exception as e: logger.error(f"Failed to list directory content: {e!s}") return f"Error: {e!s}"
  • Helper method in OpendalResource class that performs the actual directory listing using the OpenDAL operator's list iterator.
    async def list( self, prefix: Union[str, os.PathLike], max_keys: int = 1000 ) -> List[Entry]: """List entries with the given prefix""" logger.debug(f"Listing entries with prefix: {prefix}") if max_keys <= 0: return [] entries = [] it = await self.op.list(prefix) async for entry in it: logger.debug(f"Listing entry: {entry}") entries.append(entry) if len(entries) >= max_keys: break return entries

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/Xuanwo/mcp-server-opendal'

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