ollama_embed_search
Embed search (ad-hoc). FLAGSHIP. Rank AD-HOC candidates by concept similarity to a query. Pass query + candidates: [{id, text}]; server embeds everything, computes cosine, returns ranked [{id, score, preview?}]. Use this when you have in-memory candidates to compare; for persistent recall over memory/canon/doctrine use ollama_corpus_search instead. Does NOT return raw vectors to you.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
query |
string | yes | — | The question or concept to search for. |
candidates |
object[] | yes | — | Candidates to rank. 1-256 items; text is what gets embedded, id is what gets ranked. |
top_k |
integer | no | — | Return only the top K candidates (default: all of them). |
preview_chars |
integer | no | — | Include this many chars of each candidate’s text in the result (default 0 = no preview). |
Full input schema
Section titled “Full input schema”The JSON Schema below is generated from the same zod schema the server validates against at the wire — it cannot drift from runtime behavior.
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "query": { "type": "string", "minLength": 1, "description": "The question or concept to search for." }, "candidates": { "minItems": 1, "maxItems": 256, "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "minLength": 1, "description": "Caller-chosen identifier returned unchanged in the ranking." }, "text": { "type": "string", "minLength": 1, "description": "Candidate text to compare against the query." } }, "required": [ "id", "text" ] }, "description": "Candidates to rank. 1-256 items; text is what gets embedded, id is what gets ranked." }, "top_k": { "description": "Return only the top K candidates (default: all of them).", "type": "integer", "minimum": 1, "maximum": 256 }, "preview_chars": { "description": "Include this many chars of each candidate's text in the result (default 0 = no preview).", "type": "integer", "minimum": 0, "maximum": 500 } }, "required": [ "query", "candidates" ]}Envelope
Section titled “Envelope”Every tool returns the standard envelope — tier_used, model, tokens_in/tokens_out, elapsed_ms, backend provenance, warnings. See Envelope & tiers.
Source
Section titled “Source”Schema + handler: src/tools/embedSearch.ts · registration: src/index.ts
Back to the Tool Reference.