Skip to main content
Glama
aliyun

AlibabaCloud MCP Server

Official
by aliyun

ListBuckets

Retrieve a list of all Alibaba Cloud OSS buckets in a specified region, optionally filtered by a bucket name prefix, using the AlibabaCloud MCP Server API.

Instructions

列出指定区域的所有OSS存储空间。

Input Schema

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

Implementation Reference

  • Handler function for the OSS_ListBuckets tool (likely 'ListBuckets'), lists all OSS buckets in the specified region with optional prefix using paginator.
    @tools.append
    def OSS_ListBuckets(
        RegionId: str = Field(description='AlibabaCloud region ID', default='cn-hangzhou'),
        Prefix: str = Field(description='AlibabaCloud OSS Bucket Name prefix', default=None)
    ):
        """列出指定区域的所有OSS存储空间。"""
        client = create_client(region_id=RegionId)
        paginator = client.list_buckets_paginator()
        results = []
        for page in paginator.iter_page(oss.ListBucketsRequest(prefix=Prefix)):
            for bucket in page.buckets:
                results.append(bucket.__str__())
        return results
  • Registers the OSS tools, including the ListBuckets handler, with the MCP server.
    for tool in oss_tools.tools:
        mcp.tool(tool)
  • Helper function to create the OSS client configured with credentials and region.
    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)
  • Custom credentials provider for OSS client using header or credential client.
    class CredentialsProvider(EnvironmentVariableCredentialsProvider):
        def __init__(self) -> None:
            credentials = get_credentials_from_header()
            if credentials:
                access_key_id = credentials.get('AccessKeyId', None)
                access_key_secret = credentials.get('AccessKeySecret', None)
                session_token = credentials.get('SecurityToken', None)
            else:
                credentialsClient = CredClient()
                access_key_id = credentialsClient.get_credential().access_key_id
                access_key_secret = credentialsClient.get_credential().access_key_secret
                session_token = credentialsClient.get_credential().security_token
    
            self._credentials = Credentials(
                access_key_id, access_key_secret, session_token)
    
        def get_credentials(self) -> Credentials:
            return self._credentials
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions listing buckets in a specified region but doesn't disclose behavioral traits like pagination, rate limits, authentication requirements, error conditions, or what 'all' means (e.g., whether it includes hidden or system buckets). For a read operation with no annotation coverage, this is a significant gap.

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 in Chinese that directly states the tool's purpose without unnecessary words. It is appropriately sized and front-loaded with the core action.

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?

Given the tool's moderate complexity (listing resources with filtering), no annotations, and no output schema, the description is minimally adequate. It covers the basic purpose but lacks details on behavior, output format, or usage context. It meets the minimum viable threshold but has clear gaps in completeness.

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?

Schema description coverage is 100%, so the schema already documents both parameters (Prefix and RegionId) with descriptions. The description adds no additional meaning beyond implying regional filtering, which is already covered by the RegionId parameter in the schema. Baseline 3 is appropriate when the schema does the heavy lifting.

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 ('列出' - list) and resource ('OSS存储空间' - OSS buckets) with geographic scope ('指定区域' - specified region). It distinguishes from sibling tools like ListObjects (which lists objects within buckets) but doesn't explicitly differentiate from other list-like tools like DescribeInstances or DescribeRegions.

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 prerequisites, when not to use it, or compare it to similar tools like DescribeRegions (which might list regions rather than buckets). The context is implied but not explicit.

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