feat: add mysql-execute-sql tool (#577)

This tool can be used across mysql sources.

`mysql-execute-sql` config is as below:

```
tools:
  mysql_execute_sql_tool:
    kind: "mysql-execute-sql"
    source: my-mysql-source
    description: Use this tool to execute sql.
```

The `mysql-execute-sql` tool takes one parameter. Example request as
follow:
```
curl -X POST -H "Content-Type: application/json" -d '{"sql": "SELECT 1"}' http://127.0.0.1:5000/api/tool/mysql_execute_sql_tool/invoke
```
This commit is contained in:
trehanshakuntG
2025-05-20 02:17:39 +05:30
committed by GitHub
parent e89abac29f
commit 8590061ae4
8 changed files with 445 additions and 4 deletions

View File

@@ -45,6 +45,7 @@ import (
"github.com/googleapis/genai-toolbox/internal/tools/dgraph"
httptool "github.com/googleapis/genai-toolbox/internal/tools/http"
"github.com/googleapis/genai-toolbox/internal/tools/mssqlsql"
"github.com/googleapis/genai-toolbox/internal/tools/mysqlexecutesql"
"github.com/googleapis/genai-toolbox/internal/tools/mysqlsql"
neo4jtool "github.com/googleapis/genai-toolbox/internal/tools/neo4j"
"github.com/googleapis/genai-toolbox/internal/tools/postgresexecutesql"
@@ -412,6 +413,12 @@ func (c *ToolConfigs) UnmarshalYAML(ctx context.Context, unmarshal func(interfac
return fmt.Errorf("unable to parse as %q: %w", kind, err)
}
(*c)[name] = actual
case mysqlexecutesql.ToolKind:
actual := mysqlexecutesql.Config{Name: name}
if err := dec.DecodeContext(ctx, &actual); err != nil {
return fmt.Errorf("unable to parse as %q: %w", kind, err)
}
(*c)[name] = actual
case couchbasetool.ToolKind:
actual := couchbasetool.Config{Name: name}
if err := dec.DecodeContext(ctx, &actual); err != nil {