Skip to content

Commit 929761d

Browse files
committed
deploy: feat(embeddingModel): Add Backend API selection fields (googleapis#2592)
Allow users to use both VertexAI and Google AI as gemini embedding model backend. - Use ADC for VertexAI authentication (either configure `project` and `location` inside the yaml file or as env vars). - Use API key for Google AI authentication. 912aa9e
1 parent 7de043f commit 929761d

33 files changed

+99
-67
lines changed

dev/documentation/configuration/embedding-models/gemini/index.html

Lines changed: 22 additions & 12 deletions
Large diffs are not rendered by default.

dev/documentation/configuration/embedding-models/index.html

Lines changed: 4 additions & 2 deletions
Large diffs are not rendered by default.

dev/documentation/configuration/embedding-models/index.xml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@
22
<p>Google Gemini provides state-of-the-art embedding models that convert text into
33
high-dimensional vectors.</p>
44
<h3 id="authentication">Authentication</h3>
5-
<p>Toolbox uses your <a href="https://cloud.google.com/docs/authentication#adc">Application Default Credentials
6-
(ADC)</a> to authorize with the
7-
Gemini API client.</p>
8-
<p>Optionally, you can use an <a href="https://ai.google.dev/gemini-api/docs/api-key#api-keys">API key</a> obtain an API
9-
Key from the <a href="https://aistudio.google.com/app/apikey">Google AI Studio</a>.</p>
10-
<p>We recommend using an API key for testing and using application default
11-
credentials for production.</p>
12-
<h2 id="behavior">Behavior</h2>
13-
<h3 id="automatic-vectorization">Automatic Vectorization</h3>
14-
<p>When a tool parameter is configured with <code>embeddedBy: <your-gemini-model-name></code>,
15-
the Toolbox intercepts the raw text input from the client and sends it to the
16-
Gemini API. The resulting numerical array is then formatted before being passed
17-
to your database source.&lt;/p></description></item></channel></rss>
5+
&lt;p>Toolbox supports two authentication modes:&lt;/p>
6+
&lt;ol>
7+
&lt;li>&lt;strong>Google AI (API Key):&lt;/strong> Used if you
8+
provide &lt;code>apiKey&lt;/code> (or set &lt;code>GOOGLE_API_KEY&lt;/code>/&lt;code>GEMINI_API_KEY&lt;/code> environment
9+
variables). This uses the &lt;a href="https://aistudio.google.com/app/apikey">Google AI Studio&lt;/a> backend.&lt;/li>
10+
&lt;li>&lt;strong>Vertex AI (ADC):&lt;/strong> Used if provided &lt;code>project&lt;/code> and &lt;code>location&lt;/code> (or set
11+
&lt;code>GOOGLE_CLOUD_PROJECT&lt;/code>/&lt;code>GOOGLE_CLOUD_LOCATION&lt;/code> environment variables). This uses &lt;a href="https://cloud.google.com/docs/authentication#adc">Application
12+
Default Credentials (ADC)&lt;/a>.&lt;/li>
13+
&lt;/ol>
14+
&lt;p>We recommend using an API key for quick testing and using Vertex AI with ADC for
15+
production environments.&lt;/p></description></item></channel></rss>

dev/index.xml

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4140,19 +4140,17 @@ reporting with source positions and code snippets.&lt;/p>
41404140
&lt;p>Google Gemini provides state-of-the-art embedding models that convert text into
41414141
high-dimensional vectors.&lt;/p>
41424142
&lt;h3 id="authentication">Authentication&lt;/h3>
4143-
&lt;p>Toolbox uses your &lt;a href="https://cloud.google.com/docs/authentication#adc">Application Default Credentials
4144-
(ADC)&lt;/a> to authorize with the
4145-
Gemini API client.&lt;/p>
4146-
&lt;p>Optionally, you can use an &lt;a href="https://ai.google.dev/gemini-api/docs/api-key#api-keys">API key&lt;/a> obtain an API
4147-
Key from the &lt;a href="https://aistudio.google.com/app/apikey">Google AI Studio&lt;/a>.&lt;/p>
4148-
&lt;p>We recommend using an API key for testing and using application default
4149-
credentials for production.&lt;/p>
4150-
&lt;h2 id="behavior">Behavior&lt;/h2>
4151-
&lt;h3 id="automatic-vectorization">Automatic Vectorization&lt;/h3>
4152-
&lt;p>When a tool parameter is configured with &lt;code>embeddedBy: &amp;lt;your-gemini-model-name&amp;gt;&lt;/code>,
4153-
the Toolbox intercepts the raw text input from the client and sends it to the
4154-
Gemini API. The resulting numerical array is then formatted before being passed
4155-
to your database source.&lt;/p></description></item><item><title>Google Sign-In</title><link>https://mcp-toolbox.dev/dev/documentation/configuration/authentication/google/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mcp-toolbox.dev/dev/documentation/configuration/authentication/google/</guid><description>&lt;h2 id="getting-started">Getting Started&lt;/h2>
4143+
&lt;p>Toolbox supports two authentication modes:&lt;/p>
4144+
&lt;ol>
4145+
&lt;li>&lt;strong>Google AI (API Key):&lt;/strong> Used if you
4146+
provide &lt;code>apiKey&lt;/code> (or set &lt;code>GOOGLE_API_KEY&lt;/code>/&lt;code>GEMINI_API_KEY&lt;/code> environment
4147+
variables). This uses the &lt;a href="https://aistudio.google.com/app/apikey">Google AI Studio&lt;/a> backend.&lt;/li>
4148+
&lt;li>&lt;strong>Vertex AI (ADC):&lt;/strong> Used if provided &lt;code>project&lt;/code> and &lt;code>location&lt;/code> (or set
4149+
&lt;code>GOOGLE_CLOUD_PROJECT&lt;/code>/&lt;code>GOOGLE_CLOUD_LOCATION&lt;/code> environment variables). This uses &lt;a href="https://cloud.google.com/docs/authentication#adc">Application
4150+
Default Credentials (ADC)&lt;/a>.&lt;/li>
4151+
&lt;/ol>
4152+
&lt;p>We recommend using an API key for quick testing and using Vertex AI with ADC for
4153+
production environments.&lt;/p></description></item><item><title>Google Sign-In</title><link>https://mcp-toolbox.dev/dev/documentation/configuration/authentication/google/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mcp-toolbox.dev/dev/documentation/configuration/authentication/google/</guid><description>&lt;h2 id="getting-started">Getting Started&lt;/h2>
41564154
&lt;p>Google Sign-In manages the OAuth 2.0 flow and token lifecycle. To integrate the
41574155
Google Sign-In workflow to your web app &lt;a href="https://developers.google.com/identity/sign-in/web/sign-in">follow this guide&lt;/a>.&lt;/p>
41584156
&lt;p>After setting up the Google Sign-In workflow, you should have registered your
@@ -7417,7 +7415,7 @@ returned. Otherwise, the selection is not guaranteed.&lt;/p>
74177415
&lt;p>The tool returns a single JSON object representing the document, wrapped in a
74187416
JSON array.&lt;/p>
74197417
&lt;h2 id="compatible-sources">Compatible Sources&lt;/h2>
7420-
&lt;h2 id="hahahugoshortcode339s0hbhb">
7418+
&lt;h2 id="hahahugoshortcode340s0hbhb">
74217419

74227420

74237421
&lt;div class="compatibility-section">

dev/integrations/mongodb/tools/index.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ returned. Otherwise, the selection is not guaranteed.&lt;/p>
9494
&lt;p>The tool returns a single JSON object representing the document, wrapped in a
9595
JSON array.&lt;/p>
9696
&lt;h2 id="compatible-sources">Compatible Sources&lt;/h2>
97-
&lt;h2 id="hahahugoshortcode339s0hbhb">
97+
&lt;h2 id="hahahugoshortcode340s0hbhb">
9898

9999

100100
&lt;div class="compatibility-section">

dev/integrations/mongodb/tools/mongodb-find-one/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,11 +506,11 @@
506506
<a href=https://github.com/googleapis/genai-toolbox/edit/main/docs/en/integrations/mongodb/tools/mongodb-find-one.md class="td-page-meta--edit td-page-meta__edit" target=_blank rel=noopener><i class="fa-solid fa-pen-to-square fa-fw"></i> Edit this page</a>
507507
<a href="https://github.com/googleapis/genai-toolbox/new/main/docs/en/integrations/mongodb/tools?filename=change-me.md&amp;value=---%0Atitle%3A+%22Long+Page+Title%22%0AlinkTitle%3A+%22Short+Nav+Title%22%0Aweight%3A+100%0Adescription%3A+%3E-%0A+++++Page+description+for+heading+and+indexes.%0A---%0A%0A%23%23+Heading%0A%0AEdit+this+template+to+create+your+new+page.%0A%0A%2A+Give+it+a+good+name%2C+ending+in+%60.md%60+-+e.g.+%60getting-started.md%60%0A%2A+Edit+the+%22front+matter%22+section+at+the+top+of+the+page+%28weight+controls+how+its+ordered+amongst+other+pages+in+the+same+directory%3B+lowest+number+first%29.%0A%2A+Add+a+good+commit+message+at+the+bottom+of+the+page+%28%3C80+characters%3B+use+the+extended+description+field+for+more+detail%29.%0A%2A+Create+a+new+branch+so+you+can+preview+your+new+file+and+request+a+review+via+Pull+Request.%0A" class="td-page-meta--child td-page-meta__child" target=_blank rel=noopener><i class="fa-solid fa-pen-to-square fa-fw"></i> Create child page</a>
508508
<a href="https://github.com/googleapis/genai-toolbox/issues/new?title=mongodb-find-one" class="td-page-meta--issue td-page-meta__issue" target=_blank rel=noopener><i class="fa-solid fa-list-check fa-fw"></i> Create documentation issue</a>
509-
<a href=https://github.com/googleapis/genai-toolbox/issues/new class="td-page-meta--project td-page-meta__project-issue" target=_blank rel=noopener><i class="fa-solid fa-list-check fa-fw"></i> Create project issue</a></div><div class=td-toc><nav id=TableOfContents><ul><li><a href=#about>About</a></li><li><a href=#compatible-sources>Compatible Sources</a></li><li><a href=#hahahugoshortcode339s0hbhb>HAHAHUGOSHORTCODE339s0HBHB</a></li><li><a href=#example>Example</a></li><li><a href=#reference>Reference</a></li></ul></nav></div></aside><main class="col-12 col-md-9 col-xl-8 ps-md-5" role=main><nav aria-label=breadcrumb class=td-breadcrumbs><ol class=breadcrumb><li class=breadcrumb-item><a href=/dev/integrations/>Integrations</a></li><li class=breadcrumb-item><a href=/dev/integrations/mongodb/>MongoDB</a></li><li class=breadcrumb-item><a href=/dev/integrations/mongodb/tools/>Tools</a></li><li class="breadcrumb-item active" aria-current=page>mongodb-find-one</li></ol></nav><div class=td-content><h1>mongodb-find-one</h1><div class=lead>A &ldquo;mongodb-find-one&rdquo; tool finds and retrieves a single document from a MongoDB collection.</div><header class=article-meta><p class=reading-time><i class="fa-solid fa-clock" aria-hidden=true></i>&nbsp; 2 minute read &nbsp;</p></header><h2 id=about>About</h2><p>A <code>mongodb-find-one</code> tool is used to retrieve the <strong>first single document</strong> that
509+
<a href=https://github.com/googleapis/genai-toolbox/issues/new class="td-page-meta--project td-page-meta__project-issue" target=_blank rel=noopener><i class="fa-solid fa-list-check fa-fw"></i> Create project issue</a></div><div class=td-toc><nav id=TableOfContents><ul><li><a href=#about>About</a></li><li><a href=#compatible-sources>Compatible Sources</a></li><li><a href=#hahahugoshortcode340s0hbhb>HAHAHUGOSHORTCODE340s0HBHB</a></li><li><a href=#example>Example</a></li><li><a href=#reference>Reference</a></li></ul></nav></div></aside><main class="col-12 col-md-9 col-xl-8 ps-md-5" role=main><nav aria-label=breadcrumb class=td-breadcrumbs><ol class=breadcrumb><li class=breadcrumb-item><a href=/dev/integrations/>Integrations</a></li><li class=breadcrumb-item><a href=/dev/integrations/mongodb/>MongoDB</a></li><li class=breadcrumb-item><a href=/dev/integrations/mongodb/tools/>Tools</a></li><li class="breadcrumb-item active" aria-current=page>mongodb-find-one</li></ol></nav><div class=td-content><h1>mongodb-find-one</h1><div class=lead>A &ldquo;mongodb-find-one&rdquo; tool finds and retrieves a single document from a MongoDB collection.</div><header class=article-meta><p class=reading-time><i class="fa-solid fa-clock" aria-hidden=true></i>&nbsp; 2 minute read &nbsp;</p></header><h2 id=about>About</h2><p>A <code>mongodb-find-one</code> tool is used to retrieve the <strong>first single document</strong> that
510510
matches a specified filter from a MongoDB collection. If multiple documents
511511
match the filter, you can use <code>sort</code> options to control which document is
512512
returned. Otherwise, the selection is not guaranteed.</p><p>The tool returns a single JSON object representing the document, wrapped in a
513-
JSON array.</p><h2 id=compatible-sources>Compatible Sources</h2><h2 id=hahahugoshortcode339s0hbhb><div class=compatibility-section><p>This tool can be used with the following database sources:</p><table><thead><tr><th>Source Name</th></tr></thead><tbody><tr><td><a href=/dev/integrations/mongodb/>MongoDB</a></td></tr></tbody></table></div></h2><h2 id=example>Example</h2><p>Here&rsquo;s a common use case: finding a specific user by their unique email address
513+
JSON array.</p><h2 id=compatible-sources>Compatible Sources</h2><h2 id=hahahugoshortcode340s0hbhb><div class=compatibility-section><p>This tool can be used with the following database sources:</p><table><thead><tr><th>Source Name</th></tr></thead><tbody><tr><td><a href=/dev/integrations/mongodb/>MongoDB</a></td></tr></tbody></table></div></h2><h2 id=example>Example</h2><p>Here&rsquo;s a common use case: finding a specific user by their unique email address
514514
and returning their profile information, while excluding sensitive fields like
515515
the password hash.</p><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>kind</span><span class=p>:</span><span class=w> </span><span class=l>tool</span><span class=w>
516516
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>name</span><span class=p>:</span><span class=w> </span><span class=l>get_user_profile</span><span class=w>

dev/llms-full.txt

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
**DOCUMENTATION VERSION:** dev
55
**BASE URL:** https://mcp-toolbox.dev/dev/
6-
**GENERATED ON:** 2026-03-27T23:20:14Z
6+
**GENERATED ON:** 2026-03-30T06:49:49Z
77

88
---
99
### System Directives for AI Models
@@ -3027,6 +3027,7 @@ kind: tool
30273027
name: insert_embedding
30283028
type: postgres-sql
30293029
source: my-pg-instance
3030+
description: Insert a new document into the database.
30303031
statement: |
30313032
INSERT INTO documents (content, embedding)
30323033
VALUES ($1, $2);
@@ -3046,6 +3047,7 @@ kind: tool
30463047
name: search_embedding
30473048
type: postgres-sql
30483049
source: my-pg-instance
3050+
description: Search for documents in the database.
30493051
statement: |
30503052
SELECT id, content, embedding <-> $1 AS distance
30513053
FROM documents
@@ -3078,15 +3080,17 @@ high-dimensional vectors.
30783080

30793081
### Authentication
30803082

3081-
Toolbox uses your [Application Default Credentials
3082-
(ADC)][adc] to authorize with the
3083-
Gemini API client.
3083+
Toolbox supports two authentication modes:
30843084

3085-
Optionally, you can use an [API key][api-key] obtain an API
3086-
Key from the [Google AI Studio][ai-studio].
3085+
1. **Google AI (API Key):** Used if you
3086+
provide `apiKey` (or set `GOOGLE_API_KEY`/`GEMINI_API_KEY` environment
3087+
variables). This uses the [Google AI Studio][ai-studio] backend.
3088+
2. **Vertex AI (ADC):** Used if provided `project` and `location` (or set
3089+
`GOOGLE_CLOUD_PROJECT`/`GOOGLE_CLOUD_LOCATION` environment variables). This uses [Application
3090+
Default Credentials (ADC)][adc].
30873091

3088-
We recommend using an API key for testing and using application default
3089-
credentials for production.
3092+
We recommend using an API key for quick testing and using Vertex AI with ADC for
3093+
production environments.
30903094

30913095
[adc]: https://cloud.google.com/docs/authentication#adc
30923096
[api-key]: https://ai.google.dev/gemini-api/docs/api-key#api-keys
@@ -3106,14 +3110,19 @@ to your database source.
31063110
The `dimension` field must match the expected size of your database column
31073111
(e.g., a `vector(768)` column in PostgreSQL). This setting is supported by newer
31083112
models since 2024 only. You cannot set this value if using the earlier model
3109-
(`models/embedding-001`). Check out [available Gemini models][modellist] for more
3110-
information.
3113+
(`models/embedding-001`). Check out [available Gemini models][modellist] for
3114+
more information.
31113115

31123116
[modellist]:
3113-
https://docs.cloud.google.com/vertex-ai/generative-ai/docs/embeddings/get-text-embeddings#supported-models
3117+
https://docs.cloud.google.com/vertex-ai/generative-ai/docs/embeddings/get-text-embeddings#supported-models
31143118

31153119
## Example
31163120

3121+
### Using Google AI
3122+
3123+
Google AI uses API Key for authentication. You can get an API key from [Google
3124+
AI Studio][ai-studio].
3125+
31173126
```yaml
31183127
kind: embeddingModel
31193128
name: gemini-model
@@ -3123,19 +3132,34 @@ apiKey: ${GOOGLE_API_KEY}
31233132
dimension: 768
31243133
```
31253134

3126-
{{< notice tip >}}
3127-
Use environment variable replacement with the format ${ENV_NAME}
3128-
instead of hardcoding your secrets into the configuration file.
3135+
### Using Vertex AI
3136+
3137+
Vertex AI uses Application Default Credentials (ADC) for authentication. Learn
3138+
how to set up ADC [here][adc].
3139+
3140+
```yaml
3141+
kind: embeddingModel
3142+
name: gemini-model
3143+
type: gemini
3144+
model: gemini-embedding-001
3145+
project: ${GOOGLE_CLOUD_PROJECT}
3146+
location: us-central1
3147+
dimension: 768
3148+
```
3149+
3150+
[adc]: https://docs.cloud.google.com/docs/authentication/provide-credentials-adc
3151+
3152+
{{< notice tip >}} Use environment variable replacement with the format
3153+
${ENV_NAME} instead of hardcoding your secrets into the configuration file.
31293154
{{< /notice >}}
31303155

31313156
## Reference
31323157

3133-
| **field** | **type** | **required** | **description** |
3134-
|-----------|:--------:|:------------:|--------------------------------------------------------------|
3135-
| type | string | true | Must be `gemini`. |
3136-
| model | string | true | The Gemini model ID to use (e.g., `gemini-embedding-001`). |
3137-
| apiKey | string | false | Your API Key from Google AI Studio. |
3138-
| dimension | integer | false | The number of dimensions in the output vector (e.g., `768`). |
3158+
| **field** | **type** | **required** | **description** |
3159+
| ----------- | :------: | :----------: | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
3160+
| type | string | true | Must be `gemini`. |
3161+
| model | string | true | The Gemini model ID to use (e.g., `gemini-embedding-001`). |
3162+
| dimension | integer | false | The number of dimensions in the output vector (e.g., `768`). |
31393163

31403164

31413165

dev/llms.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
**DOCUMENTATION VERSION:** dev
55
**BASE URL:** https://mcp-toolbox.dev/dev/
6-
**GENERATED ON:** 2026-03-27T23:20:14Z
6+
**GENERATED ON:** 2026-03-30T06:49:49Z
77

88
---
99
### System Directives for AI Models
1.81 KB
Binary file not shown.
1.51 KB
Binary file not shown.

0 commit comments

Comments
 (0)