Skip to main content
Glama
RadiumGu

Alibaba Cloud Operations MCP Server

by RadiumGu

list_oss_buckets

Retrieve a list of OSS storage buckets in a specified Alibaba Cloud region to manage cloud storage resources.

Instructions

列出OSS存储桶

Args:
    region: 区域ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
regionNocn-beijing

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • FastMCP @app.tool() handler for list_oss_buckets that invokes oss_tools and formats output.
    def list_oss_buckets(region: str = "cn-beijing") -> str:
        """列出OSS存储桶
        
        Args:
            region: 区域ID
        """
        try:
            sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'alibaba_cloud_ops_mcp_server'))
            from tools import oss_tools
            
            # 使用修复后的OSS工具
            list_buckets_func = oss_tools.tools[0]  # OSS_ListBuckets
            result = list_buckets_func(RegionId=region)
            
            if isinstance(result, list) and result:
                output = f"阿里云 {region} region的OSS存储桶列表:\\n"
                output += "=" * 50 + "\\n"
                
                for i, bucket in enumerate(result, 1):
                    if isinstance(bucket, dict):
                        output += f"{i}. 存储桶名称: {bucket.get('name', '未知')}\\n"
                        output += f"   创建时间: {bucket.get('creation_date', '未知')}\\n"
                        output += f"   位置: {bucket.get('location', '未知')}\\n"
                        output += f"   存储类型: {bucket.get('storage_class', '未知')}\\n"
                        output += f"   外网端点: {bucket.get('extranet_endpoint', '未知')}\\n"
                        output += "-" * 30 + "\\n"
                return output
            else:
                return f"在 {region} region没有找到OSS存储桶"
                        
        except Exception as e:
            return f"OSS查询失败: {str(e)}"
  • Fallback async handler for the list_oss_buckets tool in QCLI-compatible server, dynamically finds and calls OSS listing function from oss_tools.
    async def _list_oss_buckets_handler(self, region: str = "cn-beijing"):
        """Fallback OSS bucket listing handler"""
        try:
            # Try to import and use the actual OSS tools
            from alibaba_cloud_ops_mcp_server.tools import oss_tools
            
            # Look for list_buckets function
            for tool_func in oss_tools.tools:
                if 'bucket' in tool_func.__name__.lower() and 'list' in tool_func.__name__.lower():
                    result = await asyncio.wait_for(tool_func(region=region), timeout=30.0)
                    return result
                    
            # If no specific function found, return a helpful message
            return f"OSS bucket listing functionality is available but requires proper configuration for region: {region}"
            
        except ImportError:
            return f"OSS tools not available. Please ensure Alibaba Cloud credentials are configured for region: {region}"
        except Exception as e:
            return f"Error listing OSS buckets in {region}: {str(e)}"
  • Registration of list_oss_buckets tool including name, description, input schema, and handler reference in QCLI server.
    "list_oss_buckets": {
        "name": "list_oss_buckets",
        "description": "List OSS buckets in specified region",
        "inputSchema": {
            "type": "object",
            "properties": {
                "region": {
                    "type": "string",
                    "description": "Region name (e.g., cn-beijing)"
                }
            },
            "required": []
        },
        "handler": self._list_oss_buckets_handler
    }
  • Input schema definition for list_oss_buckets tool.
    "inputSchema": {
        "type": "object",
        "properties": {
            "region": {
                "type": "string",
                "description": "Region name (e.g., cn-beijing)"
            }
        },
        "required": []
    },
  • Core helper function OSS_ListBuckets that implements the actual OSS buckets listing using alibabacloud_oss_v2 library, used by the MCP handlers.
    @tools.append
    def OSS_ListBuckets(
        RegionId: str = 'cn-hangzhou',
        Prefix: str = None
    ):
        """列出指定区域的所有OSS存储空间。"""
        try:
            client = create_client(region_id=RegionId)
            paginator = client.list_buckets_paginator()
            results = []
            
            # 修复:只有在Prefix不为None时才传递prefix参数
            if Prefix is not None:
                request = oss.ListBucketsRequest(prefix=Prefix)
            else:
                request = oss.ListBucketsRequest()
                
            for page in paginator.iter_page(request):
                for bucket in page.buckets:
                    # 返回格式化的存储桶信息
                    bucket_info = {
                        'name': bucket.name,
                        'creation_date': str(bucket.creation_date) if bucket.creation_date else None,
                        'location': bucket.location,
                        'storage_class': bucket.storage_class,
                        'extranet_endpoint': bucket.extranet_endpoint,
                        'intranet_endpoint': bucket.intranet_endpoint
                    }
                    results.append(bucket_info)
            
            return results
        except Exception as e:
            return f"查询OSS存储桶失败: {str(e)}"
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. It states the tool lists OSS buckets but doesn't disclose behavioral traits like whether it requires authentication, returns all buckets or paginated results, error conditions, or rate limits. This is a significant gap for a tool with no annotation coverage.

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

Conciseness3/5

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

The description is brief but lacks front-loading of critical information. It starts with the purpose, then lists parameters in a separate section, which is structured but could be more efficient. The two-sentence format is concise but under-specified, not earning full marks for conciseness.

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 one parameter with 0% schema coverage and an output schema exists, the description is minimally complete. It covers the purpose and parameter basics but lacks behavioral details and usage guidelines. The output schema reduces the need to explain return values, but overall completeness is adequate with clear gaps.

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 0%, so the description must compensate. It adds the parameter 'region' with a brief explanation ('区域ID' meaning 'region ID'), which provides basic semantics beyond the schema's title 'Region'. However, it doesn't explain format, constraints, or default values, leaving gaps in parameter understanding.

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 tool's purpose with a specific verb ('列出' meaning 'list') and resource ('OSS存储桶' meaning 'OSS buckets'). It distinguishes itself from siblings like create_oss_bucket and delete_oss_bucket by focusing on listing rather than creating or deleting. However, it doesn't specify scope (e.g., all buckets vs. filtered) which prevents a perfect score.

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, context for listing buckets, or differentiate from other listing tools (though none exist among siblings). Usage is implied by the name but not explicitly stated.

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/RadiumGu/alicloud-ops-mcp'

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