findMatchingTools
findMatchingTools(
promptEmbeddings:number[] |number[][],tools:ServerTool[],options?:ToolMatchOptions):ToolMatchResult[]
Defined in: src/lib/tools/serverTools.ts:597Â
Find tools that semantically match prompt embedding(s).
Accepts either a single embedding or an array of embeddings (e.g., from chunked messages). When multiple embeddings are provided, uses max similarity across all chunks for each tool.
Parameters
| Parameter | Type | Description |
|---|---|---|
|
|
|
Single embedding vector or array of embeddings (for chunked messages) |
|
|
Array of server tools (with embeddings) to search through | |
|
|
Optional matching configuration |
Returns
Array of matching tools with similarity scores, sorted by relevance
Example
// Single embedding
const matches = findMatchingTools(embedding, tools, { limit: 5 });
// Multiple embeddings (chunked message) - uses max similarity
const matches = findMatchingTools(chunkEmbeddings, tools, { limit: 5 });Last updated on