Files
genai-toolbox/docs/en/resources/tools/cloudsql/cloudsqllistdatabases.md
prernakakkar-google e6a6c615d5 feat(prebuilt/cloudsql): Add list databases tool for cloud sql (#1454)
## Description

---
feat: Add tool to list Cloud SQL databases

This change introduces a new tool for listing databases within a Google
Cloud SQL instance.

The new tool, `list-databases`, is part of the `cloud-sql-admin` source
and allows users to retrieve a list of all databases for a given
instance.

### Detailed Description

The `list-databases` tool provides a simple and direct way to inspect
the databases present in a Cloud SQL instance. It is implemented in
`internal/tools/cloudsql/cloudsqllistdatabases/cloudsqllistdatabases.go`.

**Key Features:**

*   **Tool Name:** `list-databases`
*   **Source:** `cloud-sql-admin`
*   **Parameters:**
    *   `project` (required): The Google Cloud project ID.
    *   `instance` (required): The ID of the Cloud SQL instance.
*   **Functionality:**
* The tool uses the `sqladmin.Databases.List` API to fetch the list of
databases.
* It formats the output into a JSON array, where each object contains
the `name`, `charset`, and `collation` of a database.
    *   If no databases are found, it returns an empty array.


## 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
- [ ] Ensure the tests and linter pass
- [ ] Code coverage does not decrease (if any source code was changed)
- [x] Appropriate docs were updated (if necessary)
- [ ] Make sure to add `!` if this involve a breaking change

🛠️ Fixes #<issue_number_goes_here>
2025-09-16 14:25:28 +05:30

1.6 KiB

title, type, weight, description
title type weight description
cloud-sql-list-databases docs 1 List Cloud SQL databases in an instance.

The cloud-sql-list-databases tool lists all Cloud SQL databases in a specified Google Cloud project and instance.

{{< notice info >}} This tool uses the cloud-sql-admin source. {{< /notice >}}

Configuration

Here is an example of how to configure the cloud-sql-list-databases tool in your tools.yaml file:

sources:
  my-cloud-sql-admin-source:
    kind: cloud-sql-admin

tools:
  list_my_databases:
    kind: cloud-sql-list-databases
    source: my-cloud-sql-admin-source
    description: Use this tool to list all Cloud SQL databases in an instance.

Parameters

The cloud-sql-list-databases tool has two required parameters:

field type required description
project string true The Google Cloud project ID.
instance string true The Cloud SQL instance ID.

Reference

field type required description
kind string true Must be "cloud-sql-list-databases".
source string true The name of the cloud-sql-admin source to use for this tool.
description string false Description of the tool that is passed to the agent.