Skip to main content
Glama

list_shapes

Retrieve available compute shapes with CPU, memory, network, and GPU specifications for an Oracle Cloud Infrastructure compartment to support resource selection.

Instructions

List all compute shapes available in a compartment.

Args:
    compartment_id: OCID of the compartment

Returns:
    List of shapes with CPU, memory, network, and GPU specifications

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
compartment_idYes

Implementation Reference

  • MCP tool handler for 'list_shapes'. This async function is decorated with @mcp.tool(name='list_shapes') and calls the underlying list_shapes helper with the compute client and compartment_id.
    @mcp.tool(name="list_shapes")
    @mcp_tool_wrapper(
        start_msg="Listing compute shapes in compartment {compartment_id}...",
        error_prefix="Error listing shapes"
    )
    async def mcp_list_shapes(ctx: Context, compartment_id: str) -> List[Dict[str, Any]]:
        """
        List all compute shapes available in a compartment.
    
        Args:
            compartment_id: OCID of the compartment
    
        Returns:
            List of shapes with CPU, memory, network, and GPU specifications
        """
        return list_shapes(oci_clients["compute"], compartment_id)
  • Core helper function that implements the OCI API call to list shapes, formats the response into a list of dictionaries with detailed shape specifications, and handles errors.
    def list_shapes(compute_client: oci.core.ComputeClient, compartment_id: str) -> List[Dict[str, Any]]:
        """
        List all shapes available in a compartment.
        
        Args:
            compute_client: OCI Compute client
            compartment_id: OCID of the compartment
            
        Returns:
            List of shapes with their details
        """
        try:
            shapes_response = oci.pagination.list_call_get_all_results(
                compute_client.list_shapes,
                compartment_id
            )
            
            shapes = []
            for shape in shapes_response.data:
                shapes.append({
                    "shape": shape.shape,
                    "processor_description": shape.processor_description,
                    "ocpus": shape.ocpus,
                    "memory_in_gbs": shape.memory_in_gbs,
                    "networking_bandwidth_in_gbps": shape.networking_bandwidth_in_gbps,
                    "max_vnic_attachments": shape.max_vnic_attachments,
                    "gpus": shape.gpus,
                    "gpu_description": shape.gpu_description,
                    "local_disks": shape.local_disks,
                    "local_disks_total_size_in_gbs": shape.local_disks_total_size_in_gbs,
                    "local_disk_description": shape.local_disk_description,
                    "rdma_ports": shape.rdma_ports,
                    "rdma_bandwidth_in_gbps": shape.rdma_bandwidth_in_gbps,
                    "is_live_migration_supported": shape.is_live_migration_supported,
                    "ocpu_options": {
                        "min": shape.ocpu_options.min if shape.ocpu_options else None,
                        "max": shape.ocpu_options.max if shape.ocpu_options else None,
                    } if shape.ocpu_options else None,
                    "memory_options": {
                        "min_in_g_bs": shape.memory_options.min_in_g_bs if shape.memory_options else None,
                        "max_in_g_bs": shape.memory_options.max_in_g_bs if shape.memory_options else None,
                        "default_per_ocpu_in_g_bs": shape.memory_options.default_per_ocpu_in_g_bs if shape.memory_options else None,
                        "min_per_ocpu_in_g_bs": shape.memory_options.min_per_ocpu_in_g_bs if shape.memory_options else None,
                        "max_per_ocpu_in_g_bs": shape.memory_options.max_per_ocpu_in_g_bs if shape.memory_options else None,
                    } if shape.memory_options else None,
                    "networking_bandwidth_options": {
                        "min_in_gbps": shape.networking_bandwidth_options.min_in_gbps if shape.networking_bandwidth_options else None,
                        "max_in_gbps": shape.networking_bandwidth_options.max_in_gbps if shape.networking_bandwidth_options else None,
                        "default_per_ocpu_in_gbps": shape.networking_bandwidth_options.default_per_ocpu_in_gbps if shape.networking_bandwidth_options else None,
                    } if shape.networking_bandwidth_options else None,
                })
            
            logger.info(f"Found {len(shapes)} shapes in compartment {compartment_id}")
            return shapes
            
        except Exception as e:
            logger.exception(f"Error listing shapes: {e}")
            raise
  • MCP tool registration decorator specifying the tool name as 'list_shapes'.
    @mcp.tool(name="list_shapes")
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the return format (list with specifications) but lacks critical details like whether this is a read-only operation, if it requires specific permissions, rate limits, pagination behavior, or error conditions. For a tool with zero annotation coverage, this is insufficient.

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 efficiently structured with a clear purpose statement followed by separate 'Args' and 'Returns' sections. Every sentence adds value without redundancy, making it easy to parse and understand quickly.

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?

For a simple list tool with one parameter and no output schema, the description covers the basics (purpose, parameter, return format) adequately. However, without annotations or output schema, it misses behavioral context like safety, permissions, or detailed output structure, leaving some gaps for the agent.

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?

The description explicitly documents the single parameter ('compartment_id') and its purpose ('OCID of the compartment'), adding meaningful context beyond the schema's minimal coverage (0%). Since there's only one parameter and it's fully explained in the description, this compensates well for the schema gap.

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 action ('List all compute shapes') and resource ('available in a compartment'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'list_instances' or 'list_images' beyond the specific resource type, which is why it doesn't reach a perfect score.

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. The description doesn't mention prerequisites, context for selecting shapes, or how it relates to other tools like 'get_instance' or 'list_instances' that might involve shape selection, leaving the agent without usage direction.

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