Skip to main content
Glama

list_boot_volumes

Retrieve boot volumes in an Oracle Cloud Infrastructure compartment to manage storage resources, view size and state details, and identify source images for compute instances.

Instructions

List all boot volumes in a compartment. Args: compartment_id: OCID of the compartment to list boot volumes from availability_domain: Optional AD to filter boot volumes Returns: List of boot volumes with their size, state, and source image information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
compartment_idYes
availability_domainNo

Implementation Reference

  • Core handler function implementing the tool logic: lists boot volumes using OCI SDK, handles pagination with oci.pagination.list_call_get_all_results, extracts and formats relevant fields from boot volume objects.
    def list_boot_volumes(block_storage_client: oci.core.BlockstorageClient, availability_domain: str, compartment_id: str) -> List[Dict[str, Any]]: """ List all boot volumes in a compartment and availability domain. Args: block_storage_client: OCI BlockStorage client availability_domain: Availability domain name compartment_id: OCID of the compartment Returns: List of boot volumes with their details """ try: boot_volumes_response = oci.pagination.list_call_get_all_results( block_storage_client.list_boot_volumes, availability_domain, compartment_id ) boot_volumes = [] for boot_volume in boot_volumes_response.data: boot_volumes.append({ "id": boot_volume.id, "display_name": boot_volume.display_name, "compartment_id": boot_volume.compartment_id, "availability_domain": boot_volume.availability_domain, "size_in_mbs": boot_volume.size_in_mbs, "size_in_gbs": boot_volume.size_in_gbs, "lifecycle_state": boot_volume.lifecycle_state, "time_created": str(boot_volume.time_created), "is_hydrated": boot_volume.is_hydrated, "vpus_per_gb": boot_volume.vpus_per_gb, "is_auto_tune_enabled": boot_volume.is_auto_tune_enabled, "auto_tuned_vpus_per_gb": boot_volume.auto_tuned_vpus_per_gb, }) logger.info(f"Found {len(boot_volumes)} boot volumes in compartment {compartment_id}") return boot_volumes except Exception as e: logger.exception(f"Error listing boot volumes: {e}") raise
  • Registers the 'list_boot_volumes' tool with MCP using @mcp.tool decorator. Wraps the core handler with mcp_tool_wrapper for logging, error handling, and OCI client access. Defines input parameters and docstring for schema inference. Note: argument order swapped compared to core handler (compartment_id before availability_domain).
    @mcp.tool(name="list_boot_volumes") @mcp_tool_wrapper( start_msg="Listing boot volumes in compartment {compartment_id}...", error_prefix="Error listing boot volumes" ) async def mcp_list_boot_volumes(ctx: Context, compartment_id: str, availability_domain: Optional[str] = None) -> List[Dict[str, Any]]: """ List all boot volumes in a compartment. Args: compartment_id: OCID of the compartment to list boot volumes from availability_domain: Optional AD to filter boot volumes Returns: List of boot volumes with their size, state, and source image information """ return list_boot_volumes(oci_clients["block_storage"], compartment_id, availability_domain)

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