What is a web search tool?
A web search tool lets a language model or agent send a query to a search engine and receive results of titles, links and snippets; it gives the model current information missing from or changed since its training data and lets it ground answers in sources.
Unlike a deep research agent, which uses this tool repeatedly according to a plan and reads and synthesises results, a web search tool runs a single query. Information retrieval is the wider field search engines rest on.
- Topic
- Agents and protocols
- Also known as
- Web search, search tool
How a web search tool works
- The model turns the user's question into one or more search queries and calls the tool.
- The tool sends a request to the search service; results return as titles, links and short snippets.
- The model assesses results, using a separate page fetch tool to read a full page if needed.
- The answer is written with citations to the sources used.
In more detail
Built-in search versus MCP or external search APIs
Production deployments distinguish between provider-managed built-in search tools and self-hosted or third-party search APIs exposed via function calling or the Model Context Protocol (MCP). Built-in search reduces integration effort, whereas an MCP or internal gateway search tool lets enterprises enforce domain allowlists, custom rate limits and Zero Data Retention (ZDR) policies before queries leave the network.
Source verification, link hallucination and domain filtering
Search-backed answers remain vulnerable to two failure modes: link hallucination, where the model invents or alters a URL not present in the tool output and stale or low-authority sources entering the context. Enterprise pipelines therefore verify every cited URL against the tool's raw response and prioritise authoritative domains via domain filtering or reranking.
Latency, token budget and query caching
Web search adds external network latency to every call and increases input token consumption when long snippets or fetched pages enter the context window. Caching frequent queries, capping the number of search rounds per turn and truncating low-relevance snippets keep latency and token costs predictable.
Data exfiltration through search queries
Even without direct file-sending capability, a search tool can act as a covert exfiltration channel if indirect prompt injection tricks the model into encoding confidential context into the search query string. Strict query-parameter policies, PII/secret scanners on outbound queries and human approval for searches triggered after reading untrusted data mitigate this risk.
Commonly confused terms
| Term | How it differs |
|---|---|
| Page fetch tool or web scraper | A web search tool queries a search index and returns ranked result snippets, whereas a page fetch (browser/scraper) tool retrieves and parses the full content of a specific URL. |
| RAG and internal enterprise search | Web search retrieves public internet results via an external search index; RAG searches curated, access-controlled internal or indexed document stores inside the organisation's trust boundary. |
Why a web search tool matters for on-premises AI
Web search improves accuracy for questions needing current information but brings two risks. First, query text goes to an external search service; sensitive information from the user's question that enters a query leaves the organisation. Second, instructions hidden in web pages can steer the model, known as indirect prompt injection. In-house systems therefore switch web search on or off per user or task, filtering and logging queries. Air-gapped environments use internal search instead.
In a consultancy's assistant the web search tool is open only for sector news and regulatory announcements; queries containing client names are blocked before leaving and only internal document search is used.
Common questions
Why is a web search tool used?
To reach information missing from or changed since the model's training data and to ground answers in sources.
Does a web search tool carry privacy risks?
It can. Query text goes to an external service, so queries with sensitive information are filtered or web search is switched off for those tasks.
Related terms
- Deep research agent
- Tool definition
- Agent tool
- Tool calling
- Information retrieval
- Indirect prompt injection
Sources
- Nakano et al., WebGPT: Browser-assisted question-answering with human feedback, 2021
- Schick et al., Toolformer: Language Models Can Teach Themselves to Use Tools, 2023
In the glossary: Glossary, R to Z