Tools are under-documented: Simple Document Expansion Boosts Tool Retrieval

Xuan Lu, Haohang Huang, Rui Meng, Yaohui Jin, Wenjun Zeng, Xiaoyu Shen

TL;DR

Tool retrieval is the "gateway" to effective Large Language Model (LLM) agents, but it is currently crippled by messy, incomplete, and inconsistent API documentation. This paper introduces TOOL-REX, a framework that uses a multi-stage LLM pipeline to systematically expand tool documentation with structured fields. Alongside this framework, the authors introduce two new state-of-the-art models—Tool-Embed and Tool-Rank—that significantly outperform existing retrievers by bridging the semantic gap between user queries and technical docs.

The Bottleneck: Flawed Tool Documentation

When you ask an AI agent to "book a flight," it has to search through thousands of available APIs to find the right one. This process is known as tool retrieval. The authors argue that the biggest bottleneck in this process isn't the retrieval algorithms themselves, but the underlying data: tool documentation is inherently flawed.

Field Coverage across TOOLRET Datasets

Existing documentation suffers from three primary issues:

  1. Heterogeneity: Different developers describe the same functions in wildly different ways.
  2. Incompleteness: Crucial context, such as "when-to-use" scenarios or operational "limitations," is frequently missing across major datasets.
  3. The Semantic Gap: User queries are often ambiguous or phrased in natural language that doesn't align with formal, technical API descriptions.

Previous attempts tried to fix this by augmenting the queries, but this paper argues we should fix the problem at the source: the documentation itself.

The TOOL-REX Framework: A Three-Stage Expansion Pipeline

To address these documentation flaws, the authors developed a scalable, three-stage Document Expansion Pipeline to enrich raw tool descriptions into structured profiles.

The Document Expansion Pipeline

The pipeline operates as follows:

  1. Expansion: The system uses an open-source LLM to generate five specific fields: function_description, tags, when_to_use, limitations, and example_usage. This process is strictly grounded in the original text to prevent hallucinations.
  2. Judgement: A secondary LLM acts as a "semantic judge," verifying that the expanded fields are faithful to the original documentation, not empty, and formatted correctly as JSON.
  3. Refinement: For the small fraction of profiles that fail verification, a more powerful closed-source model (like GPT-4) is used to regenerate and refine the profiles into a valid state.

Using this enriched data, the authors trained two specialized models:

  • Tool-Embed: A dense retriever trained on 50k instances.
  • Tool-Rank: An LLM-based reranker trained on 200k instances.

Datasets

  • ToolRet: The foundation dataset, which consolidates 35 existing tool-use datasets (including ToolBench, APIBank, and MetaTool) covering ~43k unique tools.
  • TOOL-REX (New): The authors' newly introduced benchmark, which applies their expansion pipeline to the entirety of ToolRet.
  • Training Corpora: They released Tool-Embed-Train (50k pairs) and Tool-Rank-Train (200k pairs) to facilitate future research.

Key Insights: The Anatomy of Tool Retrieval

  • Not all fields are created equal: Through "Add-one" and "One-out" ablation studies, the authors found that the function_description and when_to_use fields provide the biggest performance boosts. Surprisingly, example_usage can actually hurt performance in some models because it introduces "semantic dilution"—too much extra text can drown out the core signal.
  • Asymmetric Dilution: This is a critical finding of the paper. While adding text makes documents longer (which usually lowers similarity scores), it lowers the scores for irrelevant (negative) tools much more than for relevant (positive) ones. This widens the gap between "right" and "wrong" tools, making the retriever's job much easier.
  • Generalization is Key: Models trained on expanded documentation perform better even when they are tested on unexpanded, raw documentation. This suggests the models are learning better latent representations of what a "tool" actually does, rather than just over-fitting to the new fields.

Key Results

  • New SOTA: On the TOOL-REX benchmark, their models achieved 56.44 NDCG@10 and 67.81 Recall@10.
  • Massive Gains: This represents an improvement of +10.23 in NDCG and +10.29 in Recall over previous state-of-the-art open-source models on the MTEB leaderboard.
  • Audit Success: An LLM-based audit showed that the "incompleteness rate" of tool documentation dropped from 41.6% in the original datasets to just 23.5% after expansion.

Limitations and Future Work

  • The "Example Usage" Trap: The authors noted that example_usage often contains specific values (like a specific city name) that might mislead a retriever if the user query asks for a different city. Future work could involve more sophisticated ways to integrate examples without causing dilution.
  • Cost vs. Quality: While they used a "mid-sized" model to keep costs low during the initial expansion, the highest quality refinement still required a frontier model. Finding ways to achieve top-tier quality with even smaller, distilled models is a logical next step.
  • Dynamic Weighting: The paper suggests that future retrievers might benefit from dynamically weighting different documentation fields based on the specific type of user query.

Summary updated

BibTeX
@inproceedings{lu2026tools,
  author = {Xuan Lu and Haohang Huang and Rui Meng and Yaohui Jin and Wenjun Zeng and Xiaoyu Shen},
  title = {{Tools are under-documented: Simple Document Expansion Boosts Tool Retrieval}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=g9D9MgG7iW},
}
Figure