Compare commits

..

4 Commits

Author SHA1 Message Date
Averi Kitsch
515cd02d45 docs: add github trending badge 2026-01-26 16:15:45 -08:00
Mend Renovate
f6474739e3 chore(deps): update github actions (#2298)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [actions/cache](https://redirect.github.com/actions/cache)
([changelog](9255dc7a25..8b402f58fb))
| action | digest | `9255dc7` → `8b402f5` |
| [actions/checkout](https://redirect.github.com/actions/checkout) |
action | patch | `v6.0.1` → `v6.0.2` |
| [actions/setup-go](https://redirect.github.com/actions/setup-go) |
action | minor | `v6.1.0` → `v6.2.0` |
| [actions/setup-node](https://redirect.github.com/actions/setup-node)
([changelog](395ad32622..6044e13b5d))
| action | digest | `395ad32` → `6044e13` |

---

### Release Notes

<details>
<summary>actions/checkout (actions/checkout)</summary>

###
[`v6.0.2`](https://redirect.github.com/actions/checkout/blob/HEAD/CHANGELOG.md#v602)

[Compare
Source](https://redirect.github.com/actions/checkout/compare/v6.0.1...v6.0.2)

- Fix tag handling: preserve annotations and explicit fetch-tags by
[@&#8203;ericsciple](https://redirect.github.com/ericsciple) in
[#&#8203;2356](https://redirect.github.com/actions/checkout/pull/2356)

</details>

<details>
<summary>actions/setup-go (actions/setup-go)</summary>

###
[`v6.2.0`](https://redirect.github.com/actions/setup-go/releases/tag/v6.2.0)

[Compare
Source](https://redirect.github.com/actions/setup-go/compare/v6.1.0...v6.2.0)

##### What's Changed

##### Enhancements

- Example for restore-only cache in documentation by
[@&#8203;aparnajyothi-y](https://redirect.github.com/aparnajyothi-y) in
[#&#8203;696](https://redirect.github.com/actions/setup-go/pull/696)
- Update Node.js version in action.yml by
[@&#8203;ccoVeille](https://redirect.github.com/ccoVeille) in
[#&#8203;691](https://redirect.github.com/actions/setup-go/pull/691)
- Documentation update of actions/checkout by
[@&#8203;deining](https://redirect.github.com/deining) in
[#&#8203;683](https://redirect.github.com/actions/setup-go/pull/683)

##### Dependency updates

- Upgrade js-yaml from 3.14.1 to 3.14.2 by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[#&#8203;682](https://redirect.github.com/actions/setup-go/pull/682)
- Upgrade
[@&#8203;actions/cache](https://redirect.github.com/actions/cache) to v5
by [@&#8203;salmanmkc](https://redirect.github.com/salmanmkc) in
[#&#8203;695](https://redirect.github.com/actions/setup-go/pull/695)
- Upgrade actions/checkout from 5 to 6 by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[#&#8203;686](https://redirect.github.com/actions/setup-go/pull/686)
- Upgrade qs from 6.14.0 to 6.14.1 by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[#&#8203;703](https://redirect.github.com/actions/setup-go/pull/703)

##### New Contributors

- [@&#8203;ccoVeille](https://redirect.github.com/ccoVeille) made their
first contribution in
[#&#8203;691](https://redirect.github.com/actions/setup-go/pull/691)
- [@&#8203;deining](https://redirect.github.com/deining) made their
first contribution in
[#&#8203;683](https://redirect.github.com/actions/setup-go/pull/683)

**Full Changelog**:
<https://github.com/actions/setup-go/compare/v6...v6.2.0>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config
help](https://redirect.github.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/googleapis/genai-toolbox).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi43NC41IiwidXBkYXRlZEluVmVyIjoiNDIuOTIuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

Co-authored-by: Averi Kitsch <akitsch@google.com>
2026-01-23 20:41:19 +00:00
mahlevanshika
1d7c498116 fix(dataplex): Capture GCP HTTP errors in MCP Toolbox (#2347)
### Description

fix: Surface Dataplex API errors in MCP results

This change addresses issue
https://github.com/googleapis/genai-toolbox/issues/2203, where Dataplex
API errors, such as '403 Forbidden' (Permission Denied), were not being
properly surfaced in the MCP tool results. Previously, these critical
API errors would manifest as generic "connection interrupted" messages,
significantly hindering developer debugging and trust in the Toolbox.

The fix enhances the error handling within the 'dataplexsearchentries'
and 'dataplexsearchaspecttypes' tools. When an error occurs during the
iteration of Dataplex API results, the system now:

Utilizes 'google.golang.org/grpc/status.FromError' to attempt to convert
the returned error into a gRPC status. This is crucial because Google
Cloud client libraries often return errors compatible with gRPC.
If the error is a gRPC status, the canonical error code (e.g.,
'codes.PermissionDenied') and the associated error message are
extracted.
This ensures that users receive clear actionable error feedback,
allowing for quicker diagnosis and resolution of issues like missing IAM
permissions. This aligns with best practices for API error surfacing,
improving the usability and reliability of the Dataplex tools within the
GenAI Toolbox.

Fixes https://github.com/googleapis/genai-toolbox/issues/2203



## 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:

- [ ] Make sure you reviewed

[CONTRIBUTING.md](https://github.com/googleapis/genai-toolbox/blob/main/CONTRIBUTING.md)
- [ ] 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)
- [ ] Appropriate docs were updated (if necessary)
- [ ] Make sure to add `!` if this involve a breaking change

🛠️ Fixes #<issue_number_goes_here>

---------

Co-authored-by: Wenxin Du <117315983+duwenxin99@users.noreply.github.com>
Co-authored-by: Averi Kitsch <akitsch@google.com>
2026-01-23 19:53:59 +00:00
Yuan Teoh
9294ce39c8 ci: add oceanbase link to lycheeignore (#2360)
oceanbase's link is hitting `Rejected status code (this depends on your
"accept" configuration): Too Many Requests` error. It might have
temporarily blocked Lychee due to the too many request being sent in a
short time. Adding the link to lycheeignore to unblock GHA failure.
2026-01-23 18:40:33 +00:00
14 changed files with 41 additions and 71 deletions

View File

@@ -51,12 +51,12 @@ jobs:
extended: true
- name: Setup Node
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
with:
node-version: "22"
- name: Cache dependencies
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}

View File

@@ -57,7 +57,7 @@ jobs:
with:
hugo-version: "0.145.0"
extended: true
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
with:
node-version: "22"

View File

@@ -44,7 +44,7 @@ jobs:
extended: true
- name: Setup Node
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
with:
node-version: "22"

View File

@@ -62,12 +62,12 @@ jobs:
extended: true
- name: Setup Node
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
with:
node-version: "22"
- name: Cache dependencies
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}

View File

@@ -25,7 +25,7 @@ jobs:
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
- name: Restore lychee cache
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5
with:
path: .lycheecache
key: cache-lychee-${{ github.sha }}
@@ -39,6 +39,7 @@ jobs:
--no-progress
--cache
--max-cache-age 1d
--exclude '^neo4j\+.*' --exclude '^bolt://.*'
README.md
docs/
output: /tmp/foo.txt

View File

@@ -51,11 +51,11 @@ jobs:
console.log('Failed to remove label. Another job may have already removed it!');
}
- name: Setup Go
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
with:
go-version: "1.25"
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}

View File

@@ -29,7 +29,7 @@ jobs:
issues: 'write'
pull-requests: 'write'
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: micnncim/action-label-syncer@3abd5ab72fda571e69fffd97bd4e0033dd5f495c # v1.3.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -57,12 +57,12 @@ jobs:
}
- name: Setup Go
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
with:
go-version: "1.24"
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}

View File

@@ -39,7 +39,7 @@ https://dev.mysql.com/doc/refman/8.4/en/user-names.html
# npmjs links can occasionally trigger rate limiting during high-frequency CI builds
https://www.npmjs.com/package/@toolbox-sdk/core
https://www.npmjs.com/package/@toolbox-sdk/adk
https://www.oceanbase.com/
# Ignore social media and blog profiles to reduce external request overhead
https://medium.com/@mcp_toolbox
https://medium.com/@mcp_toolbox

View File

@@ -2,6 +2,8 @@
# MCP Toolbox for Databases
<a href="https://trendshift.io/repositories/13019" target="_blank"><img src="https://trendshift.io/api/badge/repositories/13019" alt="googleapis%2Fgenai-toolbox | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
[![Docs](https://img.shields.io/badge/docs-MCP_Toolbox-blue)](https://googleapis.github.io/genai-toolbox/)
[![Discord](https://img.shields.io/badge/Discord-%235865F2.svg?style=flat&logo=discord&logoColor=white)](https://discord.gg/Dmm69peqjh)
[![Medium](https://img.shields.io/badge/Medium-12100E?style=flat&logo=medium&logoColor=white)](https://medium.com/@mcp_toolbox)

2
go.mod
View File

@@ -63,6 +63,7 @@ require (
google.golang.org/api v0.256.0
google.golang.org/genai v1.37.0
google.golang.org/genproto v0.0.0-20251022142026-3a174f9686a8
google.golang.org/grpc v1.76.0
google.golang.org/protobuf v1.36.10
modernc.org/sqlite v1.40.0
)
@@ -229,7 +230,6 @@ require (
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20251111163417-95abcf5c77ba // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20251103181224-f26f9409b101 // indirect
google.golang.org/grpc v1.76.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
modernc.org/libc v1.66.10 // indirect

View File

@@ -26,7 +26,9 @@ import (
"github.com/googleapis/genai-toolbox/internal/util"
"go.opentelemetry.io/otel/trace"
"golang.org/x/oauth2/google"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
grpcstatus "google.golang.org/grpc/status"
)
const SourceKind string = "dataplex"
@@ -173,9 +175,18 @@ func (s *Source) SearchAspectTypes(ctx context.Context, query string, pageSize i
var results []*dataplexpb.AspectType
for {
entry, err := it.Next()
if err != nil {
if err == iterator.Done {
break
}
if err != nil {
if st, ok := grpcstatus.FromError(err); ok {
errorCode := st.Code()
errorMessage := st.Message()
return nil, fmt.Errorf("failed to search aspect types with error code: %q message: %s", errorCode.String(), errorMessage)
}
return nil, fmt.Errorf("failed to search aspect types: %w", err)
}
// Create an instance of exponential backoff with default values for retrying GetAspectType calls
// InitialInterval, RandomizationFactor, Multiplier, MaxInterval = 500 ms, 0.5, 1.5, 60 s
@@ -214,9 +225,17 @@ func (s *Source) SearchEntries(ctx context.Context, query string, pageSize int,
var results []*dataplexpb.SearchEntriesResult
for {
entry, err := it.Next()
if err != nil {
if err == iterator.Done {
break
}
if err != nil {
if st, ok := grpcstatus.FromError(err); ok {
errorCode := st.Code()
errorMessage := st.Message()
return nil, fmt.Errorf("failed to search entries with error code: %q message: %s", errorCode.String(), errorMessage)
}
return nil, fmt.Errorf("failed to search entries: %w", err)
}
results = append(results, entry)
}
return results, nil

View File

@@ -214,15 +214,12 @@ func AddPostgresPrebuiltConfig(t *testing.T, config map[string]any) map[string]a
PostgresListDatabaseStatsToolKind = "postgres-list-database-stats"
PostgresListRolesToolKind = "postgres-list-roles"
PostgresListStoredProcedureToolKind = "postgres-list-stored-procedure"
)
tools, ok := config["tools"].(map[string]any)
if !ok {
t.Fatalf("unable to get tools from config")
}
tools["list_tables"] = map[string]any{
"kind": PostgresListTablesToolKind,
"source": "my-instance",
@@ -946,8 +943,6 @@ func TestCloudSQLMySQL_IPTypeParsingFromYAML(t *testing.T) {
// Finds and drops all tables in a postgres database.
func CleanupPostgresTables(t *testing.T, ctx context.Context, pool *pgxpool.Pool) {
t.Logf("in cleanupPostgrestTables");
query := `
SELECT table_name FROM information_schema.tables
WHERE table_schema = 'public' AND table_type = 'BASE TABLE';`
@@ -969,31 +964,14 @@ func CleanupPostgresTables(t *testing.T, ctx context.Context, pool *pgxpool.Pool
}
if len(tablesToDrop) == 0 {
t.Logf("No tables to drop in 'public' schema")
return
}
t.Logf("Tables to drop in 'public' schema: %s", strings.Join(tablesToDrop, ", "))
dropQuery := fmt.Sprintf("DROP TABLE IF EXISTS %s CASCADE;", strings.Join(tablesToDrop, ", "))
if _, err := pool.Exec(ctx, dropQuery); err != nil {
t.Fatalf("Failed to drop all tables in 'public' schema: %v", err)
}
t.Logf("Dropped tables in 'public' schema: %s", strings.Join(tablesToDrop, ", "))
// // 1. Drop the entire public schema (this kills tables, views, types, etc.)
// dropSchema := "DROP SCHEMA public CASCADE;"
// // 2. Recreate the empty public schema
// createSchema := "CREATE SCHEMA public;"
// // 3. Grant permissions back (Postgres default)
// grantPublic := "GRANT ALL ON SCHEMA public TO public;"
// _, err := pool.Exec(ctx, dropSchema + createSchema + grantPublic)
// if err != nil {
// t.Fatalf("Failed to nuclear-wipe the public schema: %v", err)
// }
}
// Finds and drops all tables in a mysql database.

View File

@@ -81,25 +81,6 @@ func initPostgresConnectionPool(host, port, user, pass, dbname string) (*pgxpool
return pool, nil
}
func CreateIsolatedSchema(t *testing.T, ctx context.Context, pool *pgxpool.Pool) (string, func()) {
schemaName := "test_schema_" + strings.ReplaceAll(uuid.New().String(), "-", "")
_, err := pool.Exec(ctx, fmt.Sprintf("CREATE SCHEMA %q;", schemaName))
if err != nil {
t.Fatalf("failed to create sandbox schema: %v", err)
}
cleanup := func() {
// Use Background context to ensure cleanup runs even if the test timed out
_, err := pool.Exec(context.Background(), fmt.Sprintf("DROP SCHEMA %q CASCADE;", schemaName))
if err != nil {
t.Logf("Cleanup warning: failed to drop schema %s: %v", schemaName, err)
}
}
return schemaName, cleanup
}
func TestPostgres(t *testing.T) {
sourceConfig := getPostgresVars(t)
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
@@ -111,20 +92,9 @@ func TestPostgres(t *testing.T) {
if err != nil {
t.Fatalf("unable to create postgres connection pool: %s", err)
}
defer pool.Close()
//this was conflicting and too slow
// cleanup test environment
// tests.CleanupPostgresTables(t, ctx, pool)
schemaName, cleanupSchema := CreateIsolatedSchema(t, ctx, pool)
defer cleanupSchema()
// Force the pool to ONLY use this schema for this test run
_, err = pool.Exec(ctx, fmt.Sprintf("SET search_path TO %q;", schemaName))
if err != nil {
t.Fatalf("failed to set search path: %v", err)
}
tests.CleanupPostgresTables(t, ctx, pool)
// create table name with UUID
tableNameParam := "param_table_" + strings.ReplaceAll(uuid.New().String(), "-", "")