## Description Adds a read-only PostgreSQL custom list_views tool, that returns the details of views present in database. Each row includes: schema_name, view_name, owner_name Test Output: <img width="2433" height="1274" alt="Screenshot 2025-10-19 at 3 59 31 PM" src="https://github.com/user-attachments/assets/76e1e994-390a-4239-aba7-0d02253bbcc4" /> <img width="2533" height="1017" alt="Screenshot 2025-10-19 at 4 07 25 PM" src="https://github.com/user-attachments/assets/537fbddd-d862-4044-a09b-cb9f180c21fa" /> ## PR Checklist > Thank you for opening a Pull Request! Before submitting your PR, there are a > few things you can do to make sure it goes smoothly: - [x] Make sure you reviewed [CONTRIBUTING.md](https://github.com/googleapis/genai-toolbox/blob/main/CONTRIBUTING.md) - [x] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/genai-toolbox/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [x] Ensure the tests and linter pass - [x] Code coverage does not decrease (if any source code was changed) - [x] Appropriate docs were updated (if necessary) - [x] Make sure to add `!` if this involve a breaking change 🛠️ Fixes #1738 Co-authored-by: Averi Kitsch <akitsch@google.com>
6.5 KiB
title, linkTitle, type, weight, description
| title | linkTitle | type | weight | description |
|---|---|---|---|---|
| Cloud SQL for PostgreSQL | Cloud SQL (Postgres) | docs | 1 | Cloud SQL for PostgreSQL is a fully-managed database service for Postgres. |
About
Cloud SQL for PostgreSQL is a fully-managed database service that helps you set up, maintain, manage, and administer your PostgreSQL relational databases on Google Cloud Platform.
If you are new to Cloud SQL for PostgreSQL, you can try creating and connecting to a database by following these instructions.
Available Tools
-
postgres-sqlExecute SQL queries as prepared statements in PostgreSQL. -
postgres-execute-sqlRun parameterized SQL statements in PostgreSQL. -
postgres-list-tablesList tables in a PostgreSQL database. -
postgres-list-active-queriesList active queries in a PostgreSQL database. -
postgres-list-available-extensionsList available extensions for installation in a PostgreSQL database. -
postgres-list-installed-extensionsList installed extensions in a PostgreSQL database. -
postgres-list-viewsList views in a PostgreSQL database.
Pre-built Configurations
- Cloud SQL for Postgres using MCP Connect your IDE to Cloud SQL for Postgres using Toolbox.
Requirements
IAM Permissions
By default, this source uses the Cloud SQL Go Connector to authorize and establish mTLS connections to your Cloud SQL instance. The Go connector uses your Application Default Credentials (ADC) to authorize your connection to Cloud SQL.
In addition to setting the ADC for your server, you need to ensure the IAM identity has been given the following IAM roles (or corresponding permissions):
roles/cloudsql.client
{{< notice tip >}} If you are connecting from Compute Engine, make sure your VM also has the proper scope to connect using the Cloud SQL Admin API. {{< /notice >}}
Networking
Cloud SQL supports connecting over both from external networks via the internet (public IP), and internal networks (private IP). For more information on choosing between the two options, see the Cloud SQL page Connection overview.
You can configure the ipType parameter in your source configuration to
public or private to match your cluster's configuration. Regardless of which
you choose, all connections use IAM-based authorization and are encrypted with
mTLS.
Authentication
This source supports both password-based authentication and IAM authentication (using your Application Default Credentials).
Standard Authentication
To connect using user/password, create
a PostgreSQL user and input your credentials in the user and
password fields.
user: ${USER_NAME}
password: ${PASSWORD}
IAM Authentication
To connect using IAM authentication:
-
Prepare your database instance and user following this guide.
-
You could choose one of the two ways to log in:
- Specify your IAM email as the
user. - Leave your
userfield blank. Toolbox will fetch the ADC automatically and log in using the email associated with it.
- Specify your IAM email as the
-
Leave the
passwordfield blank.
Example
sources:
my-cloud-sql-pg-source:
kind: cloud-sql-postgres
project: my-project-id
region: us-central1
instance: my-instance
database: my_db
user: ${USER_NAME}
password: ${PASSWORD}
# ipType: "private"
{{< notice tip >}} Use environment variable replacement with the format ${ENV_NAME} instead of hardcoding your secrets into the configuration file. {{< /notice >}}
Reference
| field | type | required | description |
|---|---|---|---|
| kind | string | true | Must be "cloud-sql-postgres". |
| project | string | true | Id of the GCP project that the cluster was created in (e.g. "my-project-id"). |
| region | string | true | Name of the GCP region that the cluster was created in (e.g. "us-central1"). |
| instance | string | true | Name of the Cloud SQL instance within the cluster (e.g. "my-instance"). |
| database | string | true | Name of the Postgres database to connect to (e.g. "my_db"). |
| user | string | false | Name of the Postgres user to connect as (e.g. "my-pg-user"). Defaults to IAM auth using ADC email if unspecified. |
| password | string | false | Password of the Postgres user (e.g. "my-password"). Defaults to attempting IAM authentication if unspecified. |
| ipType | string | false | IP Type of the Cloud SQL instance; must be one of public, private, or psc. Default: public. |