get_bucket
Retrieve detailed information about an Oracle Cloud Infrastructure Object Storage bucket, including public access settings and versioning configuration.
Instructions
Get detailed information about a specific Object Storage bucket.
Args:
bucket_name: Name of the bucket
namespace: Optional namespace (if not provided, will be fetched automatically)
Returns:
Detailed bucket information including public access settings and versioning
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bucket_name | Yes | ||
| namespace | No |
Implementation Reference
- mcp_server_oci/mcp_server.py:838-861 (handler)MCP tool handler 'mcp_get_bucket' registered with @mcp.tool(name="get_bucket"). Fetches namespace if missing and delegates to core get_bucket helper with OCI client.@mcp.tool(name="get_bucket") @mcp_tool_wrapper( start_msg="Getting bucket details for {bucket_name}...", success_msg="Retrieved bucket details successfully", error_prefix="Error getting bucket details" ) async def mcp_get_bucket(ctx: Context, bucket_name: str, namespace: Optional[str] = None) -> Dict[str, Any]: """ Get detailed information about a specific Object Storage bucket. Args: bucket_name: Name of the bucket namespace: Optional namespace (if not provided, will be fetched automatically) Returns: Detailed bucket information including public access settings and versioning """ # Get namespace if not provided if not namespace: namespace_info = get_namespace(oci_clients["object_storage"]) namespace = namespace_info.get("namespace") return get_bucket(oci_clients["object_storage"], namespace, bucket_name)
- Core helper function 'get_bucket' that executes the OCI API call to retrieve bucket details and formats the response as a dictionary.def get_bucket(object_storage_client: oci.object_storage.ObjectStorageClient, namespace_name: str, bucket_name: str) -> Dict[str, Any]: """ Get details of a specific bucket. Args: object_storage_client: OCI ObjectStorage client namespace_name: Object Storage namespace name bucket_name: Name of the bucket Returns: Details of the bucket """ try: bucket = object_storage_client.get_bucket(namespace_name, bucket_name).data bucket_details = { "name": bucket.name, "namespace": bucket.namespace, "compartment_id": bucket.compartment_id, "created_by": bucket.created_by, "time_created": str(bucket.time_created), "etag": bucket.etag, "public_access_type": bucket.public_access_type, "storage_tier": bucket.storage_tier, "object_events_enabled": bucket.object_events_enabled, "versioning": bucket.versioning, "replication_enabled": bucket.replication_enabled, "is_read_only": bucket.is_read_only, "object_lifecycle_policy_etag": bucket.object_lifecycle_policy_etag, } logger.info(f"Retrieved details for bucket {bucket_name}") return bucket_details except Exception as e: logger.exception(f"Error getting bucket details: {e}") raise
- mcp_server_oci/mcp_server.py:52-61 (registration)Import statement registering the get_bucket helper function from storage.py for use in the MCP tool wrappers.from mcp_server_oci.tools.storage import ( list_buckets, get_bucket, list_volumes, get_volume, list_boot_volumes, get_boot_volume, list_file_systems, get_file_system, )