Skip to main content
Glama
Xuanwo

MCP Server for Apache OpenDAL™

by Xuanwo

list

List files across S3, Azure Blob, and GCS storage services by providing a resource URI. Returns directory contents as a string.

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 MCP tool handler function for 'list'. Decorated with @mcp.tool(), it parses the URI, ensures the path ends with a slash, calls resource.list(), and returns the entries as a string.
    @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}"
  • Registration of the 'list' tool via the @mcp.tool() decorator on the async function.
    # Modify the list tool to ensure the path ends with a slash
    @mcp.tool()
  • The OpendalResource.list() method that performs the actual OpenDAL listing operation. Calls self.op.list(prefix) and iterates over entries up to max_keys limit.
    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
  • The parse_uri() helper function used by the list tool handler to parse a URI string into an OpendalResource and a path.
    def parse_uri(uri: str) -> Tuple[OpendalResource, str]:
        """Parse a URI into a resource and path"""
        from urllib.parse import unquote, urlparse
    
        logger.debug(f"Parsing URI: {uri}")
        parsed = urlparse(uri)
    
        scheme = parsed.scheme
        path = parsed.netloc + parsed.path
        path = unquote(path)  # Decode URL-encoded characters
        return (OpendalResource(scheme), path)
  • Integration test for the 'list' tool, verifying directory listing functionality (imports list from server and tests both root and subdirectory listing).
    async def test_list_directory_contents(setup_env, test_files):
        """Test listing directory contents"""
        result = await list("fs://")
    
        assert "test_text.txt" in result
        assert "binary_file.bin" in result
        assert "config.json" in result
        assert "subdir" in result
    
        subdir_result = await list("fs://subdir/")
        assert "nested_file.log" in subdir_result
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must fully disclose behavior. It only states the return type is a string with directory content, but lacks details on pagination, error handling, or side effects. The read-only nature is implied but not explicit.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise (5 lines) with clear Args/Returns structure. Every sentence adds value with no wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple list tool with one parameter and no output schema, the description covers the basic purpose and parameter. However, it lacks details on output format, behavior with invalid URIs, and performance expectations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description compensates well. It explains the 'uri' parameter as a resource URI with an example format, adding meaning beyond the raw schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'List files in OpenDAL service' which is a specific verb and resource. It distinguishes from siblings like 'read' and 'get_info' by the listing action, but does not explicitly differentiate them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives (e.g., when to use 'read' instead). There is no mention of prerequisites or context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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