Skip to main content

Advanced Tool Use (BM25 Retrieval)

Automatically discover relevant tools at runtime using BM25 lexical search. When you have many tools (10+), this feature ensures the right tools are always available without manual selection.

Quick Setup

agent_config = {
    "enable_advanced_tool_use": True  # Enable BM25 retrieval
}

How It Works

  1. All MCP tools loaded into in-memory registry
  2. BM25 index built over tool names, descriptions, parameters
  3. User task used as search query
  4. Top 5 relevant tools dynamically injected

Benefits

  • Scales to 1000+ tools — only relevant tools are injected per request
  • Zero network I/O — index lives in memory
  • Deterministic — same query always selects same tools
  • Container-friendly — no external dependencies
Enable when you have many MCP tools (10+) and want the agent to automatically discover the right tools for each task without manual selection.