MongoDBVectorSearchTool
Description
Perform vector similarity queries on MongoDB Atlas collections. Supports index creation helpers and bulk insert of embedded texts. MongoDB Atlas supports native vector search. Learn more: https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-overview/Installation
Install with the MongoDB extra:Parameters
Initialization
connection_string(str, required)database_name(str, required)collection_name(str, required)vector_index_name(str, defaultvector_index)text_key(str, defaulttext)embedding_key(str, defaultembedding)dimensions(int, default1536)
Run Parameters
query(str, required): Natural language query to embed and search.
Quick start
Code
Index creation helpers
Usecreate_vector_search_index(...) to provision an Atlas Vector Search index with the correct dimensions and similarity.
Common issues
- Authentication failures: ensure your Atlas IP Access List allows your runner and the connection string includes credentials.
- Index not found: create the vector index first; name must match
vector_index_name. - Dimensions mismatch: align embedding model dimensions with
dimensions.
More examples
Basic initialization
Code
Custom query configuration
Code
Preloading the database and creating the index
Code
Example
Code
