Skip to content

Commit d42ec2f

Browse files
committed
chore: fix metadata test
1 parent 9a7fda0 commit d42ec2f

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

tests/integration/tools/mongodb/read/aggregate.test.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,19 @@ describeWithMongoDB("aggregate tool", (integration) => {
2727
...databaseCollectionParameters,
2828
{
2929
name: "pipeline",
30-
description:
31-
"An array of aggregation stages to execute. $vectorSearch can only appear as the first stage of the aggregation pipeline or as the first stage of a $unionWith subpipeline. When using $vectorSearch, unless the user explicitly asks for the embeddings, $unset any embedding field to avoid reaching context limits.",
30+
description: `An array of aggregation stages to execute.
31+
\`$vectorSearch\` **MUST** be the first stage of the pipeline, or the first stage of a \`$unionWith\` subpipeline.
32+
### Usage Rules for \`$vectorSearch\`
33+
- **Unset embeddings:**
34+
Unless the user explicitly requests the embeddings, add an \`$unset\` stage **at the end of the pipeline** to remove the embedding field and avoid context limits. **The $unset stage in this situation is mandatory**.
35+
- **Prefiltering:**
36+
If the user requests additional filtering, include filters in \`$vectorSearch.filter\` only for pre-filter fields in the vector index.
37+
NEVER include fields in $vectorSearch.filter that are not part of the vector index.
38+
- **Post-filtering:**
39+
For all remaining filters, add a $match stage after $vectorSearch.
40+
### Note to LLM
41+
- If unsure which fields are filterable, use the collection-indexes tool to determine valid prefilter fields.
42+
- If no requested filters are valid prefilters, omit the filter key from $vectorSearch.`,
3243
type: "array",
3344
required: true,
3445
},

0 commit comments

Comments
 (0)