Overview
File:src/tools/CustomDataTool.ts
Demonstrates the powerful Custom Data API with semantic vector search. The example uses a movie database, but the patterns work for any searchable content.
What Makes This Special
Vector Search = Semantic Understanding Traditional search:- Query: “Inception” → Finds “Inception” ✅
- Query: “dream movie” → Finds nothing ❌
- Query: “Inception” → Finds “Inception” ✅
- Query: “dream movie” → Finds “Inception”! ✅
- Query: “mind-bending thriller” → Finds similar movies! ✅
Complete Tools
Create Movie Tool
Search Movies Tool
Get Movie Tool
Key Concepts
1. Search Text is Critical
ThesearchText parameter determines what the AI can find:
2. Similarity Scores
Understanding score thresholds:1.0= Perfect match0.8-0.9= Very similar0.7-0.8= Somewhat similar0.6-0.7= Loosely related<0.6= May be irrelevant
3. Natural Language Queries
Users can search naturally:Testing
- “mind-bending thriller” → Should find Inception
- “Christopher Nolan movies” → Should find his films
- “space exploration” → Should find relevant sci-fi
- “romantic comedy” → Should find rom-coms
Use Cases
Knowledge Base
Product Recommendations
Customer Notes
Customization Ideas
Add Ratings
Add Filters
Update Movies
Using save() Method
What You’ll Learn
Vector Search
Semantic similarity search with AI
Custom Collections
Store any data structure
Search Indexing
Optimize for findability
Score Thresholds
Tune precision vs recall

