Files
genai-toolbox/docs/en/resources/tools/cloudsql/cloudsqlwaitforoperation.md
prernakakkar-google 3aef2bb7be feat(tool/cloudsql): Add cloud sql wait for operation tool with exponential backoff (#1306)
## Description
---
This pull request introduces a new tool, `cloudsql-wait-for-operation`,
to improve the handling of long-running operations in Google Cloud SQL.

__Key Features:__

- __Asynchronous Operation Polling:__ The `cloudsql-wait-for-operation`
tool polls the Cloud SQL operations API at a specified interval until
the operation completes or fails. This is essential for managing
asynchronous tasks like instance and database creation, which can take
several minutes.
- __Configurable Retries:__ The tool includes configurable retry logic
with exponential backoff (`delay`, `maxDelay`, `multiplier`,
`maxRetries`) to handle transient network issues and make the polling
mechanism more resilient.
- __Improved User Experience:__ By waiting for operations to complete,
this tool provides a more synchronous-like experience for the user, who
can be confident that a resource is ready before the next step in a
workflow is executed.

Tested:
<img width="592" height="1118" alt="image"
src="https://github.com/user-attachments/assets/fd64d367-0fba-4d6a-a6f1-8fc642132208"
/>



## 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/langchain-google-alloydb-pg-python/issues/new/choose)
before writing your code! That way we can discuss the change, evaluate
  designs, and agree on the general idea - (Internal bug)
- [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)
- [ ] Make sure to add `!` if this involve a breaking change

🛠️ Fixes #<issue_number_goes_here>
2025-09-12 08:33:48 +00:00

2.3 KiB

title, type, weight, description
title type weight description
cloud-sql-wait-for-operation docs 10 Wait for a long-running Cloud SQL operation to complete.

The cloud-sql-wait-for-operation tool is a utility tool that waits for a long-running Cloud SQL operation to complete. It does this by polling the Cloud SQL Admin API operation status endpoint until the operation is finished, using exponential backoff.

Example

tools:
  cloudsql-operations-get:
    kind: cloud-sql-wait-for-operation
    source: my-cloud-sql-source
    description: "This will poll on operations API until the operation is done. For checking operation status we need projectId and operationId. Once instance is created give follow up steps on how to use the variables to bring data plane MCP server up in local and remote setup."
    delay: 1s
    maxDelay: 4m
    multiplier: 2
    maxRetries: 10

Reference

field type required description
kind string true Must be "cloud-sql-wait-for-operation".
source string true The name of a cloud-sql-admin source to use for authentication.
description string true A description of the tool.
delay duration false The initial delay between polling requests (e.g., 3s). Defaults to 3 seconds.
maxDelay duration false The maximum delay between polling requests (e.g., 4m). Defaults to 4 minutes.
multiplier float false The multiplier for the polling delay. The delay is multiplied by this value after each request. Defaults to 2.0.
maxRetries int false The maximum number of polling attempts before giving up. Defaults to 10.