Intent-Stated Tool Discovery via Embeddings
The Librarian Method solves the tool bloat problem that kills AI agent platforms at scale.
The Problem
You canβt fit 25,000+ tool definitions in a context window. Keyword filters guess wrong. Category menus break natural language.
The insight: Only the LLM knows what the user actually wants.
The Invention
The agent requests tools after understanding intent β like asking a librarian for books.
User: "Email John about the report"
Agent β request_tools("email sending")
Librarian β returns email_send + email_read
Agent β sends the email
The agent writes the search query. The Librarian finds semantically similar tools using embeddings.
Key Features
| Feature | Description |
|---|---|
| Agent-stated intent | The LLM writes the search query, not the user |
| Local embeddings | Zero-cost via Ollama (nomic-embed-text) |
| Domain expansion | Request βemailβ β get email siblings automatically |
| Scale-independent | Works identically with 50 tools or 50,000 |
Cost Impact
- Only needed tools enter the context window
- ~230 KB memory footprint for tool embeddings
- Zero training required
- Works with any embedding model (OpenAI, Google, local)
Read More
MIT Licensed β Use it, fork it, improve it.
Questions? Drop them below!