list_file_systems
Retrieve all File Storage file systems in a specified Oracle Cloud Infrastructure compartment and availability domain to view their state and metadata.
Instructions
List all File Storage file systems in a compartment and availability domain.
Args:
compartment_id: OCID of the compartment to list file systems from
availability_domain: Name of the availability domain
Returns:
List of file systems with their state and metadata
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| compartment_id | Yes | ||
| availability_domain | Yes |
Implementation Reference
- mcp_server_oci/tools/storage.py:265-306 (handler)The core handler function that implements the logic to list OCI File Storage file systems in a compartment and availability domain using the OCI SDK's FileStorageClient with pagination support.def list_file_systems(file_storage_client: oci.file_storage.FileStorageClient, compartment_id: str, availability_domain: str) -> List[Dict[str, Any]]: """ List all file systems in a compartment and availability domain. Args: file_storage_client: OCI FileStorage client compartment_id: OCID of the compartment availability_domain: Availability domain name Returns: List of file systems with their details """ try: file_systems_response = oci.pagination.list_call_get_all_results( file_storage_client.list_file_systems, compartment_id, availability_domain ) file_systems = [] for file_system in file_systems_response.data: file_systems.append({ "id": file_system.id, "display_name": file_system.display_name, "compartment_id": file_system.compartment_id, "availability_domain": file_system.availability_domain, "lifecycle_state": file_system.lifecycle_state, "time_created": str(file_system.time_created), "metered_bytes": file_system.metered_bytes, "is_clone_parent": file_system.is_clone_parent, "is_hydrated": file_system.is_hydrated, "lifecycle_details": file_system.lifecycle_details, "kms_key_id": file_system.kms_key_id, }) logger.info(f"Found {len(file_systems)} file systems in compartment {compartment_id}") return file_systems except Exception as e: logger.exception(f"Error listing file systems: {e}") raise
- mcp_server_oci/mcp_server.py:940-957 (registration)The MCP tool registration decorator @mcp.tool(name='list_file_systems') that defines the tool entrypoint, adds error handling wrapper, and delegates to the storage handler function.@mcp.tool(name="list_file_systems") @mcp_tool_wrapper( start_msg="Listing file systems in compartment {compartment_id}...", error_prefix="Error listing file systems" ) async def mcp_list_file_systems(ctx: Context, compartment_id: str, availability_domain: str) -> List[Dict[str, Any]]: """ List all File Storage file systems in a compartment and availability domain. Args: compartment_id: OCID of the compartment to list file systems from availability_domain: Name of the availability domain Returns: List of file systems with their state and metadata """ return list_file_systems(oci_clients["file_storage"], compartment_id, availability_domain)