Skip to main content
Glama

list_images

Retrieve all compute images within a specified Oracle Cloud Infrastructure compartment, displaying OS details, version, size, and lifecycle state for resource management.

Instructions

List all compute images in a compartment.

Args:
    compartment_id: OCID of the compartment to list images from

Returns:
    List of images with OS, version, size, and lifecycle state

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
compartment_idYes

Implementation Reference

  • Core handler function that queries OCI Compute API for images in a compartment, formats the response into a list of dictionaries with relevant image details.
    def list_images(compute_client: oci.core.ComputeClient, compartment_id: str) -> List[Dict[str, Any]]:
        """
        List all images in a compartment.
        
        Args:
            compute_client: OCI Compute client
            compartment_id: OCID of the compartment
            
        Returns:
            List of images with their details
        """
        try:
            images_response = oci.pagination.list_call_get_all_results(
                compute_client.list_images,
                compartment_id
            )
            
            images = []
            for image in images_response.data:
                images.append({
                    "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,
                })
            
            logger.info(f"Found {len(images)} images in compartment {compartment_id}")
            return images
            
        except Exception as e:
            logger.exception(f"Error listing images: {e}")
            raise
  • MCP tool registration using @mcp.tool decorator. This wrapper function handles MCP context, logging, error handling via mcp_tool_wrapper, and delegates to the core list_images handler.
    @mcp.tool(name="list_images")
    @mcp_tool_wrapper(
        start_msg="Listing compute images in compartment {compartment_id}...",
        error_prefix="Error listing images"
    )
    async def mcp_list_images(ctx: Context, compartment_id: str) -> List[Dict[str, Any]]:
        """
        List all compute images in a compartment.
    
        Args:
            compartment_id: OCID of the compartment to list images from
    
        Returns:
            List of images with OS, version, size, and lifecycle state
        """
        return list_images(oci_clients["compute"], compartment_id)
  • Import statement that brings the list_images handler function into scope for use in the MCP server registration.
    from mcp_server_oci.tools.resources import (
        list_availability_domains,
        list_fault_domains,
        list_images,
        get_image,
        list_shapes,
        get_namespace,
        list_regions,
        get_tenancy_info,
    )
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('List') and return format, but lacks details on permissions, rate limits, pagination, or error handling. For a read operation with no annotation coverage, this is insufficient to inform the agent fully about behavioral traits.

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 front-loaded with the core purpose, followed by structured sections for Args and Returns. Every sentence earns its place: the first states the action, and the others provide essential parameter and output details without redundancy. It's appropriately sized for a simple tool.

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 the tool's low complexity (one parameter, no output schema, no annotations), the description is minimally complete. It covers the basic purpose, parameter, and return format, but lacks behavioral context and usage guidelines. Without annotations or output schema, it should do more to compensate, but it's adequate for a simple list operation.

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 images from,' which clarifies the parameter's purpose beyond the schema's title 'Compartment Id.' However, it doesn't cover all potential nuances (e.g., format or validation), but with only one parameter, this is adequate for a baseline near 4.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'List all compute images in a compartment.' It specifies the verb ('List') and resource ('compute images'), and while it doesn't explicitly differentiate from siblings like 'get_image', the scope ('all' in a compartment) implies a listing operation versus a single retrieval. However, it doesn't directly compare to sibling tools, so it's not a 5.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'get_image' (for retrieving a single image) or other listing tools, nor does it specify prerequisites or exclusions. The agent must infer usage from context alone, which is minimal.

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