tos_get_bucket_meta
Retrieve metadata for a specified TOS storage bucket to access configuration details and properties through the TOS MCP Server.
Instructions
获取存储桶元数据
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bucket_name | Yes | 存储桶名称 |
Implementation Reference
- src/tos_mcp_server/handlers.py:54-68 (handler)The handler function that executes the tos_get_bucket_meta tool logic: extracts bucket_name, calls tos_client.head_bucket, formats metadata as JSON, handles errors.async def get_bucket_meta(args: Dict[str, Any]) -> List[TextContent]: """获取存储桶元数据""" bucket_name = args["bucket_name"] try: resp = tos_client.head_bucket(bucket_name) meta = { "bucket_name": bucket_name, "region": resp.region, "storage_class": str(resp.storage_class) if resp.storage_class else None } return [TextContent(type="text", text=json.dumps(meta, indent=2, ensure_ascii=False))] except Exception as e: return [TextContent(type="text", text=f"获取存储桶元数据失败: {str(e)}")]
- src/tos_mcp_server/server.py:61-74 (schema)The tool schema definition including inputSchema for bucket_name (required string).Tool( name="tos_get_bucket_meta", description="获取存储桶元数据", inputSchema={ "type": "object", "properties": { "bucket_name": { "type": "string", "description": "存储桶名称" } }, "required": ["bucket_name"] } ),
- src/tos_mcp_server/server.py:341-342 (registration)Tool dispatch registration in the call_tool handler, mapping 'tos_get_bucket_meta' to the get_bucket_meta function.elif name == "tos_get_bucket_meta": return await get_bucket_meta(arguments)
- src/tos_mcp_server/server.py:61-74 (registration)Tool registration in list_tools(), defining name, description, and schema.Tool( name="tos_get_bucket_meta", description="获取存储桶元数据", inputSchema={ "type": "object", "properties": { "bucket_name": { "type": "string", "description": "存储桶名称" } }, "required": ["bucket_name"] } ),