Skip to main content
Glama

list_databases

Retrieve a list of databases within a specified Cloud SQL instance on Google Cloud Platform by providing the project ID and instance ID for quick database management.

Instructions

    List databases in a Cloud SQL instance.
    
    Args:
        project_id: The ID of the GCP project
        instance_id: The ID of the Cloud SQL instance
    
    Returns:
        List of databases in the specified Cloud SQL instance
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
instance_idYes
project_idYes

Implementation Reference

  • The core handler function for the 'list_databases' MCP tool. It uses the Google Cloud SQL Admin API to list all databases in a specified Cloud SQL instance, formats the results, and returns a human-readable string.
        @mcp.tool()
        def list_databases(project_id: str, instance_id: str) -> str:
            """
            List databases in a Cloud SQL instance.
            
            Args:
                project_id: The ID of the GCP project
                instance_id: The ID of the Cloud SQL instance
            
            Returns:
                List of databases in the specified Cloud SQL instance
            """
            try:
                from googleapiclient import discovery
                
                # Initialize the Cloud SQL Admin API client
                service = discovery.build('sqladmin', 'v1')
                
                # List databases
                request = service.databases().list(project=project_id, instance=instance_id)
                response = request.execute()
                
                # Format the response
                databases_list = []
                
                if 'items' in response:
                    for database in response['items']:
                        name = database.get('name', 'Unknown')
                        charset = database.get('charset', 'Unknown')
                        collation = database.get('collation', 'Unknown')
                        
                        databases_list.append(f"- {name} (Charset: {charset}, Collation: {collation})")
                
                if not databases_list:
                    return f"No databases found in Cloud SQL instance {instance_id}."
                
                databases_str = "\n".join(databases_list)
                
                return f"""
    Databases in Cloud SQL Instance {instance_id}:
    {databases_str}
    """
            except Exception as e:
                return f"Error listing databases: {str(e)}"
  • Top-level registration call for the databases module, which registers the 'list_databases' tool (among others) with the MCP server via the module's register_tools function.
    databases_tools.register_tools(mcp)
  • Import of the databases tools module in the main MCP server file, aliased as databases_tools, enabling the registration of tools including 'list_databases'.
    from .gcp_modules.databases import tools as databases_tools
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool does but doesn't describe important behaviors like whether this is a read-only operation, what permissions are required, how results are formatted, or if there are rate limits. The description is minimal and lacks behavioral 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 (purpose, Args, Returns) and uses minimal sentences. Every sentence serves a purpose, though the Returns section could be more informative given there's no 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?

For a simple listing tool with 2 parameters and no output schema, the description covers the basics but lacks important context. Without annotations, it should explain more about the operation's safety profile, return format, and usage considerations. The parameter explanations help, but overall completeness is only adequate.

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 explicitly names and explains both parameters (project_id and instance_id) in the Args section, adding meaningful context beyond the schema which has 0% description coverage. However, it doesn't provide format examples, constraints, or additional semantic details about these parameters.

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 ('databases in a Cloud SQL instance'), making the purpose immediately understandable. It distinguishes from siblings like 'list_cloud_sql_instances' by specifying databases rather than instances, though it doesn't explicitly mention this distinction.

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?

No guidance is provided on when to use this tool versus alternatives. While the description implies it's for listing databases within a specific Cloud SQL instance, it doesn't mention prerequisites, related tools, or scenarios where other tools might be more appropriate.

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