Skip to content

feat(tool/cloudsqladmin): add cloud-sql-admin-execute-sql-many and cloud-sql-admin-sql-many#3083

Open
duwenxin99 wants to merge 9 commits into
mainfrom
generic-execute-sql
Open

feat(tool/cloudsqladmin): add cloud-sql-admin-execute-sql-many and cloud-sql-admin-sql-many#3083
duwenxin99 wants to merge 9 commits into
mainfrom
generic-execute-sql

Conversation

@duwenxin99
Copy link
Copy Markdown
Contributor

@duwenxin99 duwenxin99 commented Apr 16, 2026

Add 2 new tools using the Cloud SQL Admin instances.executeSql API to enable SQL execution against instances provided at runtime:

  • cloud-sql-admin-execute-sql-many: Allows execution of arbitrary SQL statements on a specific database provided at runtime.
  • cloud-sql-admin-sql-many: Allows execution of prepared SQL statement on a specific instance provided at runtime.

@duwenxin99 duwenxin99 requested a review from a team as a code owner April 16, 2026 21:17
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the postgres-execute-sql-many and postgres-sql-many tools and adds an ExecuteSql method to the Cloud SQL Admin source. Review feedback identifies several improvement opportunities, including the removal of the unused region parameter in both tools and the cleanup of the postgressqlmany configuration by removing the unsupported Parameters field and its associated runtime checks.

Comment thread internal/tools/postgres/postgressqlmany/postgressqlmany.go Outdated
@duwenxin99
Copy link
Copy Markdown
Contributor Author

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the postgres-execute-sql-many and postgres-sql-many tools, enabling SQL execution on Cloud SQL Postgres instances provided at runtime. The changes encompass tool implementations, documentation, prebuilt configuration updates, and integration tests. Review feedback suggests appending " Tool" to the documentation titles for both tools to maintain consistency.

Comment thread docs/en/integrations/postgres/tools/postgres-execute-sql-many.md Outdated
Comment thread docs/en/integrations/postgres/tools/postgres-sql-many.md Outdated
@averikitsch averikitsch self-assigned this Apr 16, 2026
@duwenxin99 duwenxin99 force-pushed the generic-execute-sql branch from 7f7c7bd to f3d09a4 Compare April 20, 2026 20:16
Comment thread internal/prebuiltconfigs/tools/cloud-sql-postgres-admin.yaml
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tools won't be generic postgres so we should move them to a different tool source directory

@duwenxin99 duwenxin99 force-pushed the generic-execute-sql branch from f3d09a4 to 8c86358 Compare May 14, 2026 18:42
@duwenxin99 duwenxin99 requested a review from a team as a code owner May 14, 2026 18:47
}

// GetService returns a new Cloud SQL Admin service for the given access token.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change

Comment on lines +111 to +113
project, _ := paramsMap["project"].(string)
instance, _ := paramsMap["instance"].(string)
database, _ := paramsMap["database"].(string)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should check to make sure these are valid right?

func (cfg Config) Initialize(srcs map[string]sources.Source) (tools.Tool, error) {
infraParams := parameters.Parameters{
parameters.NewStringParameter("project", "The GCP project ID."),
parameters.NewStringParameter("instance", "The Cloud SQL instance ID."),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instance id or instance name?

for _, tc := range tcs {
tc := tc
t.Run(tc.name, func(t *testing.T) {
api := fmt.Sprintf("http://127.0.0.1:5000/api/tool/%s/invoke", tc.toolName)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we be testing this on the MCP API now?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc: @Yuan325


allParams, _, err := parameters.ProcessParameters(cfg.TemplateParameters, cfg.Parameters)
if err != nil {
return nil, err
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we return this error wholesale? Do we need to do some massaging of common errors?

@duwenxin99 duwenxin99 changed the title feat(tool/postgres): add postgres-execute-sql-many and postgres-sql-many feat(tool/cloudsqladmin): add clouds-sql-admin-execute-sql-many and clouds-sql-admin-sql-many May 14, 2026
@duwenxin99 duwenxin99 changed the title feat(tool/cloudsqladmin): add clouds-sql-admin-execute-sql-many and clouds-sql-admin-sql-many feat(tool/cloudsqladmin): add cloud-sql-admin-execute-sql-many and cloud-sql-admin-sql-many May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants