Skip to main content
Glama

get_instance

Retrieve configuration and status details for Oracle Cloud Infrastructure compute instances to monitor resources and manage deployments.

Instructions

Get details of a specific instance.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
instance_idYes

Implementation Reference

  • MCP tool handler for 'get_instance': async wrapper that calls the core get_instance function with OCI compute client, includes logging and error handling via mcp_tool_wrapper.
    @mcp.tool(name="get_instance")
    @mcp_tool_wrapper(
        start_msg="Getting details for instance {instance_id}...",
        success_msg="Retrieved instance details successfully",
        error_prefix="Error getting instance details"
    )
    async def get_instance_details(ctx: Context, instance_id: str) -> Dict[str, Any]:
        """Get details of a specific instance."""
        return get_instance(oci_clients["compute"], instance_id)
  • Core helper function implementing the OCI API calls to retrieve instance details including VNIC attachments and shape configuration.
    def get_instance(compute_client: oci.core.ComputeClient, instance_id: str) -> Dict[str, Any]:
        """
        Get details of a specific instance.
        
        Args:
            compute_client: OCI Compute client
            instance_id: OCID of the instance
            
        Returns:
            Details of the instance
        """
        try:
            # Get the instance details
            instance = compute_client.get_instance(instance_id).data
            
            # Get VNIC attachments for the instance
            vnic_attachments = oci.pagination.list_call_get_all_results(
                compute_client.list_vnic_attachments,
                instance.compartment_id,
                instance_id=instance_id
            ).data
            
            # Format the instance details
            instance_details = {
                "id": instance.id,
                "name": instance.display_name,
                "lifecycle_state": instance.lifecycle_state,
                "shape": instance.shape,
                "time_created": str(instance.time_created),
                "availability_domain": instance.availability_domain,
                "compartment_id": instance.compartment_id,
                "fault_domain": instance.fault_domain,
                "is_running": instance.lifecycle_state == "RUNNING",
                "metadata": instance.metadata,
                "vnic_attachments": [
                    {
                        "id": vnic.id,
                        "display_name": vnic.display_name,
                        "lifecycle_state": vnic.lifecycle_state,
                        "vnic_id": vnic.vnic_id,
                    }
                    for vnic in vnic_attachments
                ],
            }
            
            # Include shape config if available
            if instance.shape_config:
                instance_details.update({
                    "ocpu_count": instance.shape_config.ocpus if hasattr(instance.shape_config, "ocpus") else None,
                    "memory_in_gbs": instance.shape_config.memory_in_gbs if hasattr(instance.shape_config, "memory_in_gbs") else None,
                    "processors": instance.shape_config.processors if hasattr(instance.shape_config, "processors") else None,
                })
            
            logger.info(f"Retrieved details for instance {instance_id}")
            return instance_details
            
        except Exception as e:
            logger.exception(f"Error getting instance details: {e}")
            raise
  • Import of the get_instance helper function from instances.py, required for the MCP tool handler.
    from mcp_server_oci.tools.compartments import list_compartments
    from mcp_server_oci.tools.instances import (
        list_instances,
        get_instance,
        start_instance,
        stop_instance,
    )
Behavior1/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 fails to describe any behavioral traits: it doesn't indicate if this is a read-only operation, what permissions are required, whether it's idempotent, how errors are handled, or what the output format looks like. For a tool that retrieves data with no annotation coverage, this leaves critical gaps in understanding how the tool behaves.

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 extremely concise at one sentence with no wasted words. It's front-loaded with the core action ('Get details'), though this brevity comes at the cost of completeness. Every word serves a purpose, even if that purpose is minimal, making it structurally efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (a data retrieval tool with no annotations, no output schema, and 0% schema description coverage), the description is severely incomplete. It doesn't explain what 'instance' refers to in this system, what details are returned, error conditions, or how it fits with sibling tools. For a tool that likely returns structured data about a resource, this minimal description is inadequate for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 1 parameter with 0% description coverage, so the schema provides no semantic context. The description adds no information about the 'instance_id' parameter—it doesn't explain what an instance ID is, where to find it, its format, or validation rules. While the parameter count is low (1), the description fails to compensate for the complete lack of schema documentation, leaving the parameter meaning unclear.

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

Purpose2/5

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

The description 'Get details of a specific instance' is a tautology that restates the tool name 'get_instance' without adding meaningful specificity. It doesn't distinguish this from sibling tools like 'get_vcn' or 'get_subnet' which follow the same pattern, nor does it clarify what type of instance (e.g., compute instance, database instance) or what details are included. The verb 'get' is generic, and 'instance' is ambiguous in this context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/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 prerequisites, distinguish it from similar tools like 'list_instances' (which likely lists multiple instances), or specify contexts where fetching details for a single instance is appropriate. Without any usage context, the agent must infer everything from the tool name alone.

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