get_image
Retrieve detailed information about Oracle Cloud Infrastructure compute images, including launch options and operating system specifications, by providing the image OCID.
Instructions
Get detailed information about a specific compute image.
Args:
image_id: OCID of the image to retrieve
Returns:
Detailed image information including launch options and OS details
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| image_id | Yes |
Implementation Reference
- Core handler function that executes the OCI Compute API call to retrieve image details and formats the response dictionary.def get_image(compute_client: oci.core.ComputeClient, image_id: str) -> Dict[str, Any]: """ Get details of a specific image. Args: compute_client: OCI Compute client image_id: OCID of the image Returns: Details of the image """ try: image = compute_client.get_image(image_id).data image_details = { "id": image.id, "display_name": image.display_name, "compartment_id": image.compartment_id, "operating_system": image.operating_system, "operating_system_version": image.operating_system_version, "lifecycle_state": image.lifecycle_state, "time_created": str(image.time_created), "size_in_mbs": image.size_in_mbs, "base_image_id": image.base_image_id, "create_image_allowed": image.create_image_allowed, "listing_type": image.listing_type, "launch_mode": image.launch_mode, "launch_options": { "boot_volume_type": image.launch_options.boot_volume_type if image.launch_options else None, "firmware": image.launch_options.firmware if image.launch_options else None, "network_type": image.launch_options.network_type if image.launch_options else None, "remote_data_volume_type": image.launch_options.remote_data_volume_type if image.launch_options else None, "is_pv_encryption_in_transit_enabled": image.launch_options.is_pv_encryption_in_transit_enabled if image.launch_options else None, "is_consistent_volume_naming_enabled": image.launch_options.is_consistent_volume_naming_enabled if image.launch_options else None, } if image.launch_options else None, } logger.info(f"Retrieved details for image {image_id}") return image_details except Exception as e: logger.exception(f"Error getting image details: {e}") raise
- mcp_server_oci/mcp_server.py:1340-1357 (registration)MCP tool registration using @mcp.tool(name="get_image") and wrapper function that provides the MCP Context, injects the OCI compute client, and handles logging/errors.@mcp.tool(name="get_image") @mcp_tool_wrapper( start_msg="Getting image details for {image_id}...", success_msg="Retrieved image details successfully", error_prefix="Error getting image details" ) async def mcp_get_image(ctx: Context, image_id: str) -> Dict[str, Any]: """ Get detailed information about a specific compute image. Args: image_id: OCID of the image to retrieve Returns: Detailed image information including launch options and OS details """ return get_image(oci_clients["compute"], image_id)