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:

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.6/5.0
Behavior3/5

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

With no annotations, the description carries the full burden. It states it returns detailed information but does not disclose potential side effects, permission requirements, or limits. For a read-only getter, this is adequate but does not enrich beyond the obvious.

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 Args and Returns sections and is not overly verbose. The opening sentence is concise and informative, though the Args section partially duplicates schema fields.

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 2-parameter getter, the description covers purpose and parameters, but the return value is vaguely described as 'detailed information'. Since there is no output schema, it should provide more specifics about what details are returned. It also lacks any usage context or error behavior.

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?

Schema description coverage is 0%, so the description adds meaning. It defines both parameters: 'The ID of the GCP project' and 'The ID of the Cloud SQL instance', giving semantic context that the bare schema lacks. However, it does not include formats or constraints.

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 explicitly states 'Get detailed information about a specific Cloud SQL instance' – a clear verb+resource combination. It distinguishes itself from sibling tools like list_cloud_sql_instances and get_instance_details (which likely refers to compute instances) by naming the specific resource type.

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 does not mention that it should be used after listing instances, nor does it contrast with the sibling list_cloud_sql_instances. Usage is only implied by the tool name and the word 'specific'.

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