tos_create_bucket
Create a storage bucket in Volcengine TOS with specified name and access control permissions for object storage management.
Instructions
创建 TOS 存储桶
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| acl | No | 访问控制权限 | private |
| bucket_name | Yes | 存储桶名称 |
Implementation Reference
- src/tos_mcp_server/handlers.py:26-37 (handler)The handler function for tos_create_bucket that extracts bucket_name and acl from arguments and calls tos_client.create_bucket with appropriate ACL.async def create_bucket(args: Dict[str, Any]) -> List[TextContent]: """创建存储桶""" bucket_name = args["bucket_name"] acl = args.get("acl", "private") try: tos_client.create_bucket(bucket_name, tos.ACLType.ACL_Private if acl == "private" else tos.ACLType.ACL_Public_Read if acl == "public-read" else tos.ACLType.ACL_Public_Read_Write) return [TextContent(type="text", text=f"成功创建存储桶: {bucket_name}")] except Exception as e: return [TextContent(type="text", text=f"创建存储桶失败: {str(e)}")]
- src/tos_mcp_server/server.py:36-51 (schema)Input schema definition for the tos_create_bucket tool, specifying properties for bucket_name (required) and acl (optional with enum).inputSchema={ "type": "object", "properties": { "bucket_name": { "type": "string", "description": "存储桶名称" }, "acl": { "type": "string", "description": "访问控制权限", "enum": ["private", "public-read", "public-read-write"], "default": "private" } }, "required": ["bucket_name"] }
- src/tos_mcp_server/server.py:33-52 (registration)Tool registration in list_tools() function, defining the tos_create_bucket tool's name, description, and schema.Tool( name="tos_create_bucket", description="创建 TOS 存储桶", inputSchema={ "type": "object", "properties": { "bucket_name": { "type": "string", "description": "存储桶名称" }, "acl": { "type": "string", "description": "访问控制权限", "enum": ["private", "public-read", "public-read-write"], "default": "private" } }, "required": ["bucket_name"] } ),
- src/tos_mcp_server/server.py:337-338 (registration)Dispatch logic in call_tool() that routes tos_create_bucket calls to the create_bucket handler.if name == "tos_create_bucket": return await create_bucket(arguments)