Skip to main content
Glama

list-sql-instances

Use this tool to retrieve and display all Cloud SQL instances within your current GCP project, enabling quick access and management of your database resources.

Instructions

List all Cloud SQL instances in the current project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Executes the logic to list Cloud SQL instances in the selected GCP project using SqlInstancesServiceClient, handles errors, and returns formatted JSON.
    } else if (name === "list-sql-instances") { if (!selectedProject) { return createTextResponse("No project selected. Please select a project first."); } try { const sqlClient = new SqlInstancesServiceClient({ fallback: 'rest' // Use HTTP/1.1 fallback mode instead of gRPC }); const request = { project: selectedProject }; const [response] = await sqlClient.list(request); return createTextResponse(JSON.stringify({ instances: (response?.items || []).map(instance => ({ name: instance.name || null, databaseVersion: instance.databaseVersion || null, state: instance.state || null, region: instance.region || null })) }, null, 2)); } catch (error: any) { console.error('Error listing SQL instances:', error); return createTextResponse(`Error listing SQL instances: ${error.message}`); }
  • index.ts:185-193 (registration)
    Registers the 'list-sql-instances' tool with the MCP server, specifying its name, description, and empty input schema (no parameters required).
    { name: "list-sql-instances", description: "List all Cloud SQL instances in the current project", inputSchema: { type: "object", properties: {}, required: [], }, },
  • TypeScript interface defining the shape of each SQL instance object returned in the tool's response.
    interface SQLInstance { name: string | null; databaseVersion: string | null; state: string | null; region: string | null; }

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/RadiumGu/gcp-ops-mcp'

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