Skip to main content
Glama

list_cloud_sql_instances

Retrieve a list of Cloud SQL instances within a specified GCP project using this tool. It simplifies database instance management by providing an organized overview of your SQL resources for efficient project monitoring and administration.

Instructions

    List Cloud SQL instances in a GCP project.
    
    Args:
        project_id: The ID of the GCP project to list Cloud SQL instances for
    
    Returns:
        List of Cloud SQL instances in the specified GCP project
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes

Implementation Reference

  • The handler function decorated with @mcp.tool() that implements the logic to list Cloud SQL instances in a GCP project using the SQL Admin API.
        @mcp.tool()
        def list_cloud_sql_instances(project_id: str) -> str:
            """
            List Cloud SQL instances in a GCP project.
            
            Args:
                project_id: The ID of the GCP project to list Cloud SQL instances for
            
            Returns:
                List of Cloud SQL instances in the specified GCP project
            """
            try:
                from googleapiclient import discovery
                
                # Initialize the Cloud SQL Admin API client
                service = discovery.build('sqladmin', 'v1')
                
                # List SQL instances
                request = service.instances().list(project=project_id)
                response = request.execute()
                
                # Format the response
                instances_list = []
                
                if 'items' in response:
                    for instance in response['items']:
                        name = instance.get('name', 'Unknown')
                        db_version = instance.get('databaseVersion', 'Unknown')
                        state = instance.get('state', 'Unknown')
                        region = instance.get('region', 'Unknown')
                        tier = instance.get('settings', {}).get('tier', 'Unknown')
                        storage_size = instance.get('settings', {}).get('dataDiskSizeGb', 'Unknown')
                        
                        instances_list.append(f"- {name} (Type: {db_version}, Region: {region}, Tier: {tier}, Storage: {storage_size}GB, State: {state})")
                
                if not instances_list:
                    return f"No Cloud SQL instances found in project {project_id}."
                
                instances_str = "\n".join(instances_list)
                
                return f"""
    Cloud SQL Instances in GCP Project {project_id}:
    {instances_str}
    """
            except Exception as e:
                return f"Error listing Cloud SQL instances: {str(e)}"
  • Call to register the databases tools module, which registers the list_cloud_sql_instances tool among others.
    databases_tools.register_tools(mcp)
  • The register_tools function in the databases module where the list_cloud_sql_instances tool is defined and registered via decorator.
    def register_tools(mcp):
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 it's a list operation, implying read-only behavior, but fails to mention critical aspects like pagination, rate limits, authentication requirements, or error handling. This is a significant gap for a tool with zero annotation coverage.

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 that are front-loaded: the first states the purpose, followed by Args and Returns sections. There's no wasted text, though the structure is basic and could be more integrated.

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 the lack of annotations and output schema, the description is incomplete. It doesn't explain the return format (e.g., structure of the list, fields included), error conditions, or behavioral traits like pagination. For a tool with zero structured coverage, this leaves the agent under-informed.

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?

The description adds minimal semantic value beyond the input schema. It documents the single parameter 'project_id' and its purpose, but with 0% schema description coverage, it doesn't compensate by explaining format constraints (e.g., GCP project ID syntax) or providing examples. The baseline is 3 due to the single parameter, but it doesn't fully address the coverage 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 verb ('List') and resource ('Cloud SQL instances in a GCP project'), making the purpose immediately understandable. It distinguishes from siblings like 'list_compute_instances' or 'list_databases' by specifying the resource type, though it doesn't explicitly contrast with them.

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 'get_sql_instance_details' (for specific instances) or 'list_gcp_projects' (for broader context). It lacks any mention of prerequisites, exclusions, or recommended contexts, leaving the agent to infer usage.

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