Skip to main content
Glama

list_buckets

Retrieve all Object Storage buckets in a specified OCI compartment to manage storage resources and configurations.

Instructions

List all Object Storage buckets in a compartment.

Args:
    compartment_id: OCID of the compartment to list buckets from
    namespace: Optional namespace (if not provided, will be fetched automatically)

Returns:
    List of buckets with their configurations and metadata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
compartment_idYes
namespaceNo

Implementation Reference

  • MCP tool handler for 'list_buckets': registers the tool, wraps with error handling/logging, fetches namespace if missing, and delegates to core helper.
    @mcp.tool(name="list_buckets")
    @mcp_tool_wrapper(
        start_msg="Listing Object Storage buckets in compartment {compartment_id}...",
        error_prefix="Error listing buckets"
    )
    async def mcp_list_buckets(ctx: Context, compartment_id: str, namespace: Optional[str] = None) -> List[Dict[str, Any]]:
        """
        List all Object Storage buckets in a compartment.
    
        Args:
            compartment_id: OCID of the compartment to list buckets from
            namespace: Optional namespace (if not provided, will be fetched automatically)
    
        Returns:
            List of buckets with their configurations and metadata
        """
        # Get namespace if not provided
        if not namespace:
            namespace_info = get_namespace(oci_clients["object_storage"])
            namespace = namespace_info.get("namespace")
    
        return list_buckets(oci_clients["object_storage"], namespace, compartment_id)
  • Core helper function implementing the OCI Object Storage bucket listing logic using pagination and formatting bucket details.
    def list_buckets(object_storage_client: oci.object_storage.ObjectStorageClient, 
                     compartment_id: str, namespace_name: str) -> List[Dict[str, Any]]:
        """
        List all buckets in a compartment.
        
        Args:
            object_storage_client: OCI ObjectStorage client
            compartment_id: OCID of the compartment
            namespace_name: Object Storage namespace name
            
        Returns:
            List of buckets with their details
        """
        try:
            buckets_response = oci.pagination.list_call_get_all_results(
                object_storage_client.list_buckets,
                namespace_name,
                compartment_id
            )
            
            buckets = []
            for bucket in buckets_response.data:
                buckets.append({
                    "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,
                })
            
            logger.info(f"Found {len(buckets)} buckets in compartment {compartment_id}")
            return buckets
            
        except Exception as e:
            logger.exception(f"Error listing buckets: {e}")
            raise
  • Tool registration decorator specifying the tool name 'list_buckets' for MCP server.
    @mcp.tool(name="list_buckets")
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 the action ('List') and return type ('List of buckets'), but doesn't disclose behavioral traits like pagination, rate limits, permissions required, or error handling. For a read operation with no annotations, this leaves significant gaps in understanding how the tool behaves.

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 well-structured and front-loaded with the core purpose in the first sentence. The 'Args' and 'Returns' sections are clear and efficient, with no redundant information. Every sentence adds value, making it appropriately sized and easy to parse.

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 no annotations and no output schema, the description provides basic purpose and parameter semantics but lacks details on behavioral aspects (e.g., pagination, errors) and return format specifics. For a simple list tool, it's minimally adequate but incomplete for robust agent use without additional context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/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 meaning by explaining 'compartment_id' as 'OCID of the compartment to list buckets from' and 'namespace' as 'Optional namespace (if not provided, will be fetched automatically)', clarifying purpose and default behavior beyond the schema's basic types. This covers both parameters effectively, though not exhaustively.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('List') and resource ('Object Storage buckets in a compartment'), specifying scope with 'all'. It distinguishes from sibling tools like 'get_bucket' (singular retrieval) and 'list_compartments' (different resource), making the purpose specific and differentiated.

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?

No guidance is provided on when to use this tool versus alternatives. While it implicitly suggests use for listing buckets, it doesn't mention prerequisites (e.g., authentication), exclusions, or compare to other list tools (e.g., 'list_vaults' for different resources). The description lacks explicit usage context or alternatives.

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/jopsis/mcp-server-oci'

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