Skip to main content
Glama

get_vpc_details

Retrieve detailed information about a specific VPC network in Google Cloud Platform by providing the project ID and network name. Ideal for managing and monitoring network configurations.

Instructions

    Get detailed information about a specific VPC network.
    
    Args:
        project_id: The ID of the GCP project
        network_name: The name of the VPC network
    
    Returns:
        Detailed information about the specified VPC network
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
network_nameYes
project_idYes

Implementation Reference

  • The handler function for the 'get_vpc_details' MCP tool. It retrieves detailed information about a specific VPC network, including subnets and peerings, using the Google Cloud Compute API.
        @mcp.tool()
        def get_vpc_details(project_id: str, network_name: str) -> str:
            """
            Get detailed information about a specific VPC network.
            
            Args:
                project_id: The ID of the GCP project
                network_name: The name of the VPC network
            
            Returns:
                Detailed information about the specified VPC network
            """
            try:
                from google.cloud import compute_v1
                
                # Initialize the Compute Engine client for networks
                network_client = compute_v1.NetworksClient()
                subnet_client = compute_v1.SubnetworksClient()
                
                # Get network details
                network = network_client.get(project=project_id, network=network_name)
                
                # Format the response
                details = []
                details.append(f"Name: {network.name}")
                details.append(f"ID: {network.id}")
                details.append(f"Description: {network.description or 'None'}")
                details.append(f"Self Link: {network.self_link}")
                details.append(f"Creation Time: {network.creation_timestamp}")
                details.append(f"Subnet Mode: {'Auto' if network.auto_create_subnetworks else 'Custom'}")
                details.append(f"Routing Mode: {network.routing_config.routing_mode if network.routing_config else 'Unknown'}")
                details.append(f"MTU: {network.mtu}")
                
                # If it's a custom subnet mode network, get all subnets
                if not network.auto_create_subnetworks:
                    # List all subnets in this network
                    request = compute_v1.ListSubnetworksRequest(project=project_id)
                    subnets = []
                    
                    for item in subnet_client.list(request=request):
                        # Check if the subnet belongs to this network
                        if network.name in item.network:
                            cidr = item.ip_cidr_range
                            region = item.region.split('/')[-1]
                            purpose = f", Purpose: {item.purpose}" if item.purpose else ""
                            private_ip = ", Private Google Access: Enabled" if item.private_ip_google_access else ""
                            subnets.append(f"  - {item.name} (Region: {region}, CIDR: {cidr}{purpose}{private_ip})")
                    
                    if subnets:
                        details.append(f"Subnets ({len(subnets)}):\n" + "\n".join(subnets))
                
                # List peering connections if any
                if network.peerings:
                    peerings = []
                    for peering in network.peerings:
                        state = peering.state
                        network_name = peering.network.split('/')[-1]
                        peerings.append(f"  - {network_name} (State: {state})")
                    
                    if peerings:
                        details.append(f"Peerings ({len(peerings)}):\n" + "\n".join(peerings))
                
                details_str = "\n".join(details)
                
                return f"""
    VPC Network Details:
    {details_str}
    """
            except Exception as e:
                return f"Error getting VPC network details: {str(e)}"

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.3/5.0
Behavior2/5

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

No annotations are provided, so the description must disclose behavioral traits. It only says 'Get detailed information' without mentioning that the operation is read-only (though implied), error behavior for non-existent networks, response format, or any permissions required. The description adds little beyond what the tool name suggests.

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 compact, using a standard Args/Returns docstring format. It is front-loaded with a clear purpose. However, the Returns line repeats the first sentence nearly verbatim, which is slightly redundant.

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 two-parameter getter, the description is adequate but not complete. It does not specify what 'detailed information' includes (no output schema exists), and it gives no context about when to use this vs. list_vpc_networks. The existing sibling tools and schema structure suggest a more detailed description could clarify return fields and usage context.

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 0% description coverage, so the description must compensate. It provides one-liners for each parameter (project_id, network_name), but these add minimal meaning beyond the parameter names themselves, which are already self-explanatory. No format constraints, examples, or special values are given.

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

Purpose5/5

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

The description clearly states the tool's action ('Get detailed information') and resource ('a specific VPC network'), using a specific verb and object. It distinguishes itself from sibling tools like list_vpc_networks by emphasizing 'specific' rather than listing all networks.

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

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is implied: you need to provide a project_id and network_name to get details for one specific VPC. However, there is no explicit guidance on when to prefer this over list_vpc_networks or other list tools, and no prerequisites like knowing the network name beforehand are stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.