Skip to main content
Glama
aliyun

AlibabaCloud MCP Server

Official
by aliyun

ListObjects

Retrieve all file information from a specified AlibabaCloud OSS bucket. Use region ID, bucket name, and optional prefix to filter results for efficient resource management.

Instructions

获取指定OSS存储空间中的所有文件信息。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
BucketNameYesAlibabaCloud OSS Bucket Name
PrefixNoAlibabaCloud OSS Bucket Name prefix
RegionIdNoAlibabaCloud region IDcn-hangzhou

Implementation Reference

  • The main handler function implementing the OSS_ListObjects tool, which lists all objects in a specified Alibaba Cloud OSS bucket using pagination.
    @tools.append
    def OSS_ListObjects(
        BucketName: str = Field(description='AlibabaCloud OSS Bucket Name'),
        RegionId: str = Field(description='AlibabaCloud region ID', default='cn-hangzhou'),
        Prefix: str = Field(description='AlibabaCloud OSS Bucket Name prefix', default=None)
    ):
        """获取指定OSS存储空间中的所有文件信息。"""
        if not BucketName:
            raise ValueError("Bucket name is required")
        client = create_client(region_id=RegionId)
        paginator = client.list_objects_v2_paginator()
        results = []
        for page in paginator.iter_page(oss.ListObjectsV2Request(
                bucket=BucketName,
                prefix=Prefix
            )):
            for object in page.contents:
                results.append(object.__str__())
        return results
  • Registers the OSS tools, including OSS_ListObjects, to the FastMCP server instance.
    for tool in oss_tools.tools:
        mcp.tool(tool)
  • Appends the OSS_ListObjects function to the local tools list for later registration.
    @tools.append
  • Helper function to create an authenticated OSS client using credentials from headers or client.
    def create_client(region_id: str) -> oss.Client:
        credentials_provider = CredentialsProvider()
        cfg = oss.config.load_default()
        cfg.user_agent = 'alibaba-cloud-ops-mcp-server'
        cfg.credentials_provider = credentials_provider
        cfg.region = region_id
        return oss.Client(cfg)
  • Pydantic Field definitions providing input schema and descriptions for the tool parameters.
        BucketName: str = Field(description='AlibabaCloud OSS Bucket Name'),
        RegionId: str = Field(description='AlibabaCloud region ID', default='cn-hangzhou'),
        Prefix: str = Field(description='AlibabaCloud OSS Bucket Name prefix', default=None)
    ):
        """获取指定OSS存储空间中的所有文件信息。"""
        if not BucketName:
            raise ValueError("Bucket name is required")
        client = create_client(region_id=RegionId)
        paginator = client.list_objects_v2_paginator()
        results = []
        for page in paginator.iter_page(oss.ListObjectsV2Request(
                bucket=BucketName,
                prefix=Prefix
            )):
            for object in page.contents:
                results.append(object.__str__())
        return results
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states it retrieves file information, implying a read-only operation, but doesn't specify whether this is safe, if it requires specific permissions, what the output format is, or any rate limits. For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior and constraints.

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 a single, efficient sentence that directly states the tool's purpose without any unnecessary words. It's front-loaded with the core action and resource, making it easy to understand at a glance. Every part of the sentence contributes to clarifying the tool's function.

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

Completeness2/5

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

Given the complexity of interacting with cloud storage (OSS), no annotations, and no output schema, the description is incomplete. It doesn't explain what 'file information' includes, how results are returned, pagination, error handling, or authentication needs. For a tool that likely returns a list of objects with metadata, more context is needed to use it effectively.

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

Parameters3/5

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

The schema description coverage is 100%, with clear descriptions for all three parameters (BucketName, Prefix, RegionId). The description adds no additional parameter semantics beyond what the schema provides, such as explaining how Prefix filters results or default behaviors. Since the schema does the heavy lifting, the baseline score of 3 is appropriate.

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 the action ('获取' meaning 'get' or 'retrieve') and resource ('所有文件信息' meaning 'all file information' from an OSS storage space). It specifies the scope ('指定OSS存储空间中' meaning 'in the specified OSS storage space'), making the purpose unambiguous. However, it doesn't explicitly differentiate from sibling tools like ListBuckets, which likely lists buckets rather than objects within a bucket, so it misses full sibling distinction.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any prerequisites, such as needing proper authentication or permissions, or compare it to other tools like ListBuckets or DescribeInstances. The context is implied by the tool name and description, but no explicit usage rules are given.

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

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/aliyun/alibaba-cloud-ops-mcp-server'

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