Skip to main content
Glama

get_sql_instance_details

Retrieve comprehensive details about a specific Cloud SQL instance in Google Cloud Platform (GCP) by providing the project ID and instance ID for quick insights and management.

Instructions

    Get detailed information about a specific Cloud SQL instance.
    
    Args:
        project_id: The ID of the GCP project
        instance_id: The ID of the Cloud SQL instance
    
    Returns:
        Detailed information about the specified Cloud SQL instance
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
instance_idYes
project_idYes

Implementation Reference

  • The handler function for the 'get_sql_instance_details' tool. It uses the Google Cloud SQL Admin API to retrieve and format detailed information about a specified Cloud SQL instance, including name, version, state, settings (tier, storage, backups, IP config), and IP addresses.
        def get_sql_instance_details(project_id: str, instance_id: str) -> str:
            """
            Get detailed information about a specific Cloud SQL instance.
            
            Args:
                project_id: The ID of the GCP project
                instance_id: The ID of the Cloud SQL instance
            
            Returns:
                Detailed information about the specified Cloud SQL instance
            """
            try:
                from googleapiclient import discovery
                
                # Initialize the Cloud SQL Admin API client
                service = discovery.build('sqladmin', 'v1')
                
                # Get instance details
                request = service.instances().get(project=project_id, instance=instance_id)
                instance = request.execute()
                
                # Format the response
                details = []
                details.append(f"Name: {instance.get('name', 'Unknown')}")
                details.append(f"Self Link: {instance.get('selfLink', 'Unknown')}")
                details.append(f"Database Version: {instance.get('databaseVersion', 'Unknown')}")
                details.append(f"State: {instance.get('state', 'Unknown')}")
                details.append(f"Region: {instance.get('region', 'Unknown')}")
                
                # Settings information
                if 'settings' in instance:
                    settings = instance['settings']
                    details.append(f"Tier: {settings.get('tier', 'Unknown')}")
                    details.append(f"Storage Size: {settings.get('dataDiskSizeGb', 'Unknown')}GB")
                    details.append(f"Availability Type: {settings.get('availabilityType', 'Unknown')}")
                    
                    # Backup configuration
                    if 'backupConfiguration' in settings:
                        backup = settings['backupConfiguration']
                        enabled = backup.get('enabled', False)
                        details.append(f"Automated Backups: {'Enabled' if enabled else 'Disabled'}")
                        if enabled:
                            details.append(f"Backup Start Time: {backup.get('startTime', 'Unknown')}")
                            details.append(f"Binary Log Enabled: {backup.get('binaryLogEnabled', False)}")
                    
                    # IP configuration
                    if 'ipConfiguration' in settings:
                        ip_config = settings['ipConfiguration']
                        public_ip = "Enabled" if not ip_config.get('privateNetwork') else "Disabled"
                        details.append(f"Public IP: {public_ip}")
                        
                        if 'authorizedNetworks' in ip_config:
                            networks = []
                            for network in ip_config['authorizedNetworks']:
                                name = network.get('name', 'Unnamed')
                                value = network.get('value', 'Unknown')
                                networks.append(f"    - {name}: {value}")
                            
                            if networks:
                                details.append("Authorized Networks:")
                                details.extend(networks)
                
                # IP Addresses
                if 'ipAddresses' in instance:
                    ip_addresses = []
                    for ip in instance['ipAddresses']:
                        ip_type = ip.get('type', 'Unknown')
                        ip_address = ip.get('ipAddress', 'Unknown')
                        ip_addresses.append(f"    - {ip_type}: {ip_address}")
                    
                    if ip_addresses:
                        details.append("IP Addresses:")
                        details.extend(ip_addresses)
                
                details_str = "\n".join(details)
                
                return f"""
    Cloud SQL Instance Details:
    {details_str}
    """
            except Exception as e:
                return f"Error getting SQL instance details: {str(e)}"
  • The registration call for the databases tools module, which includes the 'get_sql_instance_details' tool via databases_tools.register_tools(mcp).
    # Register databases tools
    databases_tools.register_tools(mcp)
  • The @mcp.tool() decorator that registers the get_sql_instance_details function as an MCP tool.
    def get_sql_instance_details(project_id: str, instance_id: str) -> str:
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. It states this is a read operation ('Get'), but doesn't disclose behavioral traits like authentication requirements, rate limits, error conditions, or what 'detailed information' includes. The description is minimal and lacks necessary context for safe use.

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 appropriately concise with three sentences: purpose, parameters, and return value. It's front-loaded with the main purpose first. However, the Args/Returns sections could be more integrated into the flow rather than separate bullet points.

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

Completeness2/5

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

Given no annotations and no output schema, the description is incomplete. It doesn't explain what 'detailed information' includes, authentication needs, error handling, or how it differs from similar tools. For a read operation with 2 parameters, this leaves significant gaps for an AI agent.

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

Parameters3/5

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

Schema description coverage is 0%, so the schema provides no parameter descriptions. The description adds basic semantics by naming the parameters and their purposes ('project_id: The ID of the GCP project', 'instance_id: The ID of the Cloud SQL instance'), but doesn't provide format details, constraints, or examples. This partially compensates 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 tool's purpose: 'Get detailed information about a specific Cloud SQL instance.' It specifies the verb ('Get'), resource ('Cloud SQL instance'), and scope ('specific'). However, it doesn't explicitly differentiate from sibling tools like 'get_instance_details' or 'list_cloud_sql_instances'.

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 'list_cloud_sql_instances' for listing instances or 'get_instance_details' for other instance types, nor does it specify prerequisites or exclusions.

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

Related 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/henihaddad/gcp-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server