mirror of
https://github.com/googleapis/genai-toolbox.git
synced 2026-02-18 11:02:26 -05:00
Compare commits
25 Commits
v0.21.0
...
lsc-177141
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d1e38281a | ||
|
|
89c85729d1 | ||
|
|
93f638650d | ||
|
|
8752e05ab6 | ||
|
|
185c72939d | ||
|
|
87ef9c5908 | ||
|
|
1deda6cb4c | ||
|
|
768bf01966 | ||
|
|
b0fe6775d5 | ||
|
|
a539c71ffe | ||
|
|
975d02e243 | ||
|
|
624d06e7ba | ||
|
|
9f27134918 | ||
|
|
baf1bd1a97 | ||
|
|
9b67f7354c | ||
|
|
60470c32dd | ||
|
|
89277513f0 | ||
|
|
ee10723480 | ||
|
|
eee77ba333 | ||
|
|
6b0ffaa309 | ||
|
|
b935193bea | ||
|
|
dabfad1e1c | ||
|
|
58d31a9f51 | ||
|
|
871514d635 | ||
|
|
18017d6545 |
@@ -33,19 +33,56 @@ steps:
|
||||
script: |
|
||||
go get -d ./...
|
||||
|
||||
- id: "install-zig"
|
||||
name: golang:1
|
||||
waitFor: ['-']
|
||||
volumes:
|
||||
- name: 'zig'
|
||||
path: '/zig-tools'
|
||||
script: |
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
apt-get update && apt-get install -y xz-utils
|
||||
curl -fL "https://ziglang.org/download/0.15.2/zig-x86_64-linux-0.15.2.tar.xz" -o zig.tar.xz
|
||||
tar -xf zig.tar.xz -C /zig-tools --strip-components=1
|
||||
|
||||
- id: "install-macos-sdk"
|
||||
name: golang:1
|
||||
waitFor: ['-']
|
||||
volumes:
|
||||
- name: 'macos-sdk'
|
||||
path: '/macos-sdk'
|
||||
script: |
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
apt-get update && apt-get install -y xz-utils
|
||||
echo "Downloading macOS 14.5 SDK..."
|
||||
curl -fL -o sdk.tar.xz https://github.com/alexey-lysiuk/macos-sdk/releases/download/14.5/MacOSX14.5.tar.xz
|
||||
|
||||
mkdir -p /macos-sdk/MacOSX14.5.sdk
|
||||
echo "Unpacking macOS 14.5 SDK..."
|
||||
tar -xf sdk.tar.xz -C /macos-sdk/MacOSX14.5.sdk --strip-components=1
|
||||
|
||||
- id: "build-linux-amd64"
|
||||
name: golang:1
|
||||
waitFor:
|
||||
waitFor:
|
||||
- "install-dependencies"
|
||||
- "install-zig"
|
||||
env:
|
||||
- 'GOPATH=/gopath'
|
||||
- 'CGO_ENABLED=1'
|
||||
- 'GOOS=linux'
|
||||
- 'GOARCH=amd64'
|
||||
- 'CC=/zig-tools/zig cc -target x86_64-linux-gnu'
|
||||
- 'CXX=/zig-tools/zig c++ -target x86_64-linux-gnu'
|
||||
volumes:
|
||||
- name: 'go'
|
||||
path: '/gopath'
|
||||
- name: 'zig'
|
||||
path: '/zig-tools'
|
||||
script: |
|
||||
#!/usr/bin/env bash
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
|
||||
go build -ldflags "-X github.com/googleapis/genai-toolbox/cmd.commitSha=$(git rev-parse --short HEAD)" -o toolbox.linux.amd64
|
||||
go build -ldflags "-X github.com/googleapis/genai-toolbox/cmd.commitSha=$(git rev-parse --short HEAD)" -o toolbox.linux.amd64
|
||||
|
||||
- id: "store-linux-amd64"
|
||||
name: "gcr.io/cloud-builders/gcloud:latest"
|
||||
@@ -57,33 +94,53 @@ steps:
|
||||
|
||||
- id: "build-linux-amd64-geminicli"
|
||||
name: golang:1
|
||||
waitFor:
|
||||
waitFor:
|
||||
- "install-dependencies"
|
||||
env:
|
||||
- "install-zig"
|
||||
env:
|
||||
- 'GOPATH=/gopath'
|
||||
- 'CGO_ENABLED=1'
|
||||
- 'GOOS=linux'
|
||||
- 'GOARCH=amd64'
|
||||
- 'CC=/zig-tools/zig cc -target x86_64-linux-gnu'
|
||||
- 'CXX=/zig-tools/zig c++ -target x86_64-linux-gnu'
|
||||
volumes:
|
||||
- name: 'go'
|
||||
path: '/gopath'
|
||||
- name: 'zig'
|
||||
path: '/zig-tools'
|
||||
script: |
|
||||
#!/usr/bin/env bash
|
||||
export VERSION=$(cat ./cmd/version.txt)
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
|
||||
go build -ldflags "-X github.com/googleapis/genai-toolbox/cmd.commitSha=$(git rev-parse --short HEAD)" -o toolbox.geminicli.linux.amd64
|
||||
|
||||
go build -ldflags "-X github.com/googleapis/genai-toolbox/cmd.commitSha=$(git rev-parse --short HEAD)" -o toolbox.geminicli.linux.amd64
|
||||
|
||||
- id: "build-darwin-arm64"
|
||||
name: golang:1
|
||||
waitFor:
|
||||
waitFor:
|
||||
- "install-dependencies"
|
||||
- "install-zig"
|
||||
- "install-macos-sdk"
|
||||
env:
|
||||
- 'GOPATH=/gopath'
|
||||
- 'CGO_ENABLED=1'
|
||||
- 'GOOS=darwin'
|
||||
- 'GOARCH=arm64'
|
||||
- 'SDK_PATH=/macos-sdk/MacOSX14.5.sdk'
|
||||
- 'MACOS_MIN_VER=10.14'
|
||||
- 'CGO_LDFLAGS=-mmacosx-version-min=10.14 --sysroot /macos-sdk/MacOSX14.5.sdk -F/macos-sdk/MacOSX14.5.sdk/System/Library/Frameworks -L/usr/lib'
|
||||
- 'COMMON_FLAGS=-mmacosx-version-min=10.14 -target aarch64-macos.11.0.0-none -isysroot /macos-sdk/MacOSX14.5.sdk -iwithsysroot /usr/include -iframeworkwithsysroot /System/Library/Frameworks'
|
||||
- 'CC=/zig-tools/zig cc -mmacosx-version-min=10.14 -target aarch64-macos.11.0.0-none -isysroot /macos-sdk/MacOSX14.5.sdk -iwithsysroot /usr/include -iframeworkwithsysroot /System/Library/Frameworks'
|
||||
- 'CXX=/zig-tools/zig c++ -mmacosx-version-min=10.14 -target aarch64-macos.11.0.0-none -isysroot /macos-sdk/MacOSX14.5.sdk -iwithsysroot /usr/include -iframeworkwithsysroot /System/Library/Frameworks'
|
||||
volumes:
|
||||
- name: 'go'
|
||||
path: '/gopath'
|
||||
- name: 'zig'
|
||||
path: '/zig-tools'
|
||||
- name: 'macos-sdk'
|
||||
path: '/macos-sdk'
|
||||
script: |
|
||||
#!/usr/bin/env bash
|
||||
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 \
|
||||
go build -ldflags "-X github.com/googleapis/genai-toolbox/cmd.commitSha=$(git rev-parse --short HEAD)" -o toolbox.darwin.arm64
|
||||
go build -trimpath -buildmode=pie -ldflags "-s -w -X github.com/googleapis/genai-toolbox/cmd.commitSha=$(git rev-parse --short HEAD)" -o toolbox.darwin.arm64
|
||||
|
||||
- id: "store-darwin-arm64"
|
||||
name: "gcr.io/cloud-builders/gcloud:latest"
|
||||
@@ -95,32 +152,59 @@ steps:
|
||||
|
||||
- id: "build-darwin-arm64-geminicli"
|
||||
name: golang:1
|
||||
waitFor:
|
||||
waitFor:
|
||||
- "install-dependencies"
|
||||
env:
|
||||
- "install-zig"
|
||||
- "install-macos-sdk"
|
||||
env:
|
||||
- 'GOPATH=/gopath'
|
||||
- 'CGO_ENABLED=1'
|
||||
- 'GOOS=darwin'
|
||||
- 'GOARCH=arm64'
|
||||
- 'SDK_PATH=/macos-sdk/MacOSX14.5.sdk'
|
||||
- 'MACOS_MIN_VER=10.14'
|
||||
- 'CGO_LDFLAGS=-mmacosx-version-min=10.14 --sysroot /macos-sdk/MacOSX14.5.sdk -F/macos-sdk/MacOSX14.5.sdk/System/Library/Frameworks -L/usr/lib'
|
||||
- 'COMMON_FLAGS=-mmacosx-version-min=10.14 -target aarch64-macos.11.0.0-none -isysroot /macos-sdk/MacOSX14.5.sdk -iwithsysroot /usr/include -iframeworkwithsysroot /System/Library/Frameworks'
|
||||
- 'CC=/zig-tools/zig cc -mmacosx-version-min=10.14 -target aarch64-macos.11.0.0-none -isysroot /macos-sdk/MacOSX14.5.sdk -iwithsysroot /usr/include -iframeworkwithsysroot /System/Library/Frameworks'
|
||||
- 'CXX=/zig-tools/zig c++ -mmacosx-version-min=10.14 -target aarch64-macos.11.0.0-none -isysroot /macos-sdk/MacOSX14.5.sdk -iwithsysroot /usr/include -iframeworkwithsysroot /System/Library/Frameworks'
|
||||
volumes:
|
||||
- name: 'go'
|
||||
path: '/gopath'
|
||||
- name: 'zig'
|
||||
path: '/zig-tools'
|
||||
- name: 'macos-sdk'
|
||||
path: '/macos-sdk'
|
||||
script: |
|
||||
#!/usr/bin/env bash
|
||||
export VERSION=$(cat ./cmd/version.txt)
|
||||
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 \
|
||||
go build -ldflags "-X github.com/googleapis/genai-toolbox/cmd.commitSha=$(git rev-parse --short HEAD)" -o toolbox.geminicli.darwin.arm64
|
||||
go build -trimpath -buildmode=pie -ldflags "-s -w -X github.com/googleapis/genai-toolbox/cmd.commitSha=$(git rev-parse --short HEAD)" -o toolbox.geminicli.darwin.arm64
|
||||
|
||||
- id: "build-darwin-amd64"
|
||||
name: golang:1
|
||||
waitFor:
|
||||
waitFor:
|
||||
- "install-dependencies"
|
||||
- "install-zig"
|
||||
- "install-macos-sdk"
|
||||
env:
|
||||
- 'GOPATH=/gopath'
|
||||
- 'CGO_ENABLED=1'
|
||||
- 'GOOS=darwin'
|
||||
- 'GOARCH=amd64'
|
||||
- 'SDK_PATH=/macos-sdk/MacOSX14.5.sdk'
|
||||
- 'MACOS_MIN_VER=10.14'
|
||||
- 'CGO_LDFLAGS=-mmacosx-version-min=10.14 --sysroot /macos-sdk/MacOSX14.5.sdk -F/macos-sdk/MacOSX14.5.sdk/System/Library/Frameworks -L/usr/lib'
|
||||
- 'COMMON_FLAGS=-mmacosx-version-min=10.14 -target x86_64-macos.11.0.0-none -isysroot /macos-sdk/MacOSX14.5.sdk -iwithsysroot /usr/include -iframeworkwithsysroot /System/Library/Frameworks'
|
||||
- 'CC=/zig-tools/zig cc -mmacosx-version-min=10.14 -target x86_64-macos.11.0.0-none -isysroot /macos-sdk/MacOSX14.5.sdk -iwithsysroot /usr/include -iframeworkwithsysroot /System/Library/Frameworks'
|
||||
- 'CXX=/zig-tools/zig c++ -mmacosx-version-min=10.14 -target x86_64-macos.11.0.0-none -isysroot /macos-sdk/MacOSX14.5.sdk -iwithsysroot /usr/include -iframeworkwithsysroot /System/Library/Frameworks'
|
||||
volumes:
|
||||
- name: 'go'
|
||||
path: '/gopath'
|
||||
- name: 'zig'
|
||||
path: '/zig-tools'
|
||||
- name: 'macos-sdk'
|
||||
path: '/macos-sdk'
|
||||
script: |
|
||||
#!/usr/bin/env bash
|
||||
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 \
|
||||
go build -ldflags "-X github.com/googleapis/genai-toolbox/cmd.commitSha=$(git rev-parse --short HEAD)" -o toolbox.darwin.amd64
|
||||
go build -trimpath -buildmode=pie -ldflags "-s -w -X github.com/googleapis/genai-toolbox/cmd.commitSha=$(git rev-parse --short HEAD)" -o toolbox.darwin.amd64
|
||||
|
||||
- id: "store-darwin-amd64"
|
||||
name: "gcr.io/cloud-builders/gcloud:latest"
|
||||
@@ -132,32 +216,52 @@ steps:
|
||||
|
||||
- id: "build-darwin-amd64-geminicli"
|
||||
name: golang:1
|
||||
waitFor:
|
||||
waitFor:
|
||||
- "install-dependencies"
|
||||
env:
|
||||
- "install-zig"
|
||||
- "install-macos-sdk"
|
||||
env:
|
||||
- 'GOPATH=/gopath'
|
||||
- 'CGO_ENABLED=1'
|
||||
- 'GOOS=darwin'
|
||||
- 'GOARCH=amd64'
|
||||
- 'SDK_PATH=/macos-sdk/MacOSX14.5.sdk'
|
||||
- 'MACOS_MIN_VER=10.14'
|
||||
- 'CGO_LDFLAGS=-mmacosx-version-min=10.14 --sysroot /macos-sdk/MacOSX14.5.sdk -F/macos-sdk/MacOSX14.5.sdk/System/Library/Frameworks -L/usr/lib'
|
||||
- 'COMMON_FLAGS=-mmacosx-version-min=10.14 -target x86_64-macos.11.0.0-none -isysroot /macos-sdk/MacOSX14.5.sdk -iwithsysroot /usr/include -iframeworkwithsysroot /System/Library/Frameworks'
|
||||
- 'CC=/zig-tools/zig cc -mmacosx-version-min=10.14 -target x86_64-macos.11.0.0-none -isysroot /macos-sdk/MacOSX14.5.sdk -iwithsysroot /usr/include -iframeworkwithsysroot /System/Library/Frameworks'
|
||||
- 'CXX=/zig-tools/zig c++ -mmacosx-version-min=10.14 -target x86_64-macos.11.0.0-none -isysroot /macos-sdk/MacOSX14.5.sdk -iwithsysroot /usr/include -iframeworkwithsysroot /System/Library/Frameworks'
|
||||
volumes:
|
||||
- name: 'go'
|
||||
path: '/gopath'
|
||||
- name: 'zig'
|
||||
path: '/zig-tools'
|
||||
- name: 'macos-sdk'
|
||||
path: '/macos-sdk'
|
||||
script: |
|
||||
#!/usr/bin/env bash
|
||||
export VERSION=$(cat ./cmd/version.txt)
|
||||
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 \
|
||||
go build -ldflags "-X github.com/googleapis/genai-toolbox/cmd.commitSha=$(git rev-parse --short HEAD)" -o toolbox.geminicli.darwin.amd64
|
||||
go build -trimpath -buildmode=pie -ldflags "-s -w -X github.com/googleapis/genai-toolbox/cmd.commitSha=$(git rev-parse --short HEAD)" -o toolbox.geminicli.darwin.amd64
|
||||
|
||||
- id: "build-windows-amd64"
|
||||
name: golang:1
|
||||
waitFor:
|
||||
waitFor:
|
||||
- "install-dependencies"
|
||||
- "install-zig"
|
||||
env:
|
||||
- 'GOPATH=/gopath'
|
||||
- 'CGO_ENABLED=1'
|
||||
- 'GOOS=windows'
|
||||
- 'GOARCH=amd64'
|
||||
- 'CC=/zig-tools/zig cc -target x86_64-windows-gnu'
|
||||
- 'CXX=/zig-tools/zig c++ -target x86_64-windows-gnu'
|
||||
volumes:
|
||||
- name: 'go'
|
||||
path: '/gopath'
|
||||
- name: 'zig'
|
||||
path: '/zig-tools'
|
||||
script: |
|
||||
#!/usr/bin/env bash
|
||||
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 \
|
||||
go build -ldflags "-X github.com/googleapis/genai-toolbox/cmd.commitSha=$(git rev-parse --short HEAD)" -o toolbox.windows.amd64
|
||||
go build -ldflags "-X github.com/googleapis/genai-toolbox/cmd.commitSha=$(git rev-parse --short HEAD)" -o toolbox.windows.amd64
|
||||
|
||||
- id: "store-windows-amd64"
|
||||
name: "gcr.io/cloud-builders/gcloud:latest"
|
||||
@@ -169,18 +273,25 @@ steps:
|
||||
|
||||
- id: "build-windows-amd64-geminicli"
|
||||
name: golang:1
|
||||
waitFor:
|
||||
waitFor:
|
||||
- "install-dependencies"
|
||||
env:
|
||||
- "install-zig"
|
||||
env:
|
||||
- 'GOPATH=/gopath'
|
||||
- 'CGO_ENABLED=1'
|
||||
- 'GOOS=windows'
|
||||
- 'GOARCH=amd64'
|
||||
- 'CC=/zig-tools/zig cc -target x86_64-windows-gnu'
|
||||
- 'CXX=/zig-tools/zig c++ -target x86_64-windows-gnu'
|
||||
volumes:
|
||||
- name: 'go'
|
||||
path: '/gopath'
|
||||
- name: 'zig'
|
||||
path: '/zig-tools'
|
||||
script: |
|
||||
#!/usr/bin/env bash
|
||||
export VERSION=$(cat ./cmd/version.txt)
|
||||
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 \
|
||||
go build -ldflags "-X github.com/googleapis/genai-toolbox/cmd.commitSha=$(git rev-parse --short HEAD)" -o toolbox.geminicli.windows.amd64
|
||||
go build -ldflags "-X github.com/googleapis/genai-toolbox/cmd.commitSha=$(git rev-parse --short HEAD)" -o toolbox.geminicli.windows.amd64
|
||||
|
||||
options:
|
||||
automapSubstitutions: true
|
||||
|
||||
@@ -29,7 +29,7 @@ steps:
|
||||
- id: "install-dependencies"
|
||||
name: golang:1
|
||||
waitFor: ['-']
|
||||
env:
|
||||
env:
|
||||
- 'GOPATH=/gopath'
|
||||
volumes:
|
||||
- name: 'go'
|
||||
@@ -37,20 +37,56 @@ steps:
|
||||
script: |
|
||||
go get -d ./...
|
||||
|
||||
- id: "install-zig"
|
||||
name: golang:1
|
||||
waitFor: ['-']
|
||||
volumes:
|
||||
- name: 'zig'
|
||||
path: '/zig-tools'
|
||||
script: |
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
apt-get update && apt-get install -y xz-utils
|
||||
curl -fL "https://ziglang.org/download/0.15.2/zig-x86_64-linux-0.15.2.tar.xz" -o zig.tar.xz
|
||||
tar -xf zig.tar.xz -C /zig-tools --strip-components=1
|
||||
|
||||
- id: "install-macos-sdk"
|
||||
name: golang:1
|
||||
waitFor: ['-']
|
||||
volumes:
|
||||
- name: 'macos-sdk'
|
||||
path: '/macos-sdk'
|
||||
script: |
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
apt-get update && apt-get install -y xz-utils
|
||||
echo "Downloading macOS 14.5 SDK..."
|
||||
curl -fL -o sdk.tar.xz https://github.com/alexey-lysiuk/macos-sdk/releases/download/14.5/MacOSX14.5.tar.xz
|
||||
|
||||
mkdir -p /macos-sdk/MacOSX14.5.sdk
|
||||
echo "Unpacking macOS 14.5 SDK..."
|
||||
tar -xf sdk.tar.xz -C /macos-sdk/MacOSX14.5.sdk --strip-components=1
|
||||
|
||||
- id: "build-linux-amd64"
|
||||
name: golang:1
|
||||
waitFor:
|
||||
waitFor:
|
||||
- "install-dependencies"
|
||||
env:
|
||||
- "install-zig"
|
||||
env:
|
||||
- 'GOPATH=/gopath'
|
||||
- 'CGO_ENABLED=1'
|
||||
- 'GOOS=linux'
|
||||
- 'GOARCH=amd64'
|
||||
- 'CC=/zig-tools/zig cc -target x86_64-linux-gnu'
|
||||
- 'CXX=/zig-tools/zig c++ -target x86_64-linux-gnu'
|
||||
volumes:
|
||||
- name: 'go'
|
||||
path: '/gopath'
|
||||
- name: 'zig'
|
||||
path: '/zig-tools'
|
||||
script: |
|
||||
#!/usr/bin/env bash
|
||||
export VERSION=$(cat ./cmd/version.txt)
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
|
||||
go build -ldflags "-X github.com/googleapis/genai-toolbox/cmd.buildType=binary -X github.com/googleapis/genai-toolbox/cmd.commitSha=$(git rev-parse --short HEAD)" -o toolbox.linux.amd64
|
||||
go build -ldflags "-X github.com/googleapis/genai-toolbox/cmd.buildType=binary -X github.com/googleapis/genai-toolbox/cmd.commitSha=$(git rev-parse --short HEAD)" -o toolbox.linux.amd64
|
||||
|
||||
- id: "store-linux-amd64"
|
||||
name: "gcr.io/cloud-builders/gcloud:latest"
|
||||
@@ -63,18 +99,24 @@ steps:
|
||||
|
||||
- id: "build-linux-amd64-geminicli"
|
||||
name: golang:1
|
||||
waitFor:
|
||||
waitFor:
|
||||
- "install-dependencies"
|
||||
env:
|
||||
- "install-zig"
|
||||
env:
|
||||
- 'GOPATH=/gopath'
|
||||
- 'CGO_ENABLED=1'
|
||||
- 'GOOS=linux'
|
||||
- 'GOARCH=amd64'
|
||||
- 'CC=/zig-tools/zig cc -target x86_64-linux-gnu'
|
||||
- 'CXX=/zig-tools/zig c++ -target x86_64-linux-gnu'
|
||||
volumes:
|
||||
- name: 'go'
|
||||
path: '/gopath'
|
||||
- name: 'zig'
|
||||
path: '/zig-tools'
|
||||
script: |
|
||||
#!/usr/bin/env bash
|
||||
export VERSION=$(cat ./cmd/version.txt)
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
|
||||
go build -ldflags "-X github.com/googleapis/genai-toolbox/cmd.buildType=geminicli.binary -X github.com/googleapis/genai-toolbox/cmd.commitSha=$(git rev-parse --short HEAD)" -o toolbox.geminicli.linux.amd64
|
||||
go build -ldflags "-X github.com/googleapis/genai-toolbox/cmd.buildType=geminicli.binary -X github.com/googleapis/genai-toolbox/cmd.commitSha=$(git rev-parse --short HEAD)" -o toolbox.geminicli.linux.amd64
|
||||
|
||||
- id: "store-linux-amd64-geminicli"
|
||||
name: "gcr.io/cloud-builders/gcloud:latest"
|
||||
@@ -87,18 +129,31 @@ steps:
|
||||
|
||||
- id: "build-darwin-arm64"
|
||||
name: golang:1
|
||||
waitFor:
|
||||
waitFor:
|
||||
- "install-dependencies"
|
||||
env:
|
||||
- "install-zig"
|
||||
- "install-macos-sdk"
|
||||
env:
|
||||
- 'GOPATH=/gopath'
|
||||
- 'CGO_ENABLED=1'
|
||||
- 'GOOS=darwin'
|
||||
- 'GOARCH=arm64'
|
||||
- 'SDK_PATH=/macos-sdk/MacOSX14.5.sdk'
|
||||
- 'MACOS_MIN_VER=10.14'
|
||||
- 'CGO_LDFLAGS=-mmacosx-version-min=10.14 --sysroot /macos-sdk/MacOSX14.5.sdk -F/macos-sdk/MacOSX14.5.sdk/System/Library/Frameworks -L/usr/lib'
|
||||
- 'COMMON_FLAGS=-mmacosx-version-min=10.14 -target aarch64-macos.11.0.0-none -isysroot /macos-sdk/MacOSX14.5.sdk -iwithsysroot /usr/include -iframeworkwithsysroot /System/Library/Frameworks'
|
||||
- 'CC=/zig-tools/zig cc -mmacosx-version-min=10.14 -target aarch64-macos.11.0.0-none -isysroot /macos-sdk/MacOSX14.5.sdk -iwithsysroot /usr/include -iframeworkwithsysroot /System/Library/Frameworks'
|
||||
- 'CXX=/zig-tools/zig c++ -mmacosx-version-min=10.14 -target aarch64-macos.11.0.0-none -isysroot /macos-sdk/MacOSX14.5.sdk -iwithsysroot /usr/include -iframeworkwithsysroot /System/Library/Frameworks'
|
||||
volumes:
|
||||
- name: 'go'
|
||||
path: '/gopath'
|
||||
- name: 'zig'
|
||||
path: '/zig-tools'
|
||||
- name: 'macos-sdk'
|
||||
path: '/macos-sdk'
|
||||
script: |
|
||||
#!/usr/bin/env bash
|
||||
export VERSION=$(cat ./cmd/version.txt)
|
||||
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 \
|
||||
go build -ldflags "-X github.com/googleapis/genai-toolbox/cmd.buildType=binary -X github.com/googleapis/genai-toolbox/cmd.commitSha=$(git rev-parse --short HEAD)" -o toolbox.darwin.arm64
|
||||
go build -trimpath -buildmode=pie -ldflags "-s -w -X github.com/googleapis/genai-toolbox/cmd.buildType=binary -X github.com/googleapis/genai-toolbox/cmd.commitSha=$(git rev-parse --short HEAD)" -o toolbox.darwin.arm64
|
||||
|
||||
- id: "store-darwin-arm64"
|
||||
name: "gcr.io/cloud-builders/gcloud:latest"
|
||||
@@ -107,22 +162,36 @@ steps:
|
||||
script: |
|
||||
#!/usr/bin/env bash
|
||||
export VERSION=v$(cat ./cmd/version.txt)
|
||||
gcloud storage cp toolbox.darwin.arm64 gs://$_BUCKET_NAME/$VERSION/darwin/arm64/toolbox
|
||||
gcloud storage cp toolbox.darwin.arm64 \
|
||||
gs://$_BUCKET_NAME/$VERSION/darwin/arm64/toolbox
|
||||
|
||||
- id: "build-darwin-arm64-geminicli"
|
||||
name: golang:1
|
||||
waitFor:
|
||||
waitFor:
|
||||
- "install-dependencies"
|
||||
env:
|
||||
- "install-zig"
|
||||
- "install-macos-sdk"
|
||||
env:
|
||||
- 'GOPATH=/gopath'
|
||||
- 'CGO_ENABLED=1'
|
||||
- 'GOOS=darwin'
|
||||
- 'GOARCH=arm64'
|
||||
- 'SDK_PATH=/macos-sdk/MacOSX14.5.sdk'
|
||||
- 'MACOS_MIN_VER=10.14'
|
||||
- 'CGO_LDFLAGS=-mmacosx-version-min=10.14 --sysroot /macos-sdk/MacOSX14.5.sdk -F/macos-sdk/MacOSX14.5.sdk/System/Library/Frameworks -L/usr/lib'
|
||||
- 'COMMON_FLAGS=-mmacosx-version-min=10.14 -target aarch64-macos.11.0.0-none -isysroot /macos-sdk/MacOSX14.5.sdk -iwithsysroot /usr/include -iframeworkwithsysroot /System/Library/Frameworks'
|
||||
- 'CC=/zig-tools/zig cc -mmacosx-version-min=10.14 -target aarch64-macos.11.0.0-none -isysroot /macos-sdk/MacOSX14.5.sdk -iwithsysroot /usr/include -iframeworkwithsysroot /System/Library/Frameworks'
|
||||
- 'CXX=/zig-tools/zig c++ -mmacosx-version-min=10.14 -target aarch64-macos.11.0.0-none -isysroot /macos-sdk/MacOSX14.5.sdk -iwithsysroot /usr/include -iframeworkwithsysroot /System/Library/Frameworks'
|
||||
volumes:
|
||||
- name: 'go'
|
||||
path: '/gopath'
|
||||
- name: 'zig'
|
||||
path: '/zig-tools'
|
||||
- name: 'macos-sdk'
|
||||
path: '/macos-sdk'
|
||||
script: |
|
||||
#!/usr/bin/env bash
|
||||
export VERSION=$(cat ./cmd/version.txt)
|
||||
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 \
|
||||
go build -ldflags "-X github.com/googleapis/genai-toolbox/cmd.buildType=geminicli.binary -X github.com/googleapis/genai-toolbox/cmd.commitSha=$(git rev-parse --short HEAD)" -o toolbox.geminicli.darwin.arm64
|
||||
go build -trimpath -buildmode=pie -ldflags "-s -w -X github.com/googleapis/genai-toolbox/cmd.buildType=geminicli.binary -X github.com/googleapis/genai-toolbox/cmd.commitSha=$(git rev-parse --short HEAD)" -o toolbox.geminicli.darwin.arm64
|
||||
|
||||
- id: "store-darwin-arm64-geminicli"
|
||||
name: "gcr.io/cloud-builders/gcloud:latest"
|
||||
@@ -135,18 +204,31 @@ steps:
|
||||
|
||||
- id: "build-darwin-amd64"
|
||||
name: golang:1
|
||||
waitFor:
|
||||
waitFor:
|
||||
- "install-dependencies"
|
||||
env:
|
||||
- "install-zig"
|
||||
- "install-macos-sdk"
|
||||
env:
|
||||
- 'GOPATH=/gopath'
|
||||
- 'CGO_ENABLED=1'
|
||||
- 'GOOS=darwin'
|
||||
- 'GOARCH=amd64'
|
||||
- 'SDK_PATH=/macos-sdk/MacOSX14.5.sdk'
|
||||
- 'MACOS_MIN_VER=10.14'
|
||||
- 'CGO_LDFLAGS=-mmacosx-version-min=10.14 --sysroot /macos-sdk/MacOSX14.5.sdk -F/macos-sdk/MacOSX14.5.sdk/System/Library/Frameworks -L/usr/lib'
|
||||
- 'COMMON_FLAGS=-mmacosx-version-min=10.14 -target x86_64-macos.11.0.0-none -isysroot /macos-sdk/MacOSX14.5.sdk -iwithsysroot /usr/include -iframeworkwithsysroot /System/Library/Frameworks'
|
||||
- 'CC=/zig-tools/zig cc -mmacosx-version-min=10.14 -target x86_64-macos.11.0.0-none -isysroot /macos-sdk/MacOSX14.5.sdk -iwithsysroot /usr/include -iframeworkwithsysroot /System/Library/Frameworks'
|
||||
- 'CXX=/zig-tools/zig c++ -mmacosx-version-min=10.14 -target x86_64-macos.11.0.0-none -isysroot /macos-sdk/MacOSX14.5.sdk -iwithsysroot /usr/include -iframeworkwithsysroot /System/Library/Frameworks'
|
||||
volumes:
|
||||
- name: 'go'
|
||||
path: '/gopath'
|
||||
- name: 'zig'
|
||||
path: '/zig-tools'
|
||||
- name: 'macos-sdk'
|
||||
path: '/macos-sdk'
|
||||
script: |
|
||||
#!/usr/bin/env bash
|
||||
export VERSION=$(cat ./cmd/version.txt)
|
||||
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 \
|
||||
go build -ldflags "-X github.com/googleapis/genai-toolbox/cmd.buildType=binary -X github.com/googleapis/genai-toolbox/cmd.commitSha=$(git rev-parse --short HEAD)" -o toolbox.darwin.amd64
|
||||
go build -trimpath -buildmode=pie -ldflags "-s -w -X github.com/googleapis/genai-toolbox/cmd.buildType=binary -X github.com/googleapis/genai-toolbox/cmd.commitSha=$(git rev-parse --short HEAD)" -o toolbox.darwin.amd64
|
||||
|
||||
- id: "store-darwin-amd64"
|
||||
name: "gcr.io/cloud-builders/gcloud:latest"
|
||||
@@ -159,18 +241,31 @@ steps:
|
||||
|
||||
- id: "build-darwin-amd64-geminicli"
|
||||
name: golang:1
|
||||
waitFor:
|
||||
waitFor:
|
||||
- "install-dependencies"
|
||||
env:
|
||||
- "install-zig"
|
||||
- "install-macos-sdk"
|
||||
env:
|
||||
- 'GOPATH=/gopath'
|
||||
- 'CGO_ENABLED=1'
|
||||
- 'GOOS=darwin'
|
||||
- 'GOARCH=amd64'
|
||||
- 'SDK_PATH=/macos-sdk/MacOSX14.5.sdk'
|
||||
- 'MACOS_MIN_VER=10.14'
|
||||
- 'CGO_LDFLAGS=-mmacosx-version-min=10.14 --sysroot /macos-sdk/MacOSX14.5.sdk -F/macos-sdk/MacOSX14.5.sdk/System/Library/Frameworks -L/usr/lib'
|
||||
- 'COMMON_FLAGS=-mmacosx-version-min=10.14 -target x86_64-macos.11.0.0-none -isysroot /macos-sdk/MacOSX14.5.sdk -iwithsysroot /usr/include -iframeworkwithsysroot /System/Library/Frameworks'
|
||||
- 'CC=/zig-tools/zig cc -mmacosx-version-min=10.14 -target x86_64-macos.11.0.0-none -isysroot /macos-sdk/MacOSX14.5.sdk -iwithsysroot /usr/include -iframeworkwithsysroot /System/Library/Frameworks'
|
||||
- 'CXX=/zig-tools/zig c++ -mmacosx-version-min=10.14 -target x86_64-macos.11.0.0-none -isysroot /macos-sdk/MacOSX14.5.sdk -iwithsysroot /usr/include -iframeworkwithsysroot /System/Library/Frameworks'
|
||||
volumes:
|
||||
- name: 'go'
|
||||
path: '/gopath'
|
||||
- name: 'zig'
|
||||
path: '/zig-tools'
|
||||
- name: 'macos-sdk'
|
||||
path: '/macos-sdk'
|
||||
script: |
|
||||
#!/usr/bin/env bash
|
||||
export VERSION=$(cat ./cmd/version.txt)
|
||||
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 \
|
||||
go build -ldflags "-X github.com/googleapis/genai-toolbox/cmd.buildType=geminicli.binary -X github.com/googleapis/genai-toolbox/cmd.commitSha=$(git rev-parse --short HEAD)" -o toolbox.geminicli.darwin.amd64
|
||||
go build -trimpath -buildmode=pie -ldflags "-s -w -X github.com/googleapis/genai-toolbox/cmd.buildType=geminicli.binary -X github.com/googleapis/genai-toolbox/cmd.commitSha=$(git rev-parse --short HEAD)" -o toolbox.geminicli.darwin.amd64
|
||||
|
||||
- id: "store-darwin-amd64-geminicli"
|
||||
name: "gcr.io/cloud-builders/gcloud:latest"
|
||||
@@ -179,22 +274,29 @@ steps:
|
||||
script: |
|
||||
#!/usr/bin/env bash
|
||||
export VERSION=v$(cat ./cmd/version.txt)
|
||||
gcloud storage cp toolbox.geminicli.darwin.amd64 gs://$_BUCKET_NAME/geminicli/$VERSION/darwin/amd64/toolbox
|
||||
gcloud storage cp toolbox.geminicli.darwin.amd64 \
|
||||
gs://$_BUCKET_NAME/geminicli/$VERSION/darwin/amd64/toolbox
|
||||
|
||||
- id: "build-windows-amd64"
|
||||
name: golang:1
|
||||
waitFor:
|
||||
waitFor:
|
||||
- "install-dependencies"
|
||||
env:
|
||||
- "install-zig"
|
||||
env:
|
||||
- 'GOPATH=/gopath'
|
||||
- 'CGO_ENABLED=1'
|
||||
- 'GOOS=windows'
|
||||
- 'GOARCH=amd64'
|
||||
- 'CC=/zig-tools/zig cc -target x86_64-windows-gnu'
|
||||
- 'CXX=/zig-tools/zig c++ -target x86_64-windows-gnu'
|
||||
volumes:
|
||||
- name: 'go'
|
||||
path: '/gopath'
|
||||
- name: 'zig'
|
||||
path: '/zig-tools'
|
||||
script: |
|
||||
#!/usr/bin/env bash
|
||||
export VERSION=$(cat ./cmd/version.txt)
|
||||
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 \
|
||||
go build -ldflags "-X github.com/googleapis/genai-toolbox/cmd.buildType=binary -X github.com/googleapis/genai-toolbox/cmd.commitSha=$(git rev-parse --short HEAD)" -o toolbox.windows.amd64
|
||||
go build -ldflags "-X github.com/googleapis/genai-toolbox/cmd.buildType=binary -X github.com/googleapis/genai-toolbox/cmd.commitSha=$(git rev-parse --short HEAD)" -o toolbox.windows.amd64
|
||||
|
||||
- id: "store-windows-amd64"
|
||||
name: "gcr.io/cloud-builders/gcloud:latest"
|
||||
@@ -207,18 +309,26 @@ steps:
|
||||
|
||||
- id: "build-windows-amd64-geminicli"
|
||||
name: golang:1
|
||||
waitFor:
|
||||
waitFor:
|
||||
- "install-dependencies"
|
||||
env:
|
||||
- "install-zig"
|
||||
env:
|
||||
- 'GOPATH=/gopath'
|
||||
- 'CGO_ENABLED=1'
|
||||
- 'GOOS=windows'
|
||||
- 'GOARCH=amd64'
|
||||
- 'CC=/zig-tools/zig cc -target x86_64-windows-gnu'
|
||||
- 'CXX=/zig-tools/zig c++ -target x86_64-windows-gnu'
|
||||
volumes:
|
||||
- name: 'go'
|
||||
path: '/gopath'
|
||||
- name: 'zig'
|
||||
path: '/zig-tools'
|
||||
- name: 'macos-sdk'
|
||||
path: '/macos-sdk'
|
||||
script: |
|
||||
#!/usr/bin/env bash
|
||||
export VERSION=$(cat ./cmd/version.txt)
|
||||
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 \
|
||||
go build -ldflags "-X github.com/googleapis/genai-toolbox/cmd.buildType=geminicli.binary -X github.com/googleapis/genai-toolbox/cmd.commitSha=$(git rev-parse --short HEAD)" -o toolbox.geminicli.windows.amd64
|
||||
go build -ldflags "-X github.com/googleapis/genai-toolbox/cmd.buildType=geminicli.binary -X github.com/googleapis/genai-toolbox/cmd.commitSha=$(git rev-parse --short HEAD)" -o toolbox.geminicli.windows.amd64
|
||||
|
||||
- id: "store-windows-amd64-geminicli"
|
||||
name: "gcr.io/cloud-builders/gcloud:latest"
|
||||
@@ -243,4 +353,4 @@ substitutions:
|
||||
_AR_REPO_NAME: toolbox
|
||||
_BUCKET_NAME: genai-toolbox
|
||||
_DOCKER_URI: ${_AR_HOSTNAME}/${PROJECT_ID}/${_AR_REPO_NAME}/toolbox
|
||||
_PUSH_LATEST: "true"
|
||||
_PUSH_LATEST: "false" # Substituted in trigger
|
||||
4
.github/release-please.yml
vendored
4
.github/release-please.yml
vendored
@@ -40,12 +40,12 @@ extraFiles: [
|
||||
"gemini-extension.json",
|
||||
{
|
||||
"type": "json",
|
||||
"path": ".registry/server.json",
|
||||
"path": "server.json",
|
||||
"jsonpath": "$.version"
|
||||
},
|
||||
{
|
||||
"type": "json",
|
||||
"path": ".registry/server.json",
|
||||
"path": "server.json",
|
||||
"jsonpath": "$.packages[0].identifier"
|
||||
},
|
||||
]
|
||||
|
||||
4
.github/workflows/deploy_versioned_docs.yaml
vendored
4
.github/workflows/deploy_versioned_docs.yaml
vendored
@@ -35,7 +35,9 @@ jobs:
|
||||
ref: ${{ github.event.release.tag_name }}
|
||||
|
||||
- name: Get Version from Release Tag
|
||||
run: echo "VERSION=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
|
||||
run: echo "VERSION=${GITHUB_EVENT_RELEASE_TAG_NAME}" >> $GITHUB_ENV
|
||||
env:
|
||||
GITHUB_EVENT_RELEASE_TAG_NAME: ${{ github.event.release.tag_name }}
|
||||
|
||||
- name: Setup Hugo
|
||||
uses: peaceiris/actions-hugo@75d2e84710de30f6ff7268e08f310b60ef14033f # v3
|
||||
|
||||
79
.github/workflows/docs_deploy.yaml
vendored
79
.github/workflows/docs_deploy.yaml
vendored
@@ -1,79 +0,0 @@
|
||||
# Copyright 2025 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
name: "docs"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'docs/**'
|
||||
- 'github/workflows/docs**'
|
||||
- '.hugo/**'
|
||||
|
||||
# Allow triggering manually.
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-24.04
|
||||
defaults:
|
||||
run:
|
||||
working-directory: .hugo
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
steps:
|
||||
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
|
||||
with:
|
||||
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
|
||||
|
||||
- name: Setup Hugo
|
||||
uses: peaceiris/actions-hugo@75d2e84710de30f6ff7268e08f310b60ef14033f # v3
|
||||
with:
|
||||
hugo-version: "0.145.0"
|
||||
extended: true
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
|
||||
with:
|
||||
node-version: "22"
|
||||
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-
|
||||
|
||||
- run: npm ci
|
||||
- run: hugo --minify
|
||||
env:
|
||||
HUGO_BASEURL: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/
|
||||
HUGO_RELATIVEURLS: false
|
||||
|
||||
- name: Deploy
|
||||
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: .hugo/public
|
||||
# Do not delete previews on each production deploy.
|
||||
# CSS or JS changes will require manual clean-up.
|
||||
keep_files: true
|
||||
commit_message: "deploy: ${{ github.event.head_commit.message }}"
|
||||
26
Dockerfile
26
Dockerfile
@@ -11,10 +11,15 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Use the latest stable golang 1.x to compile to a binary
|
||||
FROM --platform=$BUILDPLATFORM golang:1 AS build
|
||||
|
||||
# Install Zig for CGO cross-compilation
|
||||
RUN apt-get update && apt-get install -y xz-utils
|
||||
RUN curl -fL "https://ziglang.org/download/0.15.2/zig-x86_64-linux-0.15.2.tar.xz" -o zig.tar.xz && \
|
||||
mkdir -p /zig && \
|
||||
tar -xf zig.tar.xz -C /zig --strip-components=1 && \
|
||||
rm zig.tar.xz
|
||||
|
||||
WORKDIR /go/src/genai-toolbox
|
||||
COPY . .
|
||||
|
||||
@@ -24,11 +29,22 @@ ARG BUILD_TYPE="container.dev"
|
||||
ARG COMMIT_SHA=""
|
||||
|
||||
RUN go get ./...
|
||||
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
|
||||
go build -ldflags "-X github.com/googleapis/genai-toolbox/cmd.buildType=${BUILD_TYPE} -X github.com/googleapis/genai-toolbox/cmd.commitSha=${COMMIT_SHA}"
|
||||
|
||||
RUN export ZIG_TARGET="" && \
|
||||
case "${TARGETARCH}" in \
|
||||
("amd64") ZIG_TARGET="x86_64-linux-gnu" ;; \
|
||||
("arm64") ZIG_TARGET="aarch64-linux-gnu" ;; \
|
||||
(*) echo "Unsupported architecture: ${TARGETARCH}" && exit 1 ;; \
|
||||
esac && \
|
||||
CGO_ENABLED=1 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
|
||||
CC="/zig/zig cc -target ${ZIG_TARGET}" \
|
||||
CXX="/zig/zig c++ -target ${ZIG_TARGET}" \
|
||||
go build \
|
||||
-ldflags "-X github.com/googleapis/genai-toolbox/cmd.buildType=${BUILD_TYPE} -X github.com/googleapis/genai-toolbox/cmd.commitSha=${COMMIT_SHA}" \
|
||||
-o genai-toolbox .
|
||||
|
||||
# Final Stage
|
||||
FROM gcr.io/distroless/static:nonroot
|
||||
FROM gcr.io/distroless/cc-debian12:nonroot
|
||||
|
||||
WORKDIR /app
|
||||
COPY --from=build --chown=nonroot /go/src/genai-toolbox/genai-toolbox /toolbox
|
||||
|
||||
@@ -163,9 +163,9 @@ To install Toolbox as a binary:
|
||||
> To install Toolbox as a binary on Windows (AMD64):
|
||||
>
|
||||
> ```powershell
|
||||
> # see releases page for other versions
|
||||
> $VERSION = "0.21.0"
|
||||
> Invoke-WebRequest -Uri "https://storage.googleapis.com/genai-toolbox/v$VERSION/windows/amd64/toolbox.exe" -OutFile "toolbox.exe"
|
||||
> :: see releases page for other versions
|
||||
> set VERSION=0.21.0
|
||||
> curl -o toolbox.exe "https://storage.googleapis.com/genai-toolbox/v%VERSION%/windows/amd64/toolbox.exe"
|
||||
> ```
|
||||
>
|
||||
> </details>
|
||||
|
||||
@@ -98,6 +98,7 @@ import (
|
||||
_ "github.com/googleapis/genai-toolbox/internal/tools/cloudsqlmssql/cloudsqlmssqlcreateinstance"
|
||||
_ "github.com/googleapis/genai-toolbox/internal/tools/cloudsqlmysql/cloudsqlmysqlcreateinstance"
|
||||
_ "github.com/googleapis/genai-toolbox/internal/tools/cloudsqlpg/cloudsqlpgcreateinstances"
|
||||
_ "github.com/googleapis/genai-toolbox/internal/tools/cloudsqlpg/cloudsqlpgupgradeprecheck"
|
||||
_ "github.com/googleapis/genai-toolbox/internal/tools/couchbase"
|
||||
_ "github.com/googleapis/genai-toolbox/internal/tools/dataform/dataformcompilelocal"
|
||||
_ "github.com/googleapis/genai-toolbox/internal/tools/dataplex/dataplexlookupentry"
|
||||
|
||||
@@ -1448,7 +1448,7 @@ func TestPrebuiltTools(t *testing.T) {
|
||||
wantToolset: server.ToolsetConfigs{
|
||||
"cloud_sql_postgres_admin_tools": tools.ToolsetConfig{
|
||||
Name: "cloud_sql_postgres_admin_tools",
|
||||
ToolNames: []string{"create_instance", "get_instance", "list_instances", "create_database", "list_databases", "create_user", "wait_for_operation"},
|
||||
ToolNames: []string{"create_instance", "get_instance", "list_instances", "create_database", "list_databases", "create_user", "wait_for_operation", "postgres_upgrade_precheck"},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
88
docs/ALLOYDBADMIN_README.md
Normal file
88
docs/ALLOYDBADMIN_README.md
Normal file
@@ -0,0 +1,88 @@
|
||||
# AlloyDB for PostgreSQL Admin MCP Server
|
||||
|
||||
The AlloyDB Model Context Protocol (MCP) Server gives AI-powered development tools the ability to work with your Google Cloud AlloyDB for PostgreSQL resources. It supports full lifecycle control, from creating clusters and instances to exploring schemas and running queries.
|
||||
|
||||
## Features
|
||||
|
||||
An editor configured to use the AlloyDB MCP server can use its AI capabilities to help you:
|
||||
|
||||
* **Provision & Manage Infrastructure**: Create and manage AlloyDB clusters, instances, and users
|
||||
|
||||
## Installation and Setup
|
||||
|
||||
### Prerequisites
|
||||
|
||||
* Download and install [MCP Toolbox](https://github.com/googleapis/genai-toolbox):
|
||||
1. **Download the Toolbox binary**:
|
||||
Download the latest binary for your operating system and architecture from the storage bucket. Check the [releases page](https://github.com/googleapis/genai-toolbox/releases) for OS and CPU architecture support:
|
||||
`https://storage.googleapis.com/genai-toolbox/v0.21.0/<os>/<arch>/toolbox`
|
||||
* Replace `<os>` with `linux`, `darwin` (macOS), or `windows`.
|
||||
* Replace `<arch>` with `amd64` (Intel) or `arm64` (Apple Silicon).
|
||||
|
||||
<!-- {x-release-please-start-version} -->
|
||||
```
|
||||
curl -L -o toolbox https://storage.googleapis.com/genai-toolbox/v0.21.0/linux/amd64/toolbox
|
||||
```
|
||||
<!-- {x-release-please-end} -->
|
||||
2. **Make it executable**:
|
||||
```bash
|
||||
chmod +x toolbox
|
||||
```
|
||||
|
||||
3. **Move binary to `/usr/local/bin/` or `/usr/bin/`**:
|
||||
```bash
|
||||
sudo mv toolbox /usr/local/bin/
|
||||
# sudo mv toolbox /usr/bin/
|
||||
```
|
||||
|
||||
**On Windows, move binary to the `WindowsApps\` folder**:
|
||||
```
|
||||
move "C:\Users\<path-to-binary>\toolbox.exe" "C:\Users\<username>\AppData\Local\Microsoft\WindowsApps\"
|
||||
```
|
||||
|
||||
**Tip:** Ensure the destination folder for your binary is included in
|
||||
your system's PATH environment variable. To check `PATH`, use `echo
|
||||
$PATH` (or `echo %PATH%` on Windows).
|
||||
|
||||
**Note:** You may need to restart Antigravity for changes to take effect.
|
||||
|
||||
* A Google Cloud project with the **AlloyDB API** enabled.
|
||||
* Ensure [Application Default Credentials](https://cloud.google.com/docs/authentication/gcloud) are available in your environment.
|
||||
* IAM Permissions:
|
||||
* AlloyDB Admin (`roles/alloydb.admin`) (for managing infrastructure)
|
||||
* Service Usage Consumer (`roles/serviceusage.serviceUsageConsumer`)
|
||||
|
||||
### Configuration
|
||||
|
||||
1. **Access the Store**: Open the MCP Store panel within the "..." dropdown at the top of the editor's side panel.
|
||||
2. **Browse and Install**: Search for "AlloyDB for PostgreSQL Admin", and click "Install".
|
||||
|
||||
## Usage
|
||||
|
||||
Once configured, the MCP server will automatically provide AlloyDB capabilities to your AI assistant. You can:
|
||||
|
||||
* "Create a new AlloyDB cluster named 'e-commerce-prod' in the 'my-gcp-project' project."
|
||||
* "Add a read-only instance to my 'e-commerce-prod' cluster."
|
||||
* "Create a new user named 'analyst' with read access to all tables."
|
||||
|
||||
## Server Capabilities
|
||||
|
||||
The AlloyDB MCP server provides the following tools:
|
||||
|
||||
| Tool Name | Description |
|
||||
|:---------------------|:-------------------------------------------------------------------|
|
||||
| `create_cluster` | Create an AlloyDB cluster. |
|
||||
| `create_instance` | Create an AlloyDB instance (PRIMARY, READ-POOL, or SECONDARY). |
|
||||
| `create_user` | Create ALLOYDB-BUILT-IN or IAM-based users for an AlloyDB cluster. |
|
||||
| `get_cluster` | Get details about an AlloyDB cluster. |
|
||||
| `get_instance` | Get details about an AlloyDB instance. |
|
||||
| `get_user` | Get details about a user in an AlloyDB cluster. |
|
||||
| `list_clusters` | List clusters in a given project and location. |
|
||||
| `list_instances` | List instances in a given project and location. |
|
||||
| `list_users` | List users in a given project and location. |
|
||||
| `wait_for_operation` | Poll the operations API until the operation is done. |
|
||||
|
||||
|
||||
## Documentation
|
||||
|
||||
For more information, visit the [AlloyDB for PostgreSQL documentation](https://cloud.google.com/alloydb/docs).
|
||||
103
docs/ALLOYDBPG_README.md
Normal file
103
docs/ALLOYDBPG_README.md
Normal file
@@ -0,0 +1,103 @@
|
||||
# AlloyDB for PostgreSQL MCP Server
|
||||
|
||||
The AlloyDB Model Context Protocol (MCP) Server gives AI-powered development tools the ability to work with your Google Cloud AlloyDB for PostgreSQL resources. It supports full lifecycle control, from exploring schemas and running queries to monitoring your database.
|
||||
|
||||
## Features
|
||||
|
||||
An editor configured to use the AlloyDB MCP server can use its AI capabilities to help you:
|
||||
|
||||
- **Explore Schemas and Data** - List tables, get table details, and view data
|
||||
- **Execute SQL** - Run SQL queries directly from your editor
|
||||
- **Monitor Performance** - View active queries, query plans, and other performance metrics (via observability tools)
|
||||
- **Manage Extensions** - List available and installed PostgreSQL extensions
|
||||
|
||||
## Installation and Setup
|
||||
|
||||
### Prerequisites
|
||||
|
||||
* Download and install [MCP Toolbox](https://github.com/googleapis/genai-toolbox):
|
||||
1. **Download the Toolbox binary**:
|
||||
Download the latest binary for your operating system and architecture from the storage bucket. Check the [releases page](https://github.com/googleapis/genai-toolbox/releases) for OS and CPU architecture support:
|
||||
`https://storage.googleapis.com/genai-toolbox/v0.21.0/<os>/<arch>/toolbox`
|
||||
* Replace `<os>` with `linux`, `darwin` (macOS), or `windows`.
|
||||
* Replace `<arch>` with `amd64` (Intel) or `arm64` (Apple Silicon).
|
||||
|
||||
<!-- {x-release-please-start-version} -->
|
||||
```
|
||||
curl -L -o toolbox https://storage.googleapis.com/genai-toolbox/v0.21.0/linux/amd64/toolbox
|
||||
```
|
||||
<!-- {x-release-please-end} -->
|
||||
2. **Make it executable**:
|
||||
```bash
|
||||
chmod +x toolbox
|
||||
```
|
||||
|
||||
3. **Move binary to `/usr/local/bin/` or `/usr/bin/`**:
|
||||
```bash
|
||||
sudo mv toolbox /usr/local/bin/
|
||||
# sudo mv toolbox /usr/bin/
|
||||
```
|
||||
|
||||
**On Windows, move binary to the `WindowsApps\` folder**:
|
||||
```
|
||||
move "C:\Users\<path-to-binary>\toolbox.exe" "C:\Users\<username>\AppData\Local\Microsoft\WindowsApps\"
|
||||
```
|
||||
|
||||
**Tip:** Ensure the destination folder for your binary is included in
|
||||
your system's PATH environment variable. To check `PATH`, use `echo
|
||||
$PATH` (or `echo %PATH%` on Windows).
|
||||
|
||||
**Note:** You may need to restart Antigravity for changes to take effect.
|
||||
|
||||
* A Google Cloud project with the **AlloyDB API** enabled.
|
||||
* Ensure [Application Default Credentials](https://cloud.google.com/docs/authentication/gcloud) are available in your environment.
|
||||
* IAM Permissions:
|
||||
* AlloyDB Client (`roles/alloydb.client`) (for connecting and querying)
|
||||
* Service Usage Consumer (`roles/serviceusage.serviceUsageConsumer`)
|
||||
|
||||
### Configuration
|
||||
|
||||
1. **Access the Store**: Open the MCP Store panel within the "..." dropdown at the top of the editor's side panel.
|
||||
2. **Browse and Install**: Search for "AlloyDB for PostgreSQL", and click "Install".
|
||||
3. **Configuration**: The following configuration is needed for the server:
|
||||
* AlloyDB Project ID: The GCP project ID.
|
||||
* AlloyDB Region: The region of your AlloyDB instance.
|
||||
* AlloyDB Cluster ID: The ID of your AlloyDB cluster.
|
||||
* AlloyDB Instance ID: The ID of your AlloyDB instance.
|
||||
* AlloyDB Database Name: The name of the database.
|
||||
* AlloyDB Database User: (Optional) The database username. Defaults to IAM authentication if unspecified.
|
||||
* AlloyDB Database Password: (Optional) The password for the database user. Defaults to IAM authentication if unspecified.
|
||||
* AlloyDB IP Type: (Optional) The IP type i.e. “Public” or “Private”. Defaults to "Public" if unspecified.
|
||||
|
||||
> [!NOTE]
|
||||
> If your AlloyDB instance uses private IPs, you must run the MCP server in the same Virtual Private Cloud (VPC) network.
|
||||
|
||||
## Usage
|
||||
|
||||
Once configured, the MCP server will automatically provide AlloyDB capabilities to your AI assistant. You can:
|
||||
|
||||
* "Show me all tables in the 'orders' database."
|
||||
* "What are the columns in the 'products' table?"
|
||||
* "How many orders were placed in the last 30 days?"
|
||||
|
||||
## Server Capabilities
|
||||
|
||||
The AlloyDB MCP server provides the following tools:
|
||||
|
||||
| Tool Name | Description |
|
||||
|:---------------------------------|:-----------------------------------------------------------|
|
||||
| `list_tables` | Lists detailed schema information for user-created tables. |
|
||||
| `execute_sql` | Executes a SQL query. |
|
||||
| `list_active_queries` | List currently running queries. |
|
||||
| `list_available_extensions` | List available extensions for installation. |
|
||||
| `list_installed_extensions` | List installed extensions. |
|
||||
| `get_query_plan` | Get query plan for a SQL statement. |
|
||||
| `list_autovacuum_configurations` | List autovacuum configurations and their values. |
|
||||
| `list_memory_configurations` | List memory configurations and their values. |
|
||||
| `list_top_bloated_tables` | List top bloated tables. |
|
||||
| `list_replication_slots` | List replication slots. |
|
||||
| `list_invalid_indexes` | List invalid indexes. |
|
||||
|
||||
## Documentation
|
||||
|
||||
For more information, visit the [AlloyDB for PostgreSQL documentation](https://cloud.google.com/alloydb/docs).
|
||||
96
docs/BIGQUERY_README.md
Normal file
96
docs/BIGQUERY_README.md
Normal file
@@ -0,0 +1,96 @@
|
||||
# BigQuery MCP Server
|
||||
|
||||
The BigQuery Model Context Protocol (MCP) Server enables AI-powered development tools to seamlessly connect, interact, and generate data insights with your BigQuery datasets and data using natural language commands.
|
||||
|
||||
## Features
|
||||
|
||||
An editor configured to use the BigQuery MCP server can use its AI capabilities to help you:
|
||||
|
||||
- **Natural Language to Data Analytics:** Easily find required BigQuery tables and ask analytical questions in plain English.
|
||||
- **Seamless Workflow:** Stay within your CLI, eliminating the need to constantly switch to the GCP console for generating analytical insights.
|
||||
- **Run Advanced Analytics:** Generate forecasts and perform contribution analysis using built-in advanced tools.
|
||||
|
||||
## Installation and Setup
|
||||
|
||||
### Prerequisites
|
||||
|
||||
* Download and install [MCP Toolbox](https://github.com/googleapis/genai-toolbox):
|
||||
1. **Download the Toolbox binary**:
|
||||
Download the latest binary for your operating system and architecture from the storage bucket. Check the [releases page](https://github.com/googleapis/genai-toolbox/releases) for OS and CPU architecture support:
|
||||
`https://storage.googleapis.com/genai-toolbox/v0.21.0/<os>/<arch>/toolbox`
|
||||
* Replace `<os>` with `linux`, `darwin` (macOS), or `windows`.
|
||||
* Replace `<arch>` with `amd64` (Intel) or `arm64` (Apple Silicon).
|
||||
|
||||
<!-- {x-release-please-start-version} -->
|
||||
```
|
||||
curl -L -o toolbox https://storage.googleapis.com/genai-toolbox/v0.21.0/linux/amd64/toolbox
|
||||
```
|
||||
<!-- {x-release-please-end} -->
|
||||
2. **Make it executable**:
|
||||
```bash
|
||||
chmod +x toolbox
|
||||
```
|
||||
|
||||
3. **Move binary to `/usr/local/bin/` or `/usr/bin/`**:
|
||||
```bash
|
||||
sudo mv toolbox /usr/local/bin/
|
||||
# sudo mv toolbox /usr/bin/
|
||||
```
|
||||
|
||||
**On Windows, move binary to the `WindowsApps\` folder**:
|
||||
```
|
||||
move "C:\Users\<path-to-binary>\toolbox.exe" "C:\Users\<username>\AppData\Local\Microsoft\WindowsApps\"
|
||||
```
|
||||
|
||||
**Tip:** Ensure the destination folder for your binary is included in
|
||||
your system's PATH environment variable. To check `PATH`, use `echo
|
||||
$PATH` (or `echo %PATH%` on Windows).
|
||||
|
||||
**Note:** You may need to restart Antigravity for changes to take effect.
|
||||
|
||||
* A Google Cloud project with the **BigQuery API** enabled.
|
||||
* Ensure [Application Default Credentials](https://cloud.google.com/docs/authentication/gcloud) are available in your environment.
|
||||
* IAM Permissions:
|
||||
* BigQuery User (`roles/bigquery.user`)
|
||||
|
||||
### Configuration
|
||||
|
||||
1. **Access the Store**: Open the MCP Store panel within the "..." dropdown at the top of the editor's side panel.
|
||||
2. **Browse and Install**: Search for "BigQuery", and click "Install".
|
||||
3. **Configuration**: The following configuration is needed for the server:
|
||||
* BigQuery Project ID: The GCP project ID.
|
||||
* BigQuery Location: (Optional) The location of your BigQuery dataset (e.g. "US", "EU").
|
||||
|
||||
### Usage
|
||||
|
||||
Once configured, the MCP server will automatically provide BigQuery capabilities to your AI assistant. You can:
|
||||
|
||||
|
||||
* **Find Data:**
|
||||
|
||||
* "Find tables related to PyPi downloads"
|
||||
* "Find tables related to Google analytics data in the dataset bigquery-public-data"
|
||||
|
||||
* **Generate Analytics and Insights:**
|
||||
|
||||
* "Using bigquery-public-data.pypi.file_downloads show me the top 10 downloaded pypi packages this month."
|
||||
* "Using bigquery-public-data.pypi.file_downloads can you forecast downloads for the last four months of 2025 for package urllib3?"
|
||||
|
||||
## Server Capabilities
|
||||
|
||||
The BigQuery MCP server provides the following tools:
|
||||
|
||||
| Tool Name | Description |
|
||||
|:-----------------------|:----------------------------------------------------------------|
|
||||
| `execute_sql` | Executes a SQL query. |
|
||||
| `forecast` | Forecast time series data. |
|
||||
| `get_dataset_info` | Get dataset metadata. |
|
||||
| `get_table_info` | Get table metadata. |
|
||||
| `list_dataset_ids` | Lists dataset IDs in the database. |
|
||||
| `list_table_ids` | Lists table IDs in the database. |
|
||||
| `analyze_contribution` | Perform contribution analysis, also called key driver analysis. |
|
||||
| `search_catalog` | Search for tables based on the provided query. |
|
||||
|
||||
## Documentation
|
||||
|
||||
For more information, visit the [BigQuery documentation](https://cloud.google.com/bigquery/docs).
|
||||
83
docs/CLOUDSQLMSSQLADMIN_README.md
Normal file
83
docs/CLOUDSQLMSSQLADMIN_README.md
Normal file
@@ -0,0 +1,83 @@
|
||||
# Cloud SQL for SQL Server Admin MCP Server
|
||||
|
||||
The Cloud SQL for SQL Server Model Context Protocol (MCP) Server gives AI-powered development tools the ability to work with your Google Cloud SQL for SQL Server databases. It supports connecting to instances, exploring schemas, and running queries.
|
||||
|
||||
## Features
|
||||
|
||||
An editor configured to use the Cloud SQL for SQL Server MCP server can use its AI capabilities to help you:
|
||||
|
||||
- **Provision & Manage Infrastructure** - Create and manage Cloud SQL instances and users
|
||||
|
||||
## Installation and Setup
|
||||
|
||||
### Prerequisites
|
||||
|
||||
* Download and install [MCP Toolbox](https://github.com/googleapis/genai-toolbox):
|
||||
1. **Download the Toolbox binary**:
|
||||
Download the latest binary for your operating system and architecture from the storage bucket. Check the [releases page](https://github.com/googleapis/genai-toolbox/releases) for OS and CPU architecture support:
|
||||
`https://storage.googleapis.com/genai-toolbox/v0.21.0/<os>/<arch>/toolbox`
|
||||
* Replace `<os>` with `linux`, `darwin` (macOS), or `windows`.
|
||||
* Replace `<arch>` with `amd64` (Intel) or `arm64` (Apple Silicon).
|
||||
|
||||
<!-- {x-release-please-start-version} -->
|
||||
```
|
||||
curl -L -o toolbox https://storage.googleapis.com/genai-toolbox/v0.21.0/linux/amd64/toolbox
|
||||
```
|
||||
<!-- {x-release-please-end} -->
|
||||
2. **Make it executable**:
|
||||
```bash
|
||||
chmod +x toolbox
|
||||
```
|
||||
|
||||
3. **Move binary to `/usr/local/bin/` or `/usr/bin/`**:
|
||||
```bash
|
||||
sudo mv toolbox /usr/local/bin/
|
||||
# sudo mv toolbox /usr/bin/
|
||||
```
|
||||
|
||||
**On Windows, move binary to the `WindowsApps\` folder**:
|
||||
```
|
||||
move "C:\Users\<path-to-binary>\toolbox.exe" "C:\Users\<username>\AppData\Local\Microsoft\WindowsApps\"
|
||||
```
|
||||
|
||||
**Tip:** Ensure the destination folder for your binary is included in
|
||||
your system's PATH environment variable. To check `PATH`, use `echo
|
||||
$PATH` (or `echo %PATH%` on Windows).
|
||||
|
||||
**Note:** You may need to restart Antigravity for changes to take effect.
|
||||
|
||||
* A Google Cloud project with the **Cloud SQL Admin API** enabled.
|
||||
* Ensure [Application Default Credentials](https://cloud.google.com/docs/authentication/gcloud) are available in your environment.
|
||||
* IAM Permissions:
|
||||
* Cloud SQL Viewer (`roles/cloudsql.viewer`)
|
||||
* Cloud SQL Admin (`roles/cloudsql.admin`)
|
||||
|
||||
### Configuration
|
||||
|
||||
1. **Access the Store**: Open the MCP Store panel within the "..." dropdown at the top of the editor's side panel.
|
||||
2. **Browse and Install**: Search for "Cloud SQL for SQL Server Admin", and click "Install".
|
||||
|
||||
## Usage
|
||||
|
||||
Once configured, the MCP server will automatically provide Cloud SQL for SQL Server capabilities to your AI assistant. You can:
|
||||
|
||||
* "Create a new Cloud SQL for SQL Server instance named 'e-commerce-prod' in the 'my-gcp-project' project."
|
||||
* "Create a new user named 'analyst' with read access to all tables."
|
||||
|
||||
## Server Capabilities
|
||||
|
||||
The Cloud SQL for SQL Server MCP server provides the following tools:
|
||||
|
||||
| Tool Name | Description |
|
||||
|:---------------------|:-------------------------------------------------------|
|
||||
| `create_instance` | Create an instance (PRIMARY, READ-POOL, or SECONDARY). |
|
||||
| `create_user` | Create BUILT-IN or IAM-based users for an instance. |
|
||||
| `get_instance` | Get details about an instance. |
|
||||
| `get_user` | Get details about a user in an instance. |
|
||||
| `list_instances` | List instances in a given project and location. |
|
||||
| `list_users` | List users in a given project and location. |
|
||||
| `wait_for_operation` | Poll the operations API until the operation is done. |
|
||||
|
||||
## Documentation
|
||||
|
||||
For more information, visit the [Cloud SQL for SQL Server documentation](https://cloud.google.com/sql/docs/sqlserver).
|
||||
90
docs/CLOUDSQLMSSQL_README.md
Normal file
90
docs/CLOUDSQLMSSQL_README.md
Normal file
@@ -0,0 +1,90 @@
|
||||
# Cloud SQL for SQL Server MCP Server
|
||||
|
||||
The Cloud SQL for SQL Server Model Context Protocol (MCP) Server gives AI-powered development tools the ability to work with your Google Cloud SQL for SQL Server databases. It supports connecting to instances, exploring schemas, and running queries.
|
||||
|
||||
## Features
|
||||
|
||||
An editor configured to use the Cloud SQL for SQL Server MCP server can use its AI capabilities to help you:
|
||||
|
||||
- **Query Data** - Execute SQL queries
|
||||
- **Explore Schema** - List tables and view schema details
|
||||
|
||||
## Installation and Setup
|
||||
|
||||
### Prerequisites
|
||||
|
||||
* Download and install [MCP Toolbox](https://github.com/googleapis/genai-toolbox):
|
||||
1. **Download the Toolbox binary**:
|
||||
Download the latest binary for your operating system and architecture from the storage bucket. Check the [releases page](https://github.com/googleapis/genai-toolbox/releases) for OS and CPU architecture support:
|
||||
`https://storage.googleapis.com/genai-toolbox/v0.21.0/<os>/<arch>/toolbox`
|
||||
* Replace `<os>` with `linux`, `darwin` (macOS), or `windows`.
|
||||
* Replace `<arch>` with `amd64` (Intel) or `arm64` (Apple Silicon).
|
||||
|
||||
<!-- {x-release-please-start-version} -->
|
||||
```
|
||||
curl -L -o toolbox https://storage.googleapis.com/genai-toolbox/v0.21.0/linux/amd64/toolbox
|
||||
```
|
||||
<!-- {x-release-please-end} -->
|
||||
2. **Make it executable**:
|
||||
```bash
|
||||
chmod +x toolbox
|
||||
```
|
||||
|
||||
3. **Move binary to `/usr/local/bin/` or `/usr/bin/`**:
|
||||
```bash
|
||||
sudo mv toolbox /usr/local/bin/
|
||||
# sudo mv toolbox /usr/bin/
|
||||
```
|
||||
|
||||
**On Windows, move binary to the `WindowsApps\` folder**:
|
||||
```
|
||||
move "C:\Users\<path-to-binary>\toolbox.exe" "C:\Users\<username>\AppData\Local\Microsoft\WindowsApps\"
|
||||
```
|
||||
|
||||
**Tip:** Ensure the destination folder for your binary is included in
|
||||
your system's PATH environment variable. To check `PATH`, use `echo
|
||||
$PATH` (or `echo %PATH%` on Windows).
|
||||
|
||||
**Note:** You may need to restart Antigravity for changes to take effect.
|
||||
|
||||
* A Google Cloud project with the **Cloud SQL Admin API** enabled.
|
||||
* Ensure [Application Default Credentials](https://cloud.google.com/docs/authentication/gcloud) are available in your environment.
|
||||
* IAM Permissions:
|
||||
* Cloud SQL Client (`roles/cloudsql.client`)
|
||||
|
||||
### Configuration
|
||||
|
||||
1. **Access the Store**: Open the MCP Store panel within the "..." dropdown at the top of the editor's side panel.
|
||||
2. **Browse and Install**: Search for "Cloud SQL for SQL Server", and click "Install".
|
||||
3. **Configuration**: The following configuration is needed for the server:
|
||||
* Cloud SQL Project ID: The GCP project ID.
|
||||
* Cloud SQL Region: The region of your Cloud SQL instance.
|
||||
* Cloud SQL Instance ID: The ID of your Cloud SQL instance.
|
||||
* Cloud SQL Database Name: The name of the database.
|
||||
* Cloud SQL Database User: The database username.
|
||||
* Cloud SQL Database Password: The password for the database user.
|
||||
* Cloud SQL IP Type: (Optional) The IP type i.e. “Public” or “Private”. Defaults to "Public" if unspecified.
|
||||
|
||||
> [!NOTE]
|
||||
> If your instance uses private IPs, you must run the MCP server in the same Virtual Private Cloud (VPC) network.
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Once configured, the MCP server will automatically provide Cloud SQL for SQL Server capabilities to your AI assistant. You can:
|
||||
|
||||
* "Select top 10 rows from the customers table."
|
||||
* "List all tables in the database."
|
||||
|
||||
## Server Capabilities
|
||||
|
||||
The Cloud SQL for SQL Server MCP server provides the following tools:
|
||||
|
||||
| Tool Name | Description |
|
||||
|:--------------|:-----------------------------------------------------------|
|
||||
| `execute_sql` | Use this tool to execute SQL. |
|
||||
| `list_tables` | Lists detailed schema information for user-created tables. |
|
||||
|
||||
## Documentation
|
||||
|
||||
For more information, visit the [Cloud SQL for SQL Server documentation](https://cloud.google.com/sql/docs/sqlserver).
|
||||
83
docs/CLOUDSQLMYSQLADMIN_README.md
Normal file
83
docs/CLOUDSQLMYSQLADMIN_README.md
Normal file
@@ -0,0 +1,83 @@
|
||||
# Cloud SQL for MySQL Admin MCP Server
|
||||
|
||||
The Cloud SQL for MySQL Model Context Protocol (MCP) Server gives AI-powered development tools the ability to work with your Google Cloud SQL for MySQL databases. It supports connecting to instances, exploring schemas, and running queries.
|
||||
|
||||
## Features
|
||||
|
||||
An editor configured to use the Cloud SQL for MySQL MCP server can use its AI capabilities to help you:
|
||||
|
||||
- **Provision & Manage Infrastructure** - Create and manage Cloud SQL instances and users
|
||||
|
||||
## Installation and Setup
|
||||
|
||||
### Prerequisites
|
||||
|
||||
* Download and install [MCP Toolbox](https://github.com/googleapis/genai-toolbox):
|
||||
1. **Download the Toolbox binary**:
|
||||
Download the latest binary for your operating system and architecture from the storage bucket. Check the [releases page](https://github.com/googleapis/genai-toolbox/releases) for OS and CPU architecture support:
|
||||
`https://storage.googleapis.com/genai-toolbox/v0.21.0/<os>/<arch>/toolbox`
|
||||
* Replace `<os>` with `linux`, `darwin` (macOS), or `windows`.
|
||||
* Replace `<arch>` with `amd64` (Intel) or `arm64` (Apple Silicon).
|
||||
|
||||
<!-- {x-release-please-start-version} -->
|
||||
```
|
||||
curl -L -o toolbox https://storage.googleapis.com/genai-toolbox/v0.21.0/linux/amd64/toolbox
|
||||
```
|
||||
<!-- {x-release-please-end} -->
|
||||
2. **Make it executable**:
|
||||
```bash
|
||||
chmod +x toolbox
|
||||
```
|
||||
|
||||
3. **Move binary to `/usr/local/bin/` or `/usr/bin/`**:
|
||||
```bash
|
||||
sudo mv toolbox /usr/local/bin/
|
||||
# sudo mv toolbox /usr/bin/
|
||||
```
|
||||
|
||||
**On Windows, move binary to the `WindowsApps\` folder**:
|
||||
```
|
||||
move "C:\Users\<path-to-binary>\toolbox.exe" "C:\Users\<username>\AppData\Local\Microsoft\WindowsApps\"
|
||||
```
|
||||
|
||||
**Tip:** Ensure the destination folder for your binary is included in
|
||||
your system's PATH environment variable. To check `PATH`, use `echo
|
||||
$PATH` (or `echo %PATH%` on Windows).
|
||||
|
||||
**Note:** You may need to restart Antigravity for changes to take effect.
|
||||
|
||||
* A Google Cloud project with the **Cloud SQL Admin API** enabled.
|
||||
* Ensure [Application Default Credentials](https://cloud.google.com/docs/authentication/gcloud) are available in your environment.
|
||||
* IAM Permissions:
|
||||
* Cloud SQL Viewer (`roles/cloudsql.viewer`)
|
||||
* Cloud SQL Admin (`roles/cloudsql.admin`)
|
||||
|
||||
### Configuration
|
||||
|
||||
1. **Access the Store**: Open the MCP Store panel within the "..." dropdown at the top of the editor's side panel.
|
||||
2. **Browse and Install**: Search for "Cloud SQL for MySQL Admin", and click "Install".
|
||||
|
||||
## Usage
|
||||
|
||||
Once configured, the MCP server will automatically provide Cloud SQL for MySQL capabilities to your AI assistant. You can:
|
||||
|
||||
* "Create a new Cloud SQL for MySQL instance named 'e-commerce-prod' in the 'my-gcp-project' project."
|
||||
* "Create a new user named 'analyst' with read access to all tables."
|
||||
|
||||
## Server Capabilities
|
||||
|
||||
The Cloud SQL for MySQL MCP server provides the following tools:
|
||||
|
||||
| Tool Name | Description |
|
||||
|:---------------------|:-------------------------------------------------------|
|
||||
| `create_instance` | Create an instance (PRIMARY, READ-POOL, or SECONDARY). |
|
||||
| `create_user` | Create BUILT-IN or IAM-based users for an instance. |
|
||||
| `get_instance` | Get details about an instance. |
|
||||
| `get_user` | Get details about a user in an instance. |
|
||||
| `list_instances` | List instances in a given project and location. |
|
||||
| `list_users` | List users in a given project and location. |
|
||||
| `wait_for_operation` | Poll the operations API until the operation is done. |
|
||||
|
||||
## Documentation
|
||||
|
||||
For more information, visit the [Cloud SQL for MySQL documentation](https://cloud.google.com/sql/docs/mysql).
|
||||
96
docs/CLOUDSQLMYSQL_README.md
Normal file
96
docs/CLOUDSQLMYSQL_README.md
Normal file
@@ -0,0 +1,96 @@
|
||||
# Cloud SQL for MySQL MCP Server
|
||||
|
||||
The Cloud SQL for MySQL Model Context Protocol (MCP) Server gives AI-powered development tools the ability to work with your Google Cloud SQL for MySQL databases. It supports connecting to instances, exploring schemas, and running queries.
|
||||
|
||||
## Features
|
||||
|
||||
An editor configured to use the Cloud SQL for MySQL MCP server can use its AI capabilities to help you:
|
||||
|
||||
- **Query Data** - Execute SQL queries and analyze query plans
|
||||
- **Explore Schema** - List tables and view schema details
|
||||
- **Database Maintenance** - Check for fragmentation and missing indexes
|
||||
- **Monitor Performance** - View active queries
|
||||
|
||||
## Installation and Setup
|
||||
|
||||
### Prerequisites
|
||||
|
||||
* Download and install [MCP Toolbox](https://github.com/googleapis/genai-toolbox):
|
||||
1. **Download the Toolbox binary**:
|
||||
Download the latest binary for your operating system and architecture from the storage bucket. Check the [releases page](https://github.com/googleapis/genai-toolbox/releases) for OS and CPU architecture support:
|
||||
`https://storage.googleapis.com/genai-toolbox/v0.21.0/<os>/<arch>/toolbox`
|
||||
* Replace `<os>` with `linux`, `darwin` (macOS), or `windows`.
|
||||
* Replace `<arch>` with `amd64` (Intel) or `arm64` (Apple Silicon).
|
||||
|
||||
<!-- {x-release-please-start-version} -->
|
||||
```
|
||||
curl -L -o toolbox https://storage.googleapis.com/genai-toolbox/v0.21.0/linux/amd64/toolbox
|
||||
```
|
||||
<!-- {x-release-please-end} -->
|
||||
2. **Make it executable**:
|
||||
```bash
|
||||
chmod +x toolbox
|
||||
```
|
||||
|
||||
3. **Move binary to `/usr/local/bin/` or `/usr/bin/`**:
|
||||
```bash
|
||||
sudo mv toolbox /usr/local/bin/
|
||||
# sudo mv toolbox /usr/bin/
|
||||
```
|
||||
|
||||
**On Windows, move binary to the `WindowsApps\` folder**:
|
||||
```
|
||||
move "C:\Users\<path-to-binary>\toolbox.exe" "C:\Users\<username>\AppData\Local\Microsoft\WindowsApps\"
|
||||
```
|
||||
|
||||
**Tip:** Ensure the destination folder for your binary is included in
|
||||
your system's PATH environment variable. To check `PATH`, use `echo
|
||||
$PATH` (or `echo %PATH%` on Windows).
|
||||
|
||||
**Note:** You may need to restart Antigravity for changes to take effect.
|
||||
|
||||
* A Google Cloud project with the **Cloud SQL Admin API** enabled.
|
||||
* Ensure [Application Default Credentials](https://cloud.google.com/docs/authentication/gcloud) are available in your environment.
|
||||
* IAM Permissions:
|
||||
* Cloud SQL Client (`roles/cloudsql.client`)
|
||||
|
||||
### Configuration
|
||||
|
||||
1. **Access the Store**: Open the MCP Store panel within the "..." dropdown at the top of the editor's side panel.
|
||||
2. **Browse and Install**: Search for "Cloud SQL for MySQL", and click "Install".
|
||||
3. **Configuration**: The following configuration is needed for the server:
|
||||
* Cloud SQL Project ID: The GCP project ID.
|
||||
* Cloud SQL Region: The region of your Cloud SQL instance.
|
||||
* Cloud SQL Instance ID: The ID of your Cloud SQL instance.
|
||||
* Cloud SQL Database Name: The name of the database.
|
||||
* Cloud SQL Database User: The database username.
|
||||
* Cloud SQL Database Password: The password for the database user.
|
||||
* Cloud SQL IP Type: (Optional) The IP type i.e. “Public” or “Private”. Defaults to "Public" if unspecified.
|
||||
|
||||
> [!NOTE]
|
||||
> If your instance uses private IPs, you must run the MCP server in the same Virtual Private Cloud (VPC) network.
|
||||
|
||||
## Usage
|
||||
|
||||
Once configured, the MCP server will automatically provide Cloud SQL for MySQL capabilities to your AI assistant. You can:
|
||||
|
||||
* "Show me the schema for the 'orders' table."
|
||||
* "List the top 10 active queries."
|
||||
* "Check for tables missing unique indexes."
|
||||
|
||||
## Server Capabilities
|
||||
|
||||
The Cloud SQL for MySQL MCP server provides the following tools:
|
||||
|
||||
| Tool Name | Description |
|
||||
|:-------------------------------------|:------------------------------------------------------------------------|
|
||||
| `execute_sql` | Use this tool to execute SQL. |
|
||||
| `list_active_queries` | Lists top N ongoing queries from processlist and innodb_trx. |
|
||||
| `get_query_plan` | Provide information about how MySQL executes a SQL statement (EXPLAIN). |
|
||||
| `list_tables` | Lists detailed schema information for user-created tables. |
|
||||
| `list_tables_missing_unique_indexes` | Find tables that do not have primary or unique key constraint. |
|
||||
| `list_table_fragmentation` | List table fragmentation in MySQL. |
|
||||
|
||||
## Documentation
|
||||
|
||||
For more information, visit the [Cloud SQL for MySQL documentation](https://cloud.google.com/sql/docs/mysql).
|
||||
83
docs/CLOUDSQLPGADMIN_README.md
Normal file
83
docs/CLOUDSQLPGADMIN_README.md
Normal file
@@ -0,0 +1,83 @@
|
||||
# Cloud SQL for PostgreSQL Admin MCP Server
|
||||
|
||||
The Cloud SQL for PostgreSQL Model Context Protocol (MCP) Server gives AI-powered development tools the ability to work with your Google Cloud SQL for PostgreSQL databases. It supports connecting to instances, exploring schemas, running queries, and analyzing performance.
|
||||
|
||||
## Features
|
||||
|
||||
An editor configured to use the Cloud SQL for PostgreSQL MCP server can use its AI capabilities to help you:
|
||||
|
||||
- **Provision & Manage Infrastructure** - Create and manage Cloud SQL instances and users
|
||||
|
||||
## Installation and Setup
|
||||
|
||||
### Prerequisites
|
||||
|
||||
* Download and install [MCP Toolbox](https://github.com/googleapis/genai-toolbox):
|
||||
1. **Download the Toolbox binary**:
|
||||
Download the latest binary for your operating system and architecture from the storage bucket. Check the [releases page](https://github.com/googleapis/genai-toolbox/releases) for OS and CPU architecture support:
|
||||
`https://storage.googleapis.com/genai-toolbox/v0.21.0/<os>/<arch>/toolbox`
|
||||
* Replace `<os>` with `linux`, `darwin` (macOS), or `windows`.
|
||||
* Replace `<arch>` with `amd64` (Intel) or `arm64` (Apple Silicon).
|
||||
|
||||
<!-- {x-release-please-start-version} -->
|
||||
```
|
||||
curl -L -o toolbox https://storage.googleapis.com/genai-toolbox/v0.21.0/linux/amd64/toolbox
|
||||
```
|
||||
<!-- {x-release-please-end} -->
|
||||
2. **Make it executable**:
|
||||
```bash
|
||||
chmod +x toolbox
|
||||
```
|
||||
|
||||
3. **Move binary to `/usr/local/bin/` or `/usr/bin/`**:
|
||||
```bash
|
||||
sudo mv toolbox /usr/local/bin/
|
||||
# sudo mv toolbox /usr/bin/
|
||||
```
|
||||
|
||||
**On Windows, move binary to the `WindowsApps\` folder**:
|
||||
```
|
||||
move "C:\Users\<path-to-binary>\toolbox.exe" "C:\Users\<username>\AppData\Local\Microsoft\WindowsApps\"
|
||||
```
|
||||
|
||||
**Tip:** Ensure the destination folder for your binary is included in
|
||||
your system's PATH environment variable. To check `PATH`, use `echo
|
||||
$PATH` (or `echo %PATH%` on Windows).
|
||||
|
||||
**Note:** You may need to restart Antigravity for changes to take effect.
|
||||
|
||||
* A Google Cloud project with the **Cloud SQL Admin API** enabled.
|
||||
* Ensure [Application Default Credentials](https://cloud.google.com/docs/authentication/gcloud) are available in your environment.
|
||||
* IAM Permissions:
|
||||
* Cloud SQL Viewer (`roles/cloudsql.viewer`)
|
||||
* Cloud SQL Admin (`roles/cloudsql.admin`)
|
||||
|
||||
### Configuration
|
||||
|
||||
1. **Access the Store**: Open the MCP Store panel within the "..." dropdown at the top of the editor's side panel.
|
||||
2. **Browse and Install**: Search for "Cloud SQL for PostgreSQL Admin", and click "Install".
|
||||
|
||||
## Usage
|
||||
|
||||
Once configured, the MCP server will automatically provide Cloud SQL for PostgreSQL capabilities to your AI assistant. You can:
|
||||
|
||||
* "Create a new Cloud SQL for Postgres instance named 'e-commerce-prod' in the 'my-gcp-project' project."
|
||||
* "Create a new user named 'analyst' with read access to all tables."
|
||||
|
||||
## Server Capabilities
|
||||
|
||||
The Cloud SQL for PostgreSQL MCP server provides the following tools:
|
||||
|
||||
| Tool Name | Description |
|
||||
|:---------------------|:-------------------------------------------------------|
|
||||
| `create_instance` | Create an instance (PRIMARY, READ-POOL, or SECONDARY). |
|
||||
| `create_user` | Create BUILT-IN or IAM-based users for an instance. |
|
||||
| `get_instance` | Get details about an instance. |
|
||||
| `get_user` | Get details about a user in an instance. |
|
||||
| `list_instances` | List instances in a given project and location. |
|
||||
| `list_users` | List users in a given project and location. |
|
||||
| `wait_for_operation` | Poll the operations API until the operation is done. |
|
||||
|
||||
## Documentation
|
||||
|
||||
For more information, visit the [Cloud SQL for PostgreSQL documentation](https://cloud.google.com/sql/docs/postgres).
|
||||
108
docs/CLOUDSQLPG_README.md
Normal file
108
docs/CLOUDSQLPG_README.md
Normal file
@@ -0,0 +1,108 @@
|
||||
# Cloud SQL for PostgreSQL MCP Server
|
||||
|
||||
The Cloud SQL for PostgreSQL Model Context Protocol (MCP) Server gives AI-powered development tools the ability to work with your Google Cloud SQL for PostgreSQL databases. It supports connecting to instances, exploring schemas, running queries, and analyzing performance.
|
||||
|
||||
## Features
|
||||
|
||||
An editor configured to use the Cloud SQL for PostgreSQL MCP server can use its AI capabilities to help you:
|
||||
|
||||
- **Query Data** - Execute SQL queries and analyze query plans
|
||||
- **Explore Schema** - List tables, views, indexes, and triggers
|
||||
- **Monitor Performance** - View active queries, bloat, and memory configurations
|
||||
- **Manage Extensions** - List available and installed extensions
|
||||
|
||||
## Installation and Setup
|
||||
|
||||
### Prerequisites
|
||||
|
||||
* Download and install [MCP Toolbox](https://github.com/googleapis/genai-toolbox):
|
||||
1. **Download the Toolbox binary**:
|
||||
Download the latest binary for your operating system and architecture from the storage bucket. Check the [releases page](https://github.com/googleapis/genai-toolbox/releases) for OS and CPU architecture support:
|
||||
`https://storage.googleapis.com/genai-toolbox/v0.21.0/<os>/<arch>/toolbox`
|
||||
* Replace `<os>` with `linux`, `darwin` (macOS), or `windows`.
|
||||
* Replace `<arch>` with `amd64` (Intel) or `arm64` (Apple Silicon).
|
||||
|
||||
<!-- {x-release-please-start-version} -->
|
||||
```
|
||||
curl -L -o toolbox https://storage.googleapis.com/genai-toolbox/v0.21.0/linux/amd64/toolbox
|
||||
```
|
||||
<!-- {x-release-please-end} -->
|
||||
2. **Make it executable**:
|
||||
```bash
|
||||
chmod +x toolbox
|
||||
```
|
||||
|
||||
3. **Move binary to `/usr/local/bin/` or `/usr/bin/`**:
|
||||
```bash
|
||||
sudo mv toolbox /usr/local/bin/
|
||||
# sudo mv toolbox /usr/bin/
|
||||
```
|
||||
|
||||
**On Windows, move binary to the `WindowsApps\` folder**:
|
||||
```
|
||||
move "C:\Users\<path-to-binary>\toolbox.exe" "C:\Users\<username>\AppData\Local\Microsoft\WindowsApps\"
|
||||
```
|
||||
|
||||
**Tip:** Ensure the destination folder for your binary is included in
|
||||
your system's PATH environment variable. To check `PATH`, use `echo
|
||||
$PATH` (or `echo %PATH%` on Windows).
|
||||
|
||||
**Note:** You may need to restart Antigravity for changes to take effect.
|
||||
|
||||
* A Google Cloud project with the **Cloud SQL Admin API** enabled.
|
||||
* Ensure [Application Default Credentials](https://cloud.google.com/docs/authentication/gcloud) are available in your environment.
|
||||
* IAM Permissions:
|
||||
* Cloud SQL Client (`roles/cloudsql.client`)
|
||||
|
||||
### Configuration
|
||||
|
||||
1. **Access the Store**: Open the MCP Store panel within the "..." dropdown at the top of the editor's side panel.
|
||||
2. **Browse and Install**: Search for "Cloud SQL for PostgreSQL", and click "Install".
|
||||
3. **Configuration**: The following configuration is needed for the server:
|
||||
* Cloud SQL Project ID: The GCP project ID.
|
||||
* Cloud SQL Region: The region of your Cloud SQL instance.
|
||||
* Cloud SQL Instance ID: The ID of your Cloud SQL instance.
|
||||
* Cloud SQL Database Name: The name of the database.
|
||||
* Cloud SQL Database User: (Optional) The database username. Defaults to IAM authentication if unspecified.
|
||||
* Cloud SQL Database Password: (Optional) The password for the database user. Defaults to IAM authentication if unspecified.
|
||||
* Cloud SQL IP Type: (Optional) The IP type i.e. “Public” or “Private”. Defaults to "Public" if unspecified.
|
||||
|
||||
> [!NOTE]
|
||||
> If your instance uses private IPs, you must run the MCP server in the same Virtual Private Cloud (VPC) network.
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Once configured, the MCP server will automatically provide Cloud SQL for PostgreSQL capabilities to your AI assistant. You can:
|
||||
|
||||
* "Show me the top 5 bloated tables."
|
||||
* "List all installed extensions."
|
||||
* "Explain the query plan for SELECT * FROM users."
|
||||
|
||||
## Server Capabilities
|
||||
|
||||
The Cloud SQL for PostgreSQL MCP server provides the following tools:
|
||||
|
||||
| Tool Name | Description |
|
||||
|:---------------------------------|:---------------------------------------------------------------|
|
||||
| `execute_sql` | Use this tool to execute sql. |
|
||||
| `list_tables` | Lists detailed schema information for user-created tables. |
|
||||
| `list_active_queries` | List the top N currently running queries. |
|
||||
| `list_available_extensions` | Discover all PostgreSQL extensions available for installation. |
|
||||
| `list_installed_extensions` | List all installed PostgreSQL extensions. |
|
||||
| `list_autovacuum_configurations` | List PostgreSQL autovacuum-related configurations. |
|
||||
| `list_memory_configurations` | List PostgreSQL memory-related configurations. |
|
||||
| `list_top_bloated_tables` | List the top tables by dead-tuple (approximate bloat signal). |
|
||||
| `list_replication_slots` | List key details for all PostgreSQL replication slots. |
|
||||
| `list_invalid_indexes` | Lists all invalid PostgreSQL indexes. |
|
||||
| `get_query_plan` | Generate a PostgreSQL EXPLAIN plan in JSON format. |
|
||||
| `list_views` | Lists views in the database. |
|
||||
| `list_schemas` | Lists all schemas in the database. |
|
||||
| `database_overview` | Fetches the current state of the PostgreSQL server. |
|
||||
| `list_triggers` | Lists all non-internal triggers in a database. |
|
||||
| `list_indexes` | Lists available user indexes in the database. |
|
||||
| `list_sequences` | Lists sequences in the database. |
|
||||
|
||||
## Documentation
|
||||
|
||||
For more information, visit the [Cloud SQL for PostgreSQL documentation](https://cloud.google.com/sql/docs/postgres).
|
||||
81
docs/DATAPLEX_README.md
Normal file
81
docs/DATAPLEX_README.md
Normal file
@@ -0,0 +1,81 @@
|
||||
# Dataplex MCP Server
|
||||
|
||||
The Dataplex Model Context Protocol (MCP) Server gives AI-powered development tools the ability to work with your Google Cloud Dataplex Catalog. It supports searching and looking up entries and aspect types.
|
||||
|
||||
## Features
|
||||
|
||||
An editor configured to use the Dataplex MCP server can use its AI capabilities to help you:
|
||||
|
||||
- **Search Catalog** - Search for entries in Dataplex Catalog
|
||||
- **Explore Metadata** - Lookup specific entries and search aspect types
|
||||
|
||||
## Installation and Setup
|
||||
|
||||
### Prerequisites
|
||||
|
||||
* Download and install [MCP Toolbox](https://github.com/googleapis/genai-toolbox):
|
||||
1. **Download the Toolbox binary**:
|
||||
Download the latest binary for your operating system and architecture from the storage bucket. Check the [releases page](https://github.com/googleapis/genai-toolbox/releases) for OS and CPU architecture support:
|
||||
`https://storage.googleapis.com/genai-toolbox/v0.21.0/<os>/<arch>/toolbox`
|
||||
* Replace `<os>` with `linux`, `darwin` (macOS), or `windows`.
|
||||
* Replace `<arch>` with `amd64` (Intel) or `arm64` (Apple Silicon).
|
||||
|
||||
<!-- {x-release-please-start-version} -->
|
||||
```
|
||||
curl -L -o toolbox https://storage.googleapis.com/genai-toolbox/v0.21.0/linux/amd64/toolbox
|
||||
```
|
||||
<!-- {x-release-please-end} -->
|
||||
2. **Make it executable**:
|
||||
```bash
|
||||
chmod +x toolbox
|
||||
```
|
||||
|
||||
3. **Move binary to `/usr/local/bin/` or `/usr/bin/`**:
|
||||
```bash
|
||||
sudo mv toolbox /usr/local/bin/
|
||||
# sudo mv toolbox /usr/bin/
|
||||
```
|
||||
|
||||
**On Windows, move binary to the `WindowsApps\` folder**:
|
||||
```
|
||||
move "C:\Users\<path-to-binary>\toolbox.exe" "C:\Users\<username>\AppData\Local\Microsoft\WindowsApps\"
|
||||
```
|
||||
|
||||
**Tip:** Ensure the destination folder for your binary is included in
|
||||
your system's PATH environment variable. To check `PATH`, use `echo
|
||||
$PATH` (or `echo %PATH%` on Windows).
|
||||
|
||||
**Note:** You may need to restart Antigravity for changes to take effect.
|
||||
|
||||
* A Google Cloud project with the **Dataplex API** enabled.
|
||||
* Ensure [Application Default Credentials](https://cloud.google.com/docs/authentication/gcloud) are available in your environment.
|
||||
* IAM Permissions:
|
||||
* Dataplex Viewer (`roles/dataplex.viewer`) or equivalent permissions to read catalog entries.
|
||||
|
||||
### Configuration
|
||||
|
||||
1. **Access the Store**: Open the MCP Store panel within the "..." dropdown at the top of the editor's side panel.
|
||||
2. **Browse and Install**: Search for "Dataplex", and click "Install".
|
||||
3. **Configuration**: The following configuration is needed for the server:
|
||||
* Dataplex Project ID: The GCP project ID.
|
||||
|
||||
## Usage
|
||||
|
||||
Once configured, the MCP server will automatically provide Dataplex capabilities to your AI assistant. You can:
|
||||
|
||||
* "Search for entries related to 'sales' in Dataplex."
|
||||
* "Look up details for the entry 'projects/my-project/locations/us-central1/entryGroups/my-group/entries/my-entry'."
|
||||
|
||||
## Server Capabilities
|
||||
|
||||
The Dataplex MCP server provides the following tools:
|
||||
|
||||
| Tool Name | Description |
|
||||
|:----------------------|:-------------------------------------------------|
|
||||
| `search_entries` | Search for entries in Dataplex Catalog. |
|
||||
| `lookup_entry` | Retrieve a specific entry from Dataplex Catalog. |
|
||||
| `search_aspect_types` | Find aspect types relevant to the query. |
|
||||
|
||||
## Documentation
|
||||
|
||||
For more information, visit the [Dataplex documentation](https://cloud.google.com/dataplex/docs).
|
||||
101
docs/LOOKER_README.md
Normal file
101
docs/LOOKER_README.md
Normal file
@@ -0,0 +1,101 @@
|
||||
# Looker MCP Server
|
||||
|
||||
The Looker Model Context Protocol (MCP) Server gives AI-powered development tools the ability to work with your Looker instance. It supports exploring models, running queries, managing dashboards, and more.
|
||||
|
||||
## Features
|
||||
|
||||
An editor configured to use the Looker MCP server can use its AI capabilities to help you:
|
||||
|
||||
- **Explore Models** - Get models, explores, dimensions, measures, filters, and parameters
|
||||
- **Run Queries** - Execute Looker queries, generate SQL, and create query URLs
|
||||
- **Manage Dashboards** - Create, run, and modify dashboards
|
||||
- **Manage Looks** - Search for and run saved looks
|
||||
- **Health Checks** - Analyze instance health and performance
|
||||
- **Developer Tools** - Manage project files and toggle dev mode
|
||||
|
||||
## Installation and Setup
|
||||
|
||||
### Prerequisites
|
||||
|
||||
* Download and install [MCP Toolbox](https://github.com/googleapis/genai-toolbox):
|
||||
1. **Download the Toolbox binary**:
|
||||
Download the latest binary for your operating system and architecture from the storage bucket. Check the [releases page](https://github.com/googleapis/genai-toolbox/releases) for OS and CPU architecture support:
|
||||
`https://storage.googleapis.com/genai-toolbox/v0.21.0/<os>/<arch>/toolbox`
|
||||
* Replace `<os>` with `linux`, `darwin` (macOS), or `windows`.
|
||||
* Replace `<arch>` with `amd64` (Intel) or `arm64` (Apple Silicon).
|
||||
|
||||
<!-- {x-release-please-start-version} -->
|
||||
```
|
||||
curl -L -o toolbox https://storage.googleapis.com/genai-toolbox/v0.21.0/linux/amd64/toolbox
|
||||
```
|
||||
<!-- {x-release-please-end} -->
|
||||
2. **Make it executable**:
|
||||
```bash
|
||||
chmod +x toolbox
|
||||
```
|
||||
|
||||
3. **Move binary to `/usr/local/bin/` or `/usr/bin/`**:
|
||||
```bash
|
||||
sudo mv toolbox /usr/local/bin/
|
||||
# sudo mv toolbox /usr/bin/
|
||||
```
|
||||
|
||||
**On Windows, move binary to the `WindowsApps\` folder**:
|
||||
```
|
||||
move "C:\Users\<path-to-binary>\toolbox.exe" "C:\Users\<username>\AppData\Local\Microsoft\WindowsApps\"
|
||||
```
|
||||
|
||||
**Tip:** Ensure the destination folder for your binary is included in
|
||||
your system's PATH environment variable. To check `PATH`, use `echo
|
||||
$PATH` (or `echo %PATH%` on Windows).
|
||||
|
||||
**Note:** You may need to restart Antigravity for changes to take effect.
|
||||
|
||||
* Access to a Looker instance.
|
||||
* API Credentials (`Client ID` and `Client Secret`) or OAuth configuration.
|
||||
|
||||
### Configuration
|
||||
|
||||
1. **Access the Store**: Open the MCP Store panel within the "..." dropdown at the top of the editor's side panel.
|
||||
2. **Browse and Install**: Search for "Looker", and click "Install".
|
||||
3. **Configuration**: The following configuration is needed for the server:
|
||||
* Looker Base URL: The URL of your Looker instance.
|
||||
* Looker Client ID: The client ID for the Looker API.
|
||||
* Looker Client Secret: The client secret for the Looker API.
|
||||
* Looker Verify SSL: Whether to verify SSL certificates.
|
||||
* Looker Use Client OAuth: Whether to use OAuth for authentication.
|
||||
* Looker Show Hidden Models: Whether to show hidden models.
|
||||
* Looker Show Hidden Explores: Whether to show hidden explores.
|
||||
* Looker Show Hidden Fields: Whether to show hidden fields.
|
||||
|
||||
## Usage
|
||||
|
||||
Once configured, the MCP server will automatically provide Looker capabilities to your AI assistant. You can:
|
||||
|
||||
* "Find explores in the 'ecommerce' model."
|
||||
* "Run a query to show total sales by month."
|
||||
* "Create a new dashboard named 'Sales Overview'."
|
||||
|
||||
## Server Capabilities
|
||||
|
||||
The Looker MCP server provides a wide range of tools. Here are some of the key capabilities:
|
||||
|
||||
| Tool Name | Description |
|
||||
|:------------------------|:----------------------------------------------------------|
|
||||
| `get_models` | Retrieves the list of LookML models. |
|
||||
| `get_explores` | Retrieves the list of explores defined in a LookML model. |
|
||||
| `query` | Run a query against the LookML model. |
|
||||
| `query_sql` | Generate the SQL that Looker would run. |
|
||||
| `run_look` | Runs a saved look. |
|
||||
| `run_dashboard` | Runs all tiles in a dashboard. |
|
||||
| `make_dashboard` | Creates a new dashboard. |
|
||||
| `add_dashboard_element` | Adds a tile to a dashboard. |
|
||||
| `health_pulse` | Checks the status of the Looker instance. |
|
||||
| `dev_mode` | Toggles development mode. |
|
||||
| `get_projects` | Lists LookML projects. |
|
||||
|
||||
*(See the full list of tools in the extension)*
|
||||
|
||||
## Documentation
|
||||
|
||||
For more information, visit the [Looker documentation](https://cloud.google.com/looker/docs).
|
||||
86
docs/SPANNER_README.md
Normal file
86
docs/SPANNER_README.md
Normal file
@@ -0,0 +1,86 @@
|
||||
# Cloud Spanner MCP Server
|
||||
|
||||
The Cloud Spanner Model Context Protocol (MCP) Server gives AI-powered development tools the ability to work with your Google Cloud Spanner databases. It supports executing SQL queries and exploring schemas.
|
||||
|
||||
## Features
|
||||
|
||||
An editor configured to use the Cloud Spanner MCP server can use its AI capabilities to help you:
|
||||
|
||||
- **Query Data** - Execute DML and DQL SQL queries
|
||||
- **Explore Schema** - List tables and view schema details
|
||||
|
||||
## Installation and Setup
|
||||
|
||||
### Prerequisites
|
||||
|
||||
* Download and install [MCP Toolbox](https://github.com/googleapis/genai-toolbox):
|
||||
1. **Download the Toolbox binary**:
|
||||
Download the latest binary for your operating system and architecture from the storage bucket. Check the [releases page](https://github.com/googleapis/genai-toolbox/releases) for OS and CPU architecture support:
|
||||
`https://storage.googleapis.com/genai-toolbox/v0.21.0/<os>/<arch>/toolbox`
|
||||
* Replace `<os>` with `linux`, `darwin` (macOS), or `windows`.
|
||||
* Replace `<arch>` with `amd64` (Intel) or `arm64` (Apple Silicon).
|
||||
|
||||
<!-- {x-release-please-start-version} -->
|
||||
```
|
||||
curl -L -o toolbox https://storage.googleapis.com/genai-toolbox/v0.21.0/linux/amd64/toolbox
|
||||
```
|
||||
<!-- {x-release-please-end} -->
|
||||
2. **Make it executable**:
|
||||
```bash
|
||||
chmod +x toolbox
|
||||
```
|
||||
|
||||
3. **Move binary to `/usr/local/bin/` or `/usr/bin/`**:
|
||||
```bash
|
||||
sudo mv toolbox /usr/local/bin/
|
||||
# sudo mv toolbox /usr/bin/
|
||||
```
|
||||
|
||||
**On Windows, move binary to the `WindowsApps\` folder**:
|
||||
```
|
||||
move "C:\Users\<path-to-binary>\toolbox.exe" "C:\Users\<username>\AppData\Local\Microsoft\WindowsApps\"
|
||||
```
|
||||
|
||||
**Tip:** Ensure the destination folder for your binary is included in
|
||||
your system's PATH environment variable. To check `PATH`, use `echo
|
||||
$PATH` (or `echo %PATH%` on Windows).
|
||||
|
||||
**Note:** You may need to restart Antigravity for changes to take effect.
|
||||
|
||||
* A Google Cloud project with the **Cloud Spanner API** enabled.
|
||||
* Ensure [Application Default Credentials](https://cloud.google.com/docs/authentication/gcloud) are available in your environment.
|
||||
* IAM Permissions:
|
||||
* Cloud Spanner Database User (`roles/spanner.databaseUser`) (for data access)
|
||||
* Cloud Spanner Viewer (`roles/spanner.viewer`) (for schema access)
|
||||
|
||||
### Configuration
|
||||
|
||||
1. **Access the Store**: Open the MCP Store panel within the "..." dropdown at the top of the editor's side panel.
|
||||
2. **Browse and Install**: Search for "Spanner", and click "Install".
|
||||
3. **Configuration**: The following configuration is needed for the server:
|
||||
* Spanner Project ID: The GCP project ID.
|
||||
* Spanner Instance ID: The Spanner instance ID.
|
||||
* Spanner Database ID: The Spanner database ID.
|
||||
* Spanner Dialect: (Optional) The database dialect, which can be "googlesql" or "postgresql". Defaults to "googlesql" if unspecified.
|
||||
|
||||
## Usage
|
||||
|
||||
Once configured, the MCP server will automatically provide Cloud Spanner capabilities to your AI assistant. You can:
|
||||
|
||||
* "Execute a DML query to update customer names."
|
||||
* "List all tables in the `my-database`."
|
||||
* "Execute a DQL query to select data from `orders` table."
|
||||
|
||||
## Server Capabilities
|
||||
|
||||
The Cloud Spanner MCP server provides the following tools:
|
||||
|
||||
| Tool Name | Description |
|
||||
|:------------------|:-----------------------------------------------------------|
|
||||
| `execute_sql` | Use this tool to execute DML SQL. |
|
||||
| `execute_sql_dql` | Use this tool to execute DQL SQL. |
|
||||
| `list_tables` | Lists detailed schema information for user-created tables. |
|
||||
|
||||
## Documentation
|
||||
|
||||
For more information, visit the [Cloud Spanner documentation](https://cloud.google.com/spanner/docs).
|
||||
61
docs/TOOLBOX_README.md
Normal file
61
docs/TOOLBOX_README.md
Normal file
@@ -0,0 +1,61 @@
|
||||
# MCP Toolbox for Databases Server
|
||||
|
||||
The MCP Toolbox for Databases Server gives AI-powered development tools the ability to work with your custom tools. It is designed to simplify and secure the development of tools for interacting with databases.
|
||||
|
||||
## Installation and Setup
|
||||
|
||||
### Prerequisites
|
||||
|
||||
* Download and install [MCP Toolbox](https://github.com/googleapis/genai-toolbox):
|
||||
1. **Download the Toolbox binary**:
|
||||
Download the latest binary for your operating system and architecture from the storage bucket. Check the [releases page](https://github.com/googleapis/genai-toolbox/releases) for OS and CPU architecture support:
|
||||
`https://storage.googleapis.com/genai-toolbox/v0.21.0/<os>/<arch>/toolbox`
|
||||
* Replace `<os>` with `linux`, `darwin` (macOS), or `windows`.
|
||||
* Replace `<arch>` with `amd64` (Intel) or `arm64` (Apple Silicon).
|
||||
|
||||
<!-- {x-release-please-start-version} -->
|
||||
```
|
||||
curl -L -o toolbox https://storage.googleapis.com/genai-toolbox/v0.21.0/linux/amd64/toolbox
|
||||
```
|
||||
<!-- {x-release-please-end} -->
|
||||
2. **Make it executable**:
|
||||
```bash
|
||||
chmod +x toolbox
|
||||
```
|
||||
|
||||
3. **Move binary to `/usr/local/bin/` or `/usr/bin/`**:
|
||||
```bash
|
||||
sudo mv toolbox /usr/local/bin/
|
||||
# sudo mv toolbox /usr/bin/
|
||||
```
|
||||
|
||||
**On Windows, move binary to the `WindowsApps\` folder**:
|
||||
```
|
||||
move "C:\Users\<path-to-binary>\toolbox.exe" "C:\Users\<username>\AppData\Local\Microsoft\WindowsApps\"
|
||||
```
|
||||
|
||||
**Tip:** Ensure the destination folder for your binary is included in
|
||||
your system's PATH environment variable. To check `PATH`, use `echo
|
||||
$PATH` (or `echo %PATH%` on Windows).
|
||||
|
||||
**Note:** You may need to restart Antigravity for changes to take effect.
|
||||
|
||||
* Any required APIs and permissions for connecting to your database.
|
||||
|
||||
### Configuration
|
||||
|
||||
1. **Access the Store**: Open the MCP Store panel within the "..." dropdown at the top of the editor's side panel.
|
||||
2. **Browse and Install**: Search for "MCP Toolbox for Databases", and click "Install".
|
||||
3. **Configuration**: The following configuration is needed for the server:
|
||||
* Add your [`tools.yaml` configuration
|
||||
file](https://googleapis.github.io/genai-toolbox/getting-started/configure/)
|
||||
to the directory you are running Antigravity
|
||||
|
||||
## Usage
|
||||
|
||||
Interact with your custom tools using natural language.
|
||||
|
||||
|
||||
## Documentation
|
||||
|
||||
For more information, visit the [MCP Toolbox for Databases documentation](https://googleapis.github.io/genai-toolbox/getting-started/introduction/).
|
||||
@@ -119,9 +119,9 @@ chmod +x toolbox
|
||||
To install Toolbox as a binary on Windows (AMD64):
|
||||
|
||||
```powershell
|
||||
# see releases page for other versions
|
||||
$VERSION = "0.21.0"
|
||||
Invoke-WebRequest -Uri "https://storage.googleapis.com/genai-toolbox/v$VERSION/windows/amd64/toolbox.exe" -OutFile "toolbox.exe"
|
||||
:: see releases page for other versions
|
||||
set VERSION=0.21.0
|
||||
curl -o toolbox.exe "https://storage.googleapis.com/genai-toolbox/v%VERSION%/windows/amd64/toolbox.exe"
|
||||
```
|
||||
|
||||
{{% /tab %}}
|
||||
|
||||
@@ -13,7 +13,7 @@ description: >
|
||||
|
||||
This guide assumes you have already done the following:
|
||||
|
||||
1. Installed [Python 3.9+][install-python] (including [pip][install-pip] and
|
||||
1. Installed [Python 3.10+][install-python] (including [pip][install-pip] and
|
||||
your preferred virtual environment tool for managing dependencies e.g.
|
||||
[venv][install-venv]).
|
||||
1. Installed [PostgreSQL 16+ and the `psql` client][install-postgres].
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
google-adk==1.18.0
|
||||
toolbox-core==0.5.2
|
||||
google-adk==1.19.0
|
||||
toolbox-core==0.5.3
|
||||
pytest==9.0.1
|
||||
@@ -1,3 +1,3 @@
|
||||
google-genai==1.47.0
|
||||
toolbox-core==0.5.2
|
||||
google-genai==1.52.0
|
||||
toolbox-core==0.5.3
|
||||
pytest==9.0.1
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
langchain==0.3.27
|
||||
langchain-google-vertexai==2.1.2
|
||||
langgraph==1.0.1
|
||||
toolbox-langchain==0.5.2
|
||||
langchain==1.0.8
|
||||
langchain-google-vertexai==3.0.3
|
||||
langgraph==1.0.3
|
||||
toolbox-langchain==0.5.3
|
||||
pytest==9.0.1
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
llama-index==0.14.6
|
||||
llama-index==0.14.8
|
||||
llama-index-llms-google-genai==0.7.3
|
||||
toolbox-llamaindex==0.5.2
|
||||
toolbox-llamaindex==0.5.3
|
||||
pytest==9.0.1
|
||||
|
||||
@@ -92,16 +92,17 @@ instead of hardcoding your secrets into the configuration file.
|
||||
## Reference
|
||||
|
||||
| **field** | **type** | **required** | **description** |
|
||||
| -------------------- | :------: | :----------: | ----------------------------------------------------------------------------------------- |
|
||||
|----------------------|:--------:|:------------:|-------------------------------------------------------------------------------------------|
|
||||
| kind | string | true | Must be "looker". |
|
||||
| base_url | string | true | The URL of your Looker server with no trailing /). |
|
||||
| base_url | string | true | The URL of your Looker server with no trailing /. |
|
||||
| client_id | string | false | The client id assigned by Looker. |
|
||||
| client_secret | string | false | The client secret assigned by Looker. |
|
||||
| verify_ssl | string | false | Whether to check the ssl certificate of the server. |
|
||||
| project | string | false | The project id to use in Google Cloud. |
|
||||
| location | string | false | The location to use in Google Cloud. (default: us) |
|
||||
| timeout | string | false | Maximum time to wait for query execution (e.g. "30s", "2m"). By default, 120s is applied. |
|
||||
| use_client_oauth | string | false | Use OAuth tokens instead of client_id and client_secret. (default: false) |
|
||||
| use_client_oauth | string | false | Use OAuth tokens instead of client_id and client_secret. (default: false) If a header |
|
||||
| | | | name is provided, it will be used instead of "Authorization". |
|
||||
| show_hidden_models | string | false | Show or hide hidden models. (default: true) |
|
||||
| show_hidden_explores | string | false | Show or hide hidden explores. (default: true) |
|
||||
| show_hidden_fields | string | false | Show or hide hidden fields. (default: true) |
|
||||
| show_hidden_fields | string | false | Show or hide hidden fields. (default: true) |
|
||||
@@ -0,0 +1,40 @@
|
||||
---
|
||||
title: postgres-upgrade-precheck
|
||||
type: docs
|
||||
weight: 11
|
||||
description: Perform a pre-check for a Cloud SQL for PostgreSQL major version upgrade.
|
||||
---
|
||||
|
||||
The `postgres-upgrade-precheck` tool initiates a pre-check on a Cloud SQL for PostgreSQL
|
||||
instance to assess its readiness for a major version upgrade using the Cloud SQL Admin API.
|
||||
It helps identify potential incompatibilities or issues before starting the actual upgrade process.
|
||||
|
||||
{{< notice info >}}
|
||||
This tool uses a `source` of kind `cloud-sql-admin`.
|
||||
{{< /notice >}}
|
||||
|
||||
## Tool Inputs
|
||||
|
||||
### Example
|
||||
|
||||
```yaml
|
||||
tools:
|
||||
postgres-upgrade-precheck:
|
||||
kind: postgres-upgrade-precheck
|
||||
source: cloud-sql-admin-source
|
||||
description: "Checks if a Cloud SQL PostgreSQL instance is ready for a major version upgrade to the specified target version."
|
||||
```
|
||||
|
||||
### Reference
|
||||
|
||||
| **field** | **type** | **required** | **description** |
|
||||
| ------------ | :------: | :----------: | --------------------------------------------------------- |
|
||||
| kind | string | true | Must be "postgres-upgrade-precheck". |
|
||||
| source | string | true | The name of the `cloud-sql-admin` source to use. |
|
||||
| description | string | false | A description of the tool. |
|
||||
|
||||
| **parameter** | **type** | **required** | **description** |
|
||||
| ----------------------- | :------: | :----------: | ------------------------------------------------------------------------------- |
|
||||
| project | string | true | The project ID containing the instance. |
|
||||
| instance | string | true | The name of the Cloud SQL instance to check. |
|
||||
| targetDatabaseVersion | string | false | The target PostgreSQL major version for the upgrade (e.g., `POSTGRES_18`). If not specified, defaults to the PostgreSQL 18. |
|
||||
@@ -14,7 +14,7 @@ Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.
|
||||
|
||||
This guide assumes you have already done the following:
|
||||
|
||||
1. Installed [Python 3.9+][install-python] (including [pip][install-pip] and
|
||||
1. Installed [Python 3.10+][install-python] (including [pip][install-pip] and
|
||||
your preferred virtual environment tool for managing dependencies e.g.
|
||||
[venv][install-venv]).
|
||||
1. Installed and configured the [Google Cloud SDK (gcloud CLI)][install-gcloud].
|
||||
|
||||
5
go.mod
5
go.mod
@@ -2,7 +2,7 @@ module github.com/googleapis/genai-toolbox
|
||||
|
||||
go 1.24.7
|
||||
|
||||
toolchain go1.25.2
|
||||
toolchain go1.25.3
|
||||
|
||||
require (
|
||||
cloud.google.com/go/alloydbconn v1.15.5
|
||||
@@ -18,6 +18,7 @@ require (
|
||||
github.com/ClickHouse/clickhouse-go/v2 v2.40.3
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.53.0
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace v1.29.0
|
||||
github.com/apache/cassandra-gocql-driver/v2 v2.0.0
|
||||
github.com/cenkalti/backoff/v5 v5.0.3
|
||||
github.com/couchbase/gocb/v2 v2.11.1
|
||||
github.com/couchbase/tools-common/http v1.0.9
|
||||
@@ -31,7 +32,6 @@ require (
|
||||
github.com/go-playground/validator/v10 v10.28.0
|
||||
github.com/go-sql-driver/mysql v1.9.3
|
||||
github.com/goccy/go-yaml v1.18.0
|
||||
github.com/gocql/gocql v1.7.0
|
||||
github.com/google/go-cmp v0.7.0
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/jackc/pgx/v5 v5.7.6
|
||||
@@ -122,7 +122,6 @@ require (
|
||||
github.com/gorilla/websocket v1.5.3 // indirect
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect
|
||||
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect
|
||||
github.com/hashicorp/go-uuid v1.0.3 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/jackc/pgpassfile v1.0.0 // indirect
|
||||
|
||||
14
go.sum
14
go.sum
@@ -701,6 +701,8 @@ github.com/apache/arrow/go/v10 v10.0.1/go.mod h1:YvhnlEePVnBS4+0z3fhPfUy7W1Ikj0I
|
||||
github.com/apache/arrow/go/v11 v11.0.0/go.mod h1:Eg5OsL5H+e299f7u5ssuXsuHQVEGC4xei5aX110hRiI=
|
||||
github.com/apache/arrow/go/v15 v15.0.2 h1:60IliRbiyTWCWjERBCkO1W4Qun9svcYoZrSLcyOsMLE=
|
||||
github.com/apache/arrow/go/v15 v15.0.2/go.mod h1:DGXsR3ajT524njufqf95822i+KTh+yea1jass9YXgjA=
|
||||
github.com/apache/cassandra-gocql-driver/v2 v2.0.0 h1:Omnzb1Z/P90Dr2TbVNu54ICQL7TKVIIsJO231w484HU=
|
||||
github.com/apache/cassandra-gocql-driver/v2 v2.0.0/go.mod h1:QH/asJjB3mHvY6Dot6ZKMMpTcOrWJ8i9GhsvG1g0PK4=
|
||||
github.com/apache/thrift v0.16.0/go.mod h1:PHK3hniurgQaNMZYaCLEqXKsYK8upmhPbmdP2FXSqgU=
|
||||
github.com/aws/aws-sdk-go v1.55.8 h1:JRmEUbU52aJQZ2AjX4q4Wu7t4uZjOu71uyNmaWlUkJQ=
|
||||
github.com/aws/aws-sdk-go v1.55.8/go.mod h1:ZkViS9AqA6otK+JBBNH2++sx1sgxrPKcSzPPvQkUtXk=
|
||||
@@ -741,10 +743,6 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.38.4/go.mod h1:Z+Gd23v97pX9zK97+tX4p
|
||||
github.com/aws/smithy-go v1.23.0 h1:8n6I3gXzWJB2DxBDnfxgBaSX6oe0d/t10qGz7OKqMCE=
|
||||
github.com/aws/smithy-go v1.23.0/go.mod h1:t1ufH5HMublsJYulve2RKmHDC15xu1f26kHCp/HgceI=
|
||||
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
|
||||
github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932 h1:mXoPYz/Ul5HYEDvkta6I8/rnYM5gSdSV2tJ6XbZuEtY=
|
||||
github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCSz6Q9T7+igc/hlvDOUdtWKryOrtFyIVABv/p7k=
|
||||
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY=
|
||||
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
|
||||
github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
|
||||
github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
|
||||
github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
|
||||
@@ -909,8 +907,6 @@ github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
|
||||
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
|
||||
github.com/goccy/go-yaml v1.18.0 h1:8W7wMFS12Pcas7KU+VVkaiCng+kG8QiFeFwzFb+rwuw=
|
||||
github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
|
||||
github.com/gocql/gocql v1.7.0 h1:O+7U7/1gSN7QTEAaMEsJc1Oq2QHXvCWoF3DFK9HDHus=
|
||||
github.com/gocql/gocql v1.7.0/go.mod h1:vnlvXyFZeLBF0Wy+RS8hrOdbn0UWsWtdg07XJnFxZ+4=
|
||||
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
||||
github.com/golang-jwt/jwt/v5 v5.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo=
|
||||
github.com/golang-jwt/jwt/v5 v5.3.0/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE=
|
||||
@@ -1058,8 +1054,6 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4Zs
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3/go.mod h1:o//XUCC/F+yRGJoPO/VU0GSB0f8Nhgmxx0VIRUvaC0w=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 h1:8Tjv8EJ+pM1xP8mK6egEbD1OgnVTyacbefKhmbLhIhU=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2/go.mod h1:pkJQ2tZHJ0aFOVEEot6oZmaVEZcRme73eIFmhiVuRWs=
|
||||
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed h1:5upAirOpQc1Q53c0bnx2ufif5kANL7bfZWcc6VJWJd8=
|
||||
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4=
|
||||
github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||
github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=
|
||||
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||
@@ -1143,6 +1137,8 @@ github.com/looker-open-source/sdk-codegen/go v0.25.18/go.mod h1:Br1ntSiruDJ/4nYN
|
||||
github.com/lyft/protoc-gen-star v0.6.0/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA=
|
||||
github.com/lyft/protoc-gen-star v0.6.1/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA=
|
||||
github.com/lyft/protoc-gen-star/v2 v2.0.1/go.mod h1:RcCdONR2ScXaYnQC5tUzxzlpA3WVYF7/opLeUgcQs/o=
|
||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
@@ -1223,6 +1219,8 @@ github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTE
|
||||
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
|
||||
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
|
||||
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
|
||||
github.com/rs/zerolog v1.34.0 h1:k43nTLIwcTVQAncfCw4KZ2VY6ukYoZaBPNOE8txlOeY=
|
||||
github.com/rs/zerolog v1.34.0/go.mod h1:bJsvje4Z08ROH4Nhs5iH600c3IkWhwp44iRc54W6wYQ=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w=
|
||||
github.com/ruudk/golang-pdf417 v0.0.0-20201230142125-a7e3863a1245/go.mod h1:pQAZKsJ8yyVxGRWYNEm9oFB8ieLgKFnamEyDmSA0BRk=
|
||||
|
||||
@@ -39,6 +39,9 @@ tools:
|
||||
wait_for_operation:
|
||||
kind: cloud-sql-wait-for-operation
|
||||
source: cloud-sql-admin-source
|
||||
postgres_upgrade_precheck:
|
||||
kind: postgres-upgrade-precheck
|
||||
source: cloud-sql-admin-source
|
||||
|
||||
toolsets:
|
||||
cloud_sql_postgres_admin_tools:
|
||||
@@ -49,3 +52,4 @@ toolsets:
|
||||
- list_databases
|
||||
- create_user
|
||||
- wait_for_operation
|
||||
- postgres_upgrade_precheck
|
||||
|
||||
@@ -118,6 +118,10 @@ func (t MockTool) McpManifest() tools.McpManifest {
|
||||
return mcpManifest
|
||||
}
|
||||
|
||||
func (t MockTool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
// MockPrompt is used to mock prompts in tests
|
||||
type MockPrompt struct {
|
||||
Name string
|
||||
|
||||
@@ -99,7 +99,7 @@ func toolsCallHandler(ctx context.Context, id jsonrpc.RequestId, toolsMap map[st
|
||||
}
|
||||
|
||||
// Get access token
|
||||
accessToken := tools.AccessToken(header.Get("Authorization"))
|
||||
accessToken := tools.AccessToken(header.Get(tool.GetAuthTokenHeaderName()))
|
||||
|
||||
// Check if this specific tool requires the standard authorization header
|
||||
if tool.RequiresClientAuthorization() {
|
||||
|
||||
@@ -99,7 +99,7 @@ func toolsCallHandler(ctx context.Context, id jsonrpc.RequestId, toolsMap map[st
|
||||
}
|
||||
|
||||
// Get access token
|
||||
accessToken := tools.AccessToken(header.Get("Authorization"))
|
||||
accessToken := tools.AccessToken(header.Get(tool.GetAuthTokenHeaderName()))
|
||||
|
||||
// Check if this specific tool requires the standard authorization header
|
||||
if tool.RequiresClientAuthorization() {
|
||||
|
||||
@@ -99,7 +99,7 @@ func toolsCallHandler(ctx context.Context, id jsonrpc.RequestId, toolsMap map[st
|
||||
}
|
||||
|
||||
// Get access token
|
||||
accessToken := tools.AccessToken(header.Get("Authorization"))
|
||||
accessToken := tools.AccessToken(header.Get(tool.GetAuthTokenHeaderName()))
|
||||
|
||||
// Check if this specific tool requires the standard authorization header
|
||||
if tool.RequiresClientAuthorization() {
|
||||
|
||||
@@ -18,8 +18,8 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
gocql "github.com/apache/cassandra-gocql-driver/v2"
|
||||
"github.com/goccy/go-yaml"
|
||||
"github.com/gocql/gocql"
|
||||
"github.com/googleapis/genai-toolbox/internal/sources"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
@@ -16,6 +16,7 @@ package looker
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
geminidataanalytics "cloud.google.com/go/geminidataanalytics/apiv1beta"
|
||||
@@ -46,7 +47,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources
|
||||
Name: name,
|
||||
SslVerification: true,
|
||||
Timeout: "600s",
|
||||
UseClientOAuth: false,
|
||||
UseClientOAuth: "false",
|
||||
ShowHiddenModels: true,
|
||||
ShowHiddenExplores: true,
|
||||
ShowHiddenFields: true,
|
||||
@@ -66,7 +67,7 @@ type Config struct {
|
||||
ClientId string `yaml:"client_id"`
|
||||
ClientSecret string `yaml:"client_secret"`
|
||||
SslVerification bool `yaml:"verify_ssl"`
|
||||
UseClientOAuth bool `yaml:"use_client_oauth"`
|
||||
UseClientOAuth string `yaml:"use_client_oauth"`
|
||||
Timeout string `yaml:"timeout"`
|
||||
ShowHiddenModels bool `yaml:"show_hidden_models"`
|
||||
ShowHiddenExplores bool `yaml:"show_hidden_explores"`
|
||||
@@ -114,12 +115,13 @@ func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.So
|
||||
tokenSource, _ = initGoogleCloudConnection(ctx)
|
||||
|
||||
s := &Source{
|
||||
Config: r,
|
||||
ApiSettings: &cfg,
|
||||
TokenSource: tokenSource,
|
||||
Config: r,
|
||||
ApiSettings: &cfg,
|
||||
TokenSource: tokenSource,
|
||||
AuthTokenHeaderName: "Authorization",
|
||||
}
|
||||
|
||||
if !r.UseClientOAuth {
|
||||
if strings.ToLower(r.UseClientOAuth) == "false" {
|
||||
if r.ClientId == "" || r.ClientSecret == "" {
|
||||
return nil, fmt.Errorf("client_id and client_secret need to be specified")
|
||||
}
|
||||
@@ -129,6 +131,11 @@ func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.So
|
||||
return nil, fmt.Errorf("incorrect settings: %w", err)
|
||||
}
|
||||
logger.DebugContext(ctx, fmt.Sprintf("logged in as %s %s", *resp.FirstName, *resp.LastName))
|
||||
} else {
|
||||
if strings.ToLower(r.UseClientOAuth) != "true" {
|
||||
s.AuthTokenHeaderName = r.UseClientOAuth
|
||||
}
|
||||
logger.DebugContext(ctx, fmt.Sprintf("Using AuthTokenHeaderName: %s", s.AuthTokenHeaderName))
|
||||
}
|
||||
|
||||
return s, nil
|
||||
@@ -139,9 +146,10 @@ var _ sources.Source = &Source{}
|
||||
|
||||
type Source struct {
|
||||
Config
|
||||
Client *v4.LookerSDK
|
||||
ApiSettings *rtl.ApiSettings
|
||||
TokenSource oauth2.TokenSource
|
||||
Client *v4.LookerSDK
|
||||
ApiSettings *rtl.ApiSettings
|
||||
TokenSource oauth2.TokenSource
|
||||
AuthTokenHeaderName string
|
||||
}
|
||||
|
||||
func (s *Source) SourceKind() string {
|
||||
@@ -157,7 +165,11 @@ func (s *Source) GetApiSettings() *rtl.ApiSettings {
|
||||
}
|
||||
|
||||
func (s *Source) UseClientAuthorization() bool {
|
||||
return s.UseClientOAuth
|
||||
return strings.ToLower(s.UseClientOAuth) != "false"
|
||||
}
|
||||
|
||||
func (s *Source) GetAuthTokenHeaderName() string {
|
||||
return s.AuthTokenHeaderName
|
||||
}
|
||||
|
||||
func (s *Source) GoogleCloudProject() string {
|
||||
|
||||
@@ -50,7 +50,7 @@ func TestParseFromYamlLooker(t *testing.T) {
|
||||
ClientSecret: "sdakl;jgflkasdfkfg",
|
||||
Timeout: "600s",
|
||||
SslVerification: true,
|
||||
UseClientOAuth: false,
|
||||
UseClientOAuth: "false",
|
||||
ShowHiddenModels: true,
|
||||
ShowHiddenExplores: true,
|
||||
ShowHiddenFields: true,
|
||||
|
||||
@@ -201,3 +201,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.Source.UseClientAuthorization()
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -211,3 +211,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.Source.UseClientAuthorization()
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -212,3 +212,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.Source.UseClientAuthorization()
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -170,3 +170,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.Source.UseClientAuthorization()
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -175,3 +175,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.Source.UseClientAuthorization()
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -175,3 +175,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.Source.UseClientAuthorization()
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -165,3 +165,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.Source.UseClientAuthorization()
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -170,3 +170,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.Source.UseClientAuthorization()
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -170,3 +170,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.Source.UseClientAuthorization()
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -366,3 +366,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.Source.UseClientAuthorization()
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -206,3 +206,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -388,3 +388,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.UseClientOAuth
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -579,3 +579,7 @@ func appendMessage(messages []map[string]any, newMessage map[string]any) []map[s
|
||||
}
|
||||
return append(messages, newMessage)
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -377,3 +377,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.UseClientOAuth
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -352,3 +352,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.UseClientOAuth
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -196,3 +196,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.UseClientOAuth
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -206,3 +206,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.UseClientOAuth
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -200,3 +200,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.UseClientOAuth
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -211,3 +211,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.UseClientOAuth
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -287,3 +287,7 @@ func (t Tool) McpManifest() tools.McpManifest {
|
||||
// Returns the tool MCP manifest
|
||||
return t.mcpManifest
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -314,3 +314,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.UseClientOAuth
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -227,3 +227,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
gocql "github.com/apache/cassandra-gocql-driver/v2"
|
||||
yaml "github.com/goccy/go-yaml"
|
||||
"github.com/gocql/gocql"
|
||||
"github.com/googleapis/genai-toolbox/internal/sources"
|
||||
"github.com/googleapis/genai-toolbox/internal/sources/cassandra"
|
||||
"github.com/googleapis/genai-toolbox/internal/tools"
|
||||
@@ -135,7 +135,7 @@ func (t Tool) Invoke(ctx context.Context, params parameters.ParamValues, accessT
|
||||
return nil, fmt.Errorf("unable to extract standard params %w", err)
|
||||
}
|
||||
sliceParams := newParams.AsSlice()
|
||||
iter := t.Session.Query(newStatement, sliceParams...).WithContext(ctx).Iter()
|
||||
iter := t.Session.Query(newStatement, sliceParams...).IterContext(ctx)
|
||||
|
||||
// Create a slice to store the out
|
||||
var out []map[string]interface{}
|
||||
@@ -171,3 +171,7 @@ func (t Tool) ParseParams(data map[string]any, claims map[string]map[string]any)
|
||||
}
|
||||
|
||||
var _ tools.Tool = Tool{}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -186,3 +186,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -149,3 +149,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -160,3 +160,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -194,3 +194,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -204,3 +204,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.UseClientOAuth
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -228,3 +228,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.UseClientOAuth
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -301,3 +301,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.UseClientOAuth
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -164,3 +164,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.UseClientOAuth
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -175,3 +175,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.UseClientOAuth
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -175,3 +175,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.UseClientOAuth
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -207,3 +207,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.UseClientOAuth
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -175,3 +175,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.UseClientOAuth
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -175,3 +175,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.UseClientOAuth
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -183,3 +183,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.UseClientOAuth
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -183,3 +183,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.UseClientOAuth
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -217,3 +217,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.UseClientOAuth
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -247,3 +247,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.UseClientOAuth
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -230,3 +230,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.UseClientOAuth
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -214,3 +214,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.UseClientOAuth
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -178,3 +178,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -172,3 +172,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.Source.UseClientAuthorization()
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -185,3 +185,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.Source.UseClientAuthorization()
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -161,3 +161,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.Source.UseClientAuthorization()
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -179,3 +179,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.Source.UseClientAuthorization()
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -172,3 +172,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.source.UseClientAuthorization()
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -407,3 +407,7 @@ func (t Tool) fetchInstanceData(ctx context.Context, project, instance string) (
|
||||
}
|
||||
return data, nil
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -203,3 +203,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.Source.UseClientAuthorization()
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -203,3 +203,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.Source.UseClientAuthorization()
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -203,3 +203,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.Source.UseClientAuthorization()
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,243 @@
|
||||
// Copyright 2025 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package cloudsqlpgupgradeprecheck
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
yaml "github.com/goccy/go-yaml"
|
||||
"github.com/googleapis/genai-toolbox/internal/sources"
|
||||
"github.com/googleapis/genai-toolbox/internal/sources/cloudsqladmin"
|
||||
"github.com/googleapis/genai-toolbox/internal/tools"
|
||||
"github.com/googleapis/genai-toolbox/internal/util/parameters"
|
||||
sqladmin "google.golang.org/api/sqladmin/v1"
|
||||
)
|
||||
|
||||
const kind string = "postgres-upgrade-precheck"
|
||||
|
||||
func init() {
|
||||
if !tools.Register(kind, newConfig) {
|
||||
panic(fmt.Sprintf("tool kind %q already registered", kind))
|
||||
}
|
||||
}
|
||||
|
||||
func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (tools.ToolConfig, error) {
|
||||
actual := Config{Name: name}
|
||||
if err := decoder.DecodeContext(ctx, &actual); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return actual, nil
|
||||
}
|
||||
|
||||
// Config defines the configuration for the precheck-upgrade tool.
|
||||
type Config struct {
|
||||
Name string `yaml:"name" validate:"required"`
|
||||
Kind string `yaml:"kind" validate:"required"`
|
||||
Description string `yaml:"description"`
|
||||
Source string `yaml:"source" validate:"required"`
|
||||
AuthRequired []string `yaml:"authRequired"`
|
||||
}
|
||||
|
||||
// validate interface
|
||||
var _ tools.ToolConfig = Config{}
|
||||
|
||||
// ToolConfigKind returns the kind of the tool.
|
||||
func (cfg Config) ToolConfigKind() string {
|
||||
return kind
|
||||
}
|
||||
|
||||
// Initialize initializes the tool from the configuration.
|
||||
func (cfg Config) Initialize(srcs map[string]sources.Source) (tools.Tool, error) {
|
||||
rawS, ok := srcs[cfg.Source]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("no source named %q configured", cfg.Source)
|
||||
}
|
||||
s, ok := rawS.(*cloudsqladmin.Source)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("invalid source for %q tool: source kind must be `cloud-sql-admin`", kind)
|
||||
}
|
||||
|
||||
allParameters := parameters.Parameters{
|
||||
parameters.NewStringParameter("project", "The project ID"),
|
||||
parameters.NewStringParameter("instance", "The name of the instance to check"),
|
||||
parameters.NewStringParameterWithDefault("targetDatabaseVersion", "POSTGRES_18", "The target PostgreSQL version for the upgrade (e.g., POSTGRES_18). If not specified, defaults to the PostgreSQL 18."),
|
||||
}
|
||||
paramManifest := allParameters.Manifest()
|
||||
|
||||
description := cfg.Description
|
||||
if description == "" {
|
||||
description = "Analyzes a Cloud SQL PostgreSQL instance for major version upgrade readiness. Results are provided to guide customer actions:\n" +
|
||||
"ERROR: Action Required. These are critical issues blocking the upgrade. Customers must resolve these using the provided actions_required steps before attempting the upgrade.\n" +
|
||||
"WARNING: Review Recommended. These are potential issues. Customers should review the message and actions_required. While not blocking, addressing these is advised to prevent future problems or unexpected behavior post-upgrade.\n" +
|
||||
"INFO: No Action Needed. Informational messages only. This pre-check helps customers proactively fix problems, preventing upgrade failures and ensuring a smoother transition."
|
||||
}
|
||||
mcpManifest := tools.GetMcpManifest(cfg.Name, description, cfg.AuthRequired, allParameters)
|
||||
|
||||
return Tool{
|
||||
Name: cfg.Name,
|
||||
Kind: kind,
|
||||
AuthRequired: cfg.AuthRequired,
|
||||
Source: s,
|
||||
AllParams: allParameters,
|
||||
manifest: tools.Manifest{Description: description, Parameters: paramManifest, AuthRequired: cfg.AuthRequired},
|
||||
mcpManifest: mcpManifest,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Tool represents the precheck-upgrade tool.
|
||||
type Tool struct {
|
||||
Name string `yaml:"name"`
|
||||
Kind string `yaml:"kind"`
|
||||
Description string `yaml:"description"`
|
||||
AuthRequired []string `yaml:"authRequired"`
|
||||
|
||||
Source *cloudsqladmin.Source
|
||||
AllParams parameters.Parameters `yaml:"allParams"`
|
||||
manifest tools.Manifest
|
||||
mcpManifest tools.McpManifest
|
||||
Config
|
||||
}
|
||||
|
||||
// PreCheckResultItem holds the details of a single check result.
|
||||
type PreCheckResultItem struct {
|
||||
Message string `json:"message"`
|
||||
MessageType string `json:"messageType"` // INFO, WARNING, ERROR
|
||||
ActionsRequired []string `json:"actionsRequired"`
|
||||
}
|
||||
|
||||
// PreCheckAPIResponse holds the array of pre-check results.
|
||||
type PreCheckAPIResponse struct {
|
||||
Items []PreCheckResultItem `json:"preCheckResponse"`
|
||||
}
|
||||
|
||||
// Helper function to convert from []*sqladmin.PreCheckResponse to []PreCheckResultItem
|
||||
func convertResults(items []*sqladmin.PreCheckResponse) []PreCheckResultItem {
|
||||
if len(items) == 0 { // Handle nil or empty slice
|
||||
return []PreCheckResultItem{}
|
||||
}
|
||||
results := make([]PreCheckResultItem, len(items))
|
||||
for i, item := range items {
|
||||
results[i] = PreCheckResultItem{
|
||||
Message: item.Message,
|
||||
MessageType: item.MessageType,
|
||||
ActionsRequired: item.ActionsRequired,
|
||||
}
|
||||
}
|
||||
return results
|
||||
}
|
||||
|
||||
func (t Tool) ToConfig() tools.ToolConfig {
|
||||
return t.Config
|
||||
}
|
||||
|
||||
// Invoke executes the tool's logic.
|
||||
func (t Tool) Invoke(ctx context.Context, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) {
|
||||
paramsMap := params.AsMap()
|
||||
|
||||
project, ok := paramsMap["project"].(string)
|
||||
if !ok || project == "" {
|
||||
return nil, fmt.Errorf("missing or empty 'project' parameter")
|
||||
}
|
||||
instanceName, ok := paramsMap["instance"].(string)
|
||||
if !ok || instanceName == "" {
|
||||
return nil, fmt.Errorf("missing or empty 'instance' parameter")
|
||||
}
|
||||
targetVersion, ok := paramsMap["targetDatabaseVersion"].(string)
|
||||
if !ok || targetVersion == "" {
|
||||
// This should not happen due to the default value
|
||||
return nil, fmt.Errorf("missing or empty 'targetDatabaseVersion' parameter")
|
||||
}
|
||||
|
||||
service, err := t.Source.GetService(ctx, string(accessToken))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get HTTP client from source: %w", err)
|
||||
}
|
||||
|
||||
reqBody := &sqladmin.InstancesPreCheckMajorVersionUpgradeRequest{
|
||||
PreCheckMajorVersionUpgradeContext: &sqladmin.PreCheckMajorVersionUpgradeContext{
|
||||
TargetDatabaseVersion: targetVersion,
|
||||
},
|
||||
}
|
||||
|
||||
call := service.Instances.PreCheckMajorVersionUpgrade(project, instanceName, reqBody).Context(ctx)
|
||||
op, err := call.Do()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to start pre-check operation: %w", err)
|
||||
}
|
||||
|
||||
const pollTimeout = 20 * time.Second
|
||||
cutoffTime := time.Now().Add(pollTimeout)
|
||||
|
||||
for time.Now().Before(cutoffTime) {
|
||||
currentOp, err := service.Operations.Get(project, op.Name).Context(ctx).Do()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get operation status: %w", err)
|
||||
}
|
||||
|
||||
if currentOp.Status == "DONE" {
|
||||
if currentOp.Error != nil && len(currentOp.Error.Errors) > 0 {
|
||||
errMsg := fmt.Sprintf("pre-check operation LRO failed: %s", currentOp.Error.Errors[0].Message)
|
||||
if currentOp.Error.Errors[0].Code != "" {
|
||||
errMsg = fmt.Sprintf("%s (Code: %s)", errMsg, currentOp.Error.Errors[0].Code)
|
||||
}
|
||||
return nil, fmt.Errorf("%s", errMsg)
|
||||
}
|
||||
|
||||
var preCheckItems []*sqladmin.PreCheckResponse
|
||||
if currentOp.PreCheckMajorVersionUpgradeContext != nil {
|
||||
preCheckItems = currentOp.PreCheckMajorVersionUpgradeContext.PreCheckResponse
|
||||
}
|
||||
// convertResults handles nil or empty preCheckItems
|
||||
return PreCheckAPIResponse{Items: convertResults(preCheckItems)}, nil
|
||||
}
|
||||
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return nil, ctx.Err()
|
||||
case <-time.After(5 * time.Second):
|
||||
}
|
||||
}
|
||||
return op, nil
|
||||
}
|
||||
|
||||
// ParseParams parses the parameters for the tool.
|
||||
func (t Tool) ParseParams(data map[string]any, claims map[string]map[string]any) (parameters.ParamValues, error) {
|
||||
return parameters.ParseParams(t.AllParams, data, claims)
|
||||
}
|
||||
|
||||
// Manifest returns the tool's manifest.
|
||||
func (t Tool) Manifest() tools.Manifest {
|
||||
return t.manifest
|
||||
}
|
||||
|
||||
// McpManifest returns the tool's MCP manifest.
|
||||
func (t Tool) McpManifest() tools.McpManifest {
|
||||
return t.mcpManifest
|
||||
}
|
||||
|
||||
// Authorized checks if the tool is authorized.
|
||||
func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return t.Source.UseClientAuthorization()
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
// Copyright 2025 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package cloudsqlpgupgradeprecheck_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
yaml "github.com/goccy/go-yaml"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/googleapis/genai-toolbox/internal/server"
|
||||
"github.com/googleapis/genai-toolbox/internal/testutils"
|
||||
"github.com/googleapis/genai-toolbox/internal/tools/cloudsqlpg/cloudsqlpgupgradeprecheck"
|
||||
)
|
||||
|
||||
func TestParseFromYaml(t *testing.T) {
|
||||
ctx, err := testutils.ContextWithNewLogger()
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %s", err)
|
||||
}
|
||||
tcs := []struct {
|
||||
desc string
|
||||
in string
|
||||
want server.ToolConfigs
|
||||
}{
|
||||
{
|
||||
desc: "basic precheck example",
|
||||
in: `
|
||||
tools:
|
||||
precheck-upgrade-tool:
|
||||
kind: postgres-upgrade-precheck
|
||||
description: a precheck test description
|
||||
source: some-admin-source
|
||||
authRequired:
|
||||
- https://www.googleapis.com/auth/cloud-platform
|
||||
`,
|
||||
want: server.ToolConfigs{
|
||||
"precheck-upgrade-tool": cloudsqlpgupgradeprecheck.Config{
|
||||
Name: "precheck-upgrade-tool",
|
||||
Kind: "postgres-upgrade-precheck",
|
||||
Description: "a precheck test description",
|
||||
Source: "some-admin-source",
|
||||
AuthRequired: []string{"https://www.googleapis.com/auth/cloud-platform"},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "precheck example with no auth",
|
||||
in: `
|
||||
tools:
|
||||
precheck-upgrade-tool-no-auth:
|
||||
kind: postgres-upgrade-precheck
|
||||
description: a precheck test description no auth
|
||||
source: other-admin-source
|
||||
`,
|
||||
want: server.ToolConfigs{
|
||||
"precheck-upgrade-tool-no-auth": cloudsqlpgupgradeprecheck.Config{
|
||||
Name: "precheck-upgrade-tool-no-auth",
|
||||
Kind: "postgres-upgrade-precheck",
|
||||
Description: "a precheck test description no auth",
|
||||
Source: "other-admin-source",
|
||||
AuthRequired: []string{},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, tc := range tcs {
|
||||
t.Run(tc.desc, func(t *testing.T) {
|
||||
got := struct {
|
||||
Tools server.ToolConfigs `yaml:"tools"`
|
||||
}{}
|
||||
// Parse contents
|
||||
err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to unmarshal: %s", err)
|
||||
}
|
||||
if diff := cmp.Diff(tc.want, got.Tools); diff != "" {
|
||||
t.Fatalf("incorrect parse: diff (-want +got):\n%s", diff)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -169,3 +169,7 @@ func (t Tool) Authorized(verifiedAuthSources []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -121,3 +121,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -182,3 +182,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -195,3 +195,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
@@ -166,3 +166,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool {
|
||||
func (t Tool) RequiresClientAuthorization() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (t Tool) GetAuthTokenHeaderName() string {
|
||||
return "Authorization"
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user