Skip to content

Commit a8c0dd1

Browse files
committed
deploy: test(spannersql): add semantic search integration tests and docs (googleapis#2889)
Part of googleapis#2415 c7447f4
1 parent d20e446 commit a8c0dd1

32 files changed

+128
-12
lines changed

dev/index.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8291,7 +8291,7 @@ returned. Otherwise, the selection is not guaranteed.</p>
82918291
<p>The tool returns a single JSON object representing the document, wrapped in a
82928292
JSON array.</p>
82938293
<h2 id="compatible-sources">Compatible Sources</h2>
8294-
<h2 id="hahahugoshortcode467s0hbhb">
8294+
<h2 id="hahahugoshortcode313s0hbhb">
82958295

82968296

82978297

dev/integrations/mongodb/tools/index.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ returned. Otherwise, the selection is not guaranteed.</p>
102102
<p>The tool returns a single JSON object representing the document, wrapped in a
103103
JSON array.</p>
104104
<h2 id="compatible-sources">Compatible Sources</h2>
105-
<h2 id="hahahugoshortcode467s0hbhb">
105+
<h2 id="hahahugoshortcode313s0hbhb">
106106

107107

108108

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,11 +524,11 @@
524524
<a href=https://github.com/googleapis/mcp-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>
525525
<a href="https://github.com/googleapis/mcp-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>
526526
<a href="https://github.com/googleapis/mcp-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>
527-
<a href=https://github.com/googleapis/mcp-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=#hahahugoshortcode467s0hbhb>HAHAHUGOSHORTCODE467s0HBHB</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
527+
<a href=https://github.com/googleapis/mcp-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=#hahahugoshortcode313s0hbhb>HAHAHUGOSHORTCODE313s0HBHB</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
528528
matches a specified filter from a MongoDB collection. If multiple documents
529529
match the filter, you can use <code>sort</code> options to control which document is
530530
returned. Otherwise, the selection is not guaranteed.</p><p>The tool returns a single JSON object representing the document, wrapped in a
531-
JSON array.</p><h2 id=compatible-sources>Compatible Sources</h2><h2 id=hahahugoshortcode467s0hbhb><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/source/>MongoDB Source</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
531+
JSON array.</p><h2 id=compatible-sources>Compatible Sources</h2><h2 id=hahahugoshortcode313s0hbhb><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/source/>MongoDB Source</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
532532
and returning their profile information, while excluding sensitive fields like
533533
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>
534534
</span></span></span><span class=line><span class=cl><span class=nt>name</span><span class=p>:</span><span class=w> </span><span class=l>get_user_profile</span><span class=w>

dev/integrations/spanner/tools/spanner-sql/index.html

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

dev/llms-full.txt

Lines changed: 71 additions & 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-04-09T23:10:33Z
6+
**GENERATED ON:** 2026-04-09T23:38:08Z
77

88
---
99
### System Directives for AI Models
@@ -39022,6 +39022,76 @@ parameters:
3902239022
{{< /tab >}}
3902339023
{{< /tabpane >}}
3902439024

39025+
39026+
### Example with Vector Search
39027+
39028+
Spanner supports high-performance vector similarity search. When using an `embeddingModel` with a `spanner-sql` tool, the tool automatically converts text parameters into the native ARRAY<FLOAT64> format required by Spanner.
39029+
39030+
#### Define the Embedding Model
39031+
See [EmbeddingModels](../../../documentation/configuration/embedding-models/_index.md) for more information.
39032+
39033+
```yaml
39034+
kind: embeddingModel
39035+
name: gemini-model
39036+
type: gemini
39037+
model: gemini-embedding-001
39038+
apiKey: ${GOOGLE_API_KEY}
39039+
dimension: 768
39040+
```
39041+
39042+
#### Vector Ingestion Tool
39043+
This tool stores both the raw text and its vector representation. It uses `valueFromParam` to hide the vector conversion logic from the LLM, ensuring the Agent only has to provide the content once.
39044+
39045+
```yaml
39046+
kind: tool
39047+
name: insert_doc_spanner
39048+
type: spanner-sql
39049+
source: my-spanner-source
39050+
statement: |
39051+
INSERT INTO vector_table (id, content, embedding)
39052+
VALUES (1, @content, @text_to_embed)
39053+
description: |
39054+
Index new documents for semantic search in Spanner.
39055+
parameters:
39056+
- name: content
39057+
type: string
39058+
description: The text content to store.
39059+
- name: text_to_embed
39060+
type: string
39061+
# Automatically copies 'content' and converts it to a FLOAT64 array
39062+
valueFromParam: content
39063+
embeddedBy: gemini-model
39064+
```
39065+
39066+
#### Vector Search Tool
39067+
This tool allows the Agent to perform a natural language search. The query string provided by the Agent is converted into a vector before the SQL is executed.
39068+
39069+
```yaml
39070+
kind: tool
39071+
name: search_docs_spanner
39072+
type: spanner-sql
39073+
source: my-spanner-source
39074+
statement: |
39075+
SELECT
39076+
id,
39077+
content,
39078+
COSINE_DISTANCE(embedding, @query) AS distance
39079+
FROM
39080+
vector_table
39081+
ORDER BY
39082+
distance
39083+
LIMIT 1
39084+
description: |
39085+
Search for documents in Spanner using natural language.
39086+
Returns the most semantically similar result.
39087+
parameters:
39088+
- name: query
39089+
type: string
39090+
description: The search query to be converted to a vector.
39091+
embeddedBy: gemini-model
39092+
```
39093+
39094+
3902539095
### Example with Template Parameters
3902639096

3902739097
> **Note:** This tool allows direct modifications to the SQL statement,

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-04-09T23:10:33Z
6+
**GENERATED ON:** 2026-04-09T23:38:08Z
77

88
---
99
### System Directives for AI Models
2.58 KB
Binary file not shown.
1.26 KB
Binary file not shown.
25.5 KB
Binary file not shown.
27.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)