Skip to main content
Glama

create_backup

Generate backups for GCP Cloud SQL instances by specifying the project ID, instance ID, and optional description. Ensures data recovery and continuity for Google Cloud databases.

Instructions

    Create a backup for a Cloud SQL instance.
    
    Args:
        project_id: The ID of the GCP project
        instance_id: The ID of the Cloud SQL instance
        description: Optional description for the backup
    
    Returns:
        Result of the backup operation
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionNo
instance_idYes
project_idYes

Implementation Reference

  • The create_backup tool handler: creates an on-demand backup for a Cloud SQL instance using the GCP SQL Admin API.
        @mcp.tool()
        def create_backup(project_id: str, instance_id: str, description: Optional[str] = None) -> str:
            """
            Create a backup for a Cloud SQL instance.
            
            Args:
                project_id: The ID of the GCP project
                instance_id: The ID of the Cloud SQL instance
                description: Optional description for the backup
            
            Returns:
                Result of the backup operation
            """
            try:
                from googleapiclient import discovery
                
                # Initialize the Cloud SQL Admin API client
                service = discovery.build('sqladmin', 'v1')
                
                # Create backup
                backup_run_body = {}
                if description:
                    backup_run_body['description'] = description
                
                request = service.backupRuns().insert(project=project_id, instance=instance_id, body=backup_run_body)
                operation = request.execute()
                
                # Get operation ID and status
                operation_id = operation.get('name', 'Unknown')
                status = operation.get('status', 'Unknown')
                
                return f"""
    Backup operation initiated:
    - Instance: {instance_id}
    - Project: {project_id}
    - Description: {description or 'None provided'}
    
    Operation ID: {operation_id}
    Status: {status}
    
    The backup process may take some time to complete. You can check the status of the backup using the Cloud SQL Admin API or Google Cloud Console.
    """
            except Exception as e:
                return f"Error creating backup: {str(e)}"
  • Registers the databases tools module, which contains the create_backup handler, with the MCP server instance.
    databases_tools.register_tools(mcp)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

C2.9/5.0
Behavior2/5

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

Annotations are absent, so the description must disclose behavioral traits. It only states that it creates a backup and returns a result, without mentioning mutating implications, potential long-running behavior, IAM requirements, or effects on existing backups. This leaves the agent without a clear understanding of side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and well-structured, opening with a clear action statement, followed by a parameter list and return value. It contains no irrelevant information and is easy to scan.

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 too sparse. It leaves out critical context such as prerequisites (e.g., the instance must exist), asynchronous behavior, what the returned result contains, and potential permissions. The vague 'Result of the backup operation' does not adequately prepare an agent for the tool's usage.

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 schema has no parameter descriptions (0% coverage), so the description compensates by listing all three parameters with brief explanations. It clarifies that 'description' is optional, which adds context, but the explanations are largely restatements of the parameter names and lack detailed constraints or formatting.

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 action 'Create a backup' and the specific resource 'Cloud SQL instance', which is sufficiently precise. It does not explicitly compare with sibling tools, but the resource type differentiates it from other backup/snapshot tools.

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, prerequisites, or alternatives. The usage is only implied by the tool's name and description, with no explicit context such as 'use when you need to back up a Cloud SQL instance' or required permissions.

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