ai-agent

Tool Use

Tool use is the ability of an AI model to call external functions or APIs during generation, enabling it to retrieve live data, execute code, and interact with the world.

Large language models are text-in, text-out systems. Tool use (also called function calling) extends this by allowing the model to emit a structured call to a predefined function — a web search, a database query, a calculation, or an API request — and then incorporate the result into its response. The model decides when to call a tool based on the user's query and the tool descriptions it has been given.

Tool use transforms an LLM from a static knowledge store into an active agent. A model equipped with a web scraping tool can fetch the current price of a product rather than guessing from training data. A model with a code execution tool can run calculations rather than approximating them in text. Chaining multiple tool calls allows complex multi-step reasoning.

AI platforms expose tool use through API schemas (OpenAI's `tools` parameter, Anthropic's `tools` block) or via protocols like MCP. Each tool is described by a name, description, and JSON Schema for its parameters. The model's output may include a `tool_use` block; the calling application executes the tool and passes results back in the next turn.

Examples

# Anthropic tool use: scrape a URL during generation
import anthropic

client = anthropic.Anthropic()
response = client.messages.create(
    model="claude-opus-4-5",
    tools=[{"name": "scrape", "description": "Fetch a URL", "input_schema": {
        "type": "object", "properties": {"url": {"type": "string"}}, "required": ["url"]}}],
    messages=[{"role": "user", "content": "What is the price on example.com/product?"}]
)

Related Terms

Extract Tool Use data from any website

AlterLab returns clean, structured data from any public URL — no scraper infrastructure needed. Start free, no credit card required.

View API docs

Your first scrape.
Sixty seconds.

$1 free balance. No credit card. No SDK.Just a POST request.

terminal
curl -X POST https://api.alterlab.io/v1/scrape \
-H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com", "formats": ["markdown"]}'

No credit card required · Up to 5,000 free scrapes · Balance never expires

    Tool Use — Web Scraping Glossary | AlterLab