Skip to main content
Glama

get_load_balancer

Retrieve detailed information about a specific Oracle Cloud Infrastructure classic load balancer, including backend sets, listeners, and certificates, by providing its OCID.

Instructions

Get detailed information about a specific classic load balancer.

Args:
    load_balancer_id: OCID of the load balancer to retrieve

Returns:
    Detailed load balancer information including backend sets, listeners, and certificates

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
load_balancer_idYes

Implementation Reference

  • The MCP tool handler function 'mcp_get_load_balancer' that executes the tool logic by calling the helper function with the OCI LoadBalancerClient and load_balancer_id.
    @mcp.tool(name="get_load_balancer")
    @mcp_tool_wrapper(
        start_msg="Getting load balancer details for {load_balancer_id}...",
        success_msg="Retrieved load balancer details successfully",
        error_prefix="Error getting load balancer details"
    )
    async def mcp_get_load_balancer(ctx: Context, load_balancer_id: str) -> Dict[str, Any]:
        """
        Get detailed information about a specific classic load balancer.
    
        Args:
            load_balancer_id: OCID of the load balancer to retrieve
    
        Returns:
            Detailed load balancer information including backend sets, listeners, and certificates
        """
        return get_load_balancer(oci_clients["load_balancer"], load_balancer_id)
  • Helper function that retrieves and formats detailed information about a specific OCI Load Balancer using the OCI SDK, including backend sets, listeners, and other configurations.
    def get_load_balancer(load_balancer_client: oci.load_balancer.LoadBalancerClient, 
                          load_balancer_id: str) -> Dict[str, Any]:
        """
        Get details of a specific load balancer.
        
        Args:
            load_balancer_client: OCI LoadBalancer client
            load_balancer_id: OCID of the load balancer
            
        Returns:
            Details of the load balancer
        """
        try:
            lb = load_balancer_client.get_load_balancer(load_balancer_id).data
            
            # Format backend sets
            backend_sets = {}
            if lb.backend_sets:
                for name, backend_set in lb.backend_sets.items():
                    backend_sets[name] = {
                        "name": name,
                        "policy": backend_set.policy,
                        "backends": [
                            {
                                "ip_address": backend.ip_address,
                                "port": backend.port,
                                "weight": backend.weight,
                                "drain": backend.drain,
                                "backup": backend.backup,
                                "offline": backend.offline,
                            }
                            for backend in backend_set.backends
                        ] if backend_set.backends else [],
                        "health_checker": {
                            "protocol": backend_set.health_checker.protocol,
                            "url_path": backend_set.health_checker.url_path,
                            "port": backend_set.health_checker.port,
                            "return_code": backend_set.health_checker.return_code,
                            "retries": backend_set.health_checker.retries,
                            "timeout_in_millis": backend_set.health_checker.timeout_in_millis,
                            "interval_in_millis": backend_set.health_checker.interval_in_millis,
                            "response_body_regex": backend_set.health_checker.response_body_regex,
                        } if backend_set.health_checker else None,
                    }
            
            # Format listeners
            listeners = {}
            if lb.listeners:
                for name, listener in lb.listeners.items():
                    listeners[name] = {
                        "name": name,
                        "default_backend_set_name": listener.default_backend_set_name,
                        "port": listener.port,
                        "protocol": listener.protocol,
                        "hostname_names": listener.hostname_names,
                        "path_route_set_name": listener.path_route_set_name,
                        "ssl_configuration": {
                            "certificate_name": listener.ssl_configuration.certificate_name if listener.ssl_configuration else None,
                            "verify_peer_certificate": listener.ssl_configuration.verify_peer_certificate if listener.ssl_configuration else None,
                            "verify_depth": listener.ssl_configuration.verify_depth if listener.ssl_configuration else None,
                        } if listener.ssl_configuration else None,
                        "connection_configuration": {
                            "idle_timeout": listener.connection_configuration.idle_timeout if listener.connection_configuration else None,
                            "backend_tcp_proxy_protocol_version": listener.connection_configuration.backend_tcp_proxy_protocol_version if listener.connection_configuration else None,
                        } if listener.connection_configuration else None,
                    }
            
            lb_details = {
                "id": lb.id,
                "display_name": lb.display_name,
                "compartment_id": lb.compartment_id,
                "lifecycle_state": lb.lifecycle_state,
                "time_created": str(lb.time_created),
                "shape_name": lb.shape_name,
                "is_private": lb.is_private,
                "ip_addresses": [
                    {
                        "ip_address": ip.ip_address,
                        "is_public": ip.is_public,
                    }
                    for ip in lb.ip_addresses
                ] if lb.ip_addresses else [],
                "subnet_ids": lb.subnet_ids,
                "network_security_group_ids": lb.network_security_group_ids,
                "backend_sets": backend_sets,
                "listeners": listeners,
                "certificates": dict(lb.certificates) if lb.certificates else {},
                "path_route_sets": dict(lb.path_route_sets) if lb.path_route_sets else {},
                "hostnames": dict(lb.hostnames) if lb.hostnames else {},
            }
            
            logger.info(f"Retrieved details for load balancer {load_balancer_id}")
            return lb_details
            
        except Exception as e:
            logger.exception(f"Error getting load balancer details: {e}")
            raise
  • The @mcp.tool decorator that registers the 'get_load_balancer' tool with MCP.
    @mcp.tool(name="get_load_balancer")
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states this is a read operation ('Get detailed information'), which implies non-destructive behavior, but doesn't address authentication needs, rate limits, error conditions, or whether it requires specific permissions. The description is minimal and lacks critical operational context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (Args, Returns) and front-loaded purpose. It's concise with no wasted words, though the 'Returns' section could be slightly more detailed given the lack of output schema.

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 moderate complexity (single parameter, no annotations, no output schema), the description is adequate but has gaps. It covers the parameter semantics and return scope, but lacks behavioral context (e.g., authentication, errors) and doesn't fully guide usage relative to siblings. It's minimally viable but not comprehensive.

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 schema description coverage is 0%, so the description must compensate. It explicitly documents the single parameter 'load_balancer_id' with its purpose ('OCID of the load balancer to retrieve'), adding meaningful semantics beyond the bare schema. Since there's only one parameter, this is sufficient for a high score, though not a 5 as it doesn't explain OCID format or sourcing.

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 with a specific verb ('Get detailed information') and resource ('about a specific classic load balancer'), distinguishing it from generic 'get' operations. However, it doesn't explicitly differentiate from sibling tools like 'get_network_load_balancer' or 'list_load_balancers', which would require 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 like 'list_load_balancers' or 'get_network_load_balancer'. It mentions retrieving 'a specific classic load balancer' but doesn't clarify prerequisites, such as needing the OCID first from a list operation.

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