Mark Tools Read-Only: MCP Annotations for Scraping Servers
Give every MCP scraping tool a title and hints so the agent knows which fetch is read-only and which call can burn quota. Includes JSON examples.
On this page
The Annotation Gap in Every Scraping Server
Every MCP server I’ve audited in the last year had the same defect: the agent couldn’t tell which tools were free and which ones cost money. It would call fetch_page four times in a row, retry a quota-burning search tool on a transient timeout, and fire off a bulk crawl without asking anyone. The tools worked. The annotations were missing.
Annotations are the metadata block on every MCP tool definition. Four boolean hints and a title string. They take about two minutes per tool to write, and they’re the difference between an agent that behaves like a careful operator and one that treats your scraping budget as infinite. This post walks through annotating a scraping server tool by tool, then verifying the annotations actually reach the client.
What MCP Annotations Tell an Agent Before It Calls a Tool
Annotations live inside the tool definition, next to name, description, and inputSchema. The spec defines five fields. A client that supports them reads the hints before the first call — that’s the entire point. The agent doesn’t have to learn your tool’s behavior by trial and error; you declare it up front.
| Field | Type | Default | What a scraping client should infer |
|---|---|---|---|
title | string | tool name | Human-readable label shown in tool pickers and logs. Use it to surface cost, not marketing. |
readOnlyHint | boolean | false | The tool mutates nothing on any server. Safe to call, probe, and retry without confirmation. |
destructiveHint | boolean | true | The tool changes server-side state. Clients should ask the user before invoking. |
idempotentHint | boolean | true | Repeating the call with the same args has the same effect as calling once. Affects retry policy. |
openWorldHint | boolean | true | The tool interacts with resources outside the server’s control — the live web, in our case. |
Two defaults surprise people. destructiveHint defaults to true, so every un-annotated tool looks dangerous and clients may nag for confirmation on harmless fetches. And idempotentHint defaults to true, so an agent will happily retry a tool that deducts quota on every call. Both defaults are wrong for a scraping server. You have to override them explicitly.
Here’s the minimal shape, so we’re working from the same baseline:
{
"name": "fetch_page",
"description": "Fetch a single page from the live web and return it as markdown.",
"inputSchema": {
"type": "object",
"properties": {
"url": { "type": "string" }
},
"required": ["url"]
},
"annotations": {
"title": "Fetch page (read-only, ~1 token)",
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": true
}
}
Five lines of JSON. That’s the whole mechanism. The rest of this post is about getting the values right for each tool.
Annotating a Read-Only Page Fetcher with readOnlyHint
Start with the tool every scraping server has: a plain GET that returns page content. Under the hood it might hit POST /api/v1/scrape on api.finedata.ai with formats: ["markdown"], but from the agent’s perspective the contract is simple — URL in, markdown out, nothing mutated anywhere.
{
"name": "fetch_page",
"title": "Fetch a web page as markdown",
"description": "Fetches a single URL from the live web and returns cleaned markdown. Read-only: does not modify the target site, does not create crawl jobs, does not consume per-day quota beyond one API token. Safe to call repeatedly. For pages that need JavaScript rendering, set js_render=true.",
"inputSchema": {
"type": "object",
"properties": {
"url": {
"type": "string",
"description": "Absolute URL to fetch, e.g. https://example.com/pricing"
},
"js_render": {
"type": "boolean",
"default": false,
"description": "Render JavaScript with a headless browser before extraction"
}
},
"required": ["url"]
},
"annotations": {
"title": "Fetch page (read-only, 1 token per call)",
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": true
}
}
The before/after matters more than you’d think. Here’s the same tool with no annotations:
{
"name": "fetch_page",
"description": "Fetches a URL and returns markdown.",
"inputSchema": {
"type": "object",
"properties": {
"url": { "type": "string" }
},
"required": ["url"]
}
}
With defaults applied, the client sees destructiveHint: true and idempotentHint: true. So the agent either nags for confirmation on every harmless fetch, or — worse — it silently decides this tool is dangerous and routes around it, inventing raw HTTP fetches instead. I’ve watched both happen. The annotated version tells the agent the truth: this call is free to make, free to repeat, and touches the open world (so a 403 from the target is possible and shouldn’t be retried blindly).
One honest caveat: readOnlyHint: true describes your server’s side effects, not the destination’s. A GET request can still land in someone’s analytics, trip a rate limiter, or burn one of your API tokens. The hint means “no state mutation,” not “no cost.” That distinction is what the next two sections are about.
Marking Rate-Limited Scrapers as Non-Idempotent to Protect Quota
Here’s where most scraping servers fail their agents. A search tool — say, a product search against store.example.com — consumes quota on every call, whether or not you already ran the identical query five minutes ago. The spec’s default idempotentHint: true tells the agent “retrying this is free.” It isn’t.
{
"name": "search_products",
"title": "Search product catalog",
"description": "Searches store.example.com product catalog by keyword and returns matching product names, prices, and URLs. Each call consumes API quota: 1 of 500 requests per day on the current plan. NOT idempotent from a cost perspective — identical queries are billed separately. If you have run the same query recently, reuse the previous result instead of calling again. Batch multiple keywords into one call when possible.",
"inputSchema": {
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "Product search keyword, e.g. 'wireless keyboard'"
},
"max_results": {
"type": "integer",
"default": 20,
"maximum": 50
}
},
"required": ["query"]
},
"annotations": {
"title": "Search products (costs 1 of 500 daily requests)",
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": false,
"openWorldHint": true
}
}
Note the split: readOnlyHint: true alongside idempotentHint: false. That’s not a contradiction. The tool mutates nothing server-side, but repeating it isn’t effect-neutral because each call bills quota. A well-behaved client uses both signals:
| Agent behavior | idempotentHint: true | idempotentHint: false |
|---|---|---|
| Retry on timeout | Retries automatically, assumes same result | Asks before retrying, or surfaces the failure |
| Caching | May skip caching; repeats are “free” | Caches aggressively; checks before re-calling |
| Duplicate calls in one session | Tolerated | Flagged or deduplicated |
| Batch planning | One call per item is fine | Agent batches keywords into single calls |
The description does real work here too. idempotentHint: false is a single bit; the agent can’t know why it’s set. The sentence “Each call consumes API quota: 1 of 500 requests per day” gives the LLM the actual mechanism, which lets it reason about trade-offs — like choosing max_results: 50 over three separate 20-result calls.
If you want the deeper treatment of client-side caching patterns for exactly this problem, I wrote about caching MCP tool responses to stop re-fetching, and the same reasoning applies when the cache lives in the agent instead of the server.
Flagging Destructive Scraping Actions with destructiveHint
Some tools on a scraping server genuinely change state. A bulk crawl kickoff creates jobs that run for hours and bill tokens the whole way. A cache-clear tool destroys work. These need destructiveHint: true — which, remember, is the default, but you still set it explicitly because defaults get lost in refactors and because the pairing with readOnlyHint: false is what a client actually keys off.
{
"name": "start_bulk_crawl",
"title": "Start a bulk crawl job",
"description": "Submits a crawl job covering store.example.com category pages and all linked product pages. Creates server-side jobs that consume API tokens for every page fetched, run for up to several hours, and cannot be partially undone once started. Requires explicit confirmation. Use fetch_page or search_products for small ad-hoc lookups instead.",
"inputSchema": {
"type": "object",
"properties": {
"seed_urls": {
"type": "array",
"items": { "type": "string" },
"description": "Starting URLs, e.g. ['https://store.example.com/catalog']"
},
"max_pages": {
"type": "integer",
"default": 100,
"maximum": 10000
}
},
"required": ["seed_urls"]
},
"annotations": {
"title": "Start bulk crawl (bills tokens per page, long-running)",
"readOnlyHint": false,
"destructiveHint": true,
"idempotentHint": false,
"openWorldHint": true
}
}
A compliant client turns that annotation into a gate. The confirmation prompt should look something like this before the call goes out:
The agent wants to run: Start bulk crawl
seed_urls: ["https://store.example.com/catalog"]
max_pages: 500
This tool changes server state and may consume significant API quota.
It cannot be undone once started. Allow this call?
[Allow once] [Always allow for this session] [Deny]
The exact wording varies by client; the contract doesn’t. destructiveHint: true means the client must not fire the call silently. If your agent runs a bulk crawl without asking, either the annotation is missing or the client ignores it — both are testable, which is the last section of this post.
One opinion I’ll commit to: idempotentHint: false is correct here even though re-submitting the same seed URLs twice creates “the same” crawl twice. From the operator’s perspective, a duplicate crawl is a doubled bill, not a no-op. Annotate for the operator’s mental model, not the spec’s abstract one. Cost is a side effect.
Writing Titles and Descriptions the Agent Actually Reads
Annotations only work if the strings around them are precise. The title is what shows up in tool lists and logs; the description is what the model reads when deciding whether and how to call. Vague text here wastes the hints.
| Vague | Specific | |
|---|---|---|
title | "Fetch" | "Fetch page (read-only, 1 token per call)" |
description | "Fetches a URL." | "Fetches a single URL from the live web and returns cleaned markdown. Read-only: no state mutation on the target or this server. Consumes 1 API token per call. Set js_render=true for SPAs; that adds 5 tokens." |
| Agent outcome | Calls blindly, retries on failure, ignores cost | Knows the cost, knows when rendering is needed, caches instead of re-fetching |
The pattern I’ve settled on for descriptions, in order: what the tool does, what it does not do, what it costs, and what to prefer instead when the tool is the expensive option. That last part sounds odd — telling the agent to use a different tool — but it works. “Use fetch_page for single pages instead” in the start_bulk_crawl description measurably reduces dumb bulk-crawl invocations, because the agent now has an explicit cheaper alternative in context.
Titles should carry the cost signal, because titles appear in compact UIs where descriptions get truncated. “Search products” tells the agent nothing when it’s scanning 30 tools. “Search products (costs 1 of 500 daily requests)” tells it everything it needs.
Here’s the checklist form — a tool with every field set deliberately, which is what I’d want to see in review:
{
"name": "fetch_page",
"title": "Fetch a web page as markdown",
"description": "Fetches a single URL from the live web and returns cleaned markdown. Read-only: mutates nothing on the target site or this server. Costs 1 API token per call; js_render adds 5. Idempotent: the same URL returns the same page. The target may block or rate-limit, so a failure here is not always retryable.",
"inputSchema": {
"type": "object",
"properties": {
"url": {
"type": "string",
"description": "Absolute URL, e.g. https://example.com/docs/getting-started"
},
"js_render": {
"type": "boolean",
"default": false
}
},
"required": ["url"]
},
"annotations": {
"title": "Fetch page (read-only, 1 token per call)",
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": true
}
}
Check each field against one question: could an agent make a worse decision because this string was ambiguous? If yes, rewrite it.
A Fully Annotated Scraping Server: Complete Tool Manifest
Now assemble the pieces. A coherent manifest applies one consistent strategy: read-only fetchers are marked free and repeatable, quota-bound search is marked non-idempotent, and anything that creates server-side jobs is gated as destructive. Here’s the full server with all three tools:
{
"protocolVersion": "2025-06-18",
"capabilities": {
"tools": { "listChanged": true }
},
"tools": [
{
"name": "fetch_page",
"title": "Fetch a web page as markdown",
"description": "Fetches a single URL from the live web and returns cleaned markdown. Read-only: mutates nothing on the target site or this server. Costs 1 API token per call; js_render adds 5. Safe to call repeatedly. The target may block or rate-limit.",
"inputSchema": {
"type": "object",
"properties": {
"url": {
"type": "string",
"description": "Absolute URL, e.g. https://example.com/pricing"
},
"js_render": {
"type": "boolean",
"default": false,
"description": "Render JavaScript with a headless browser before extraction"
}
},
"required": ["url"]
},
"annotations": {
"title": "Fetch page (read-only, 1 token per call)",
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": true
}
},
{
"name": "search_products",
"title": "Search product catalog",
"description": "Searches store.example.com product catalog by keyword. Each call consumes 1 of 500 daily API requests. NOT idempotent from a cost perspective — identical queries are billed separately. Reuse recent results instead of re-calling; batch keywords when possible.",
"inputSchema": {
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "Product keyword, e.g. 'wireless keyboard'"
},
"max_results": {
"type": "integer",
"default": 20,
"maximum": 50
}
},
"required": ["query"]
},
"annotations": {
"title": "Search products (costs 1 of 500 daily requests)",
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": false,
"openWorldHint": true
}
},
{
"name": "start_bulk_crawl",
"title": "Start a bulk crawl job",
"description": "Submits a crawl job covering store.example.com category pages and linked product pages. Creates server-side jobs that bill tokens per page fetched, run for hours, and cannot be partially undone. Requires explicit confirmation. Prefer fetch_page or search_products for small lookups.",
"inputSchema": {
"type": "object",
"properties": {
"seed_urls": {
"type": "array",
"items": { "type": "string" },
"description": "Starting URLs, e.g. ['https://store.example.com/catalog']"
},
"max_pages": {
"type": "integer",
"default": 100,
"maximum": 10000
}
},
"required": ["seed_urls"]
},
"annotations": {
"title": "Start bulk crawl (bills tokens per page, long-running)",
"readOnlyHint": false,
"destructiveHint": true,
"idempotentHint": false,
"openWorldHint": true
}
}
]
}
Notice the strategy holds across the toolset: exactly one tool is destructive, exactly one is non-idempotent-but-read-only, and the cheap fetcher is unambiguous. An agent scanning this manifest can plan a sensible order of operations without a single trial call.
Before shipping, confirm the annotations actually serialize into the tools/list response. A one-liner against a local stdio server:
# Assuming your server is reachable over HTTP at localhost:8080
curl -s http://localhost:8080/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}' \
| python3 -m json.tool
Expected output, trimmed:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tools": [
{
"name": "fetch_page",
"annotations": {
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": true,
"title": "Fetch page (read-only, 1 token per call)"
}
}
]
}
}
If annotations is absent from the response, your SDK is stripping them or you’re on a version that predates the field. Either way, the client never sees your careful work. Catch it here, not in production.
Testing Annotations from the Client Side Before You Ship
Server-side verification isn’t enough. You need to confirm the client consumes the hints, because an agent that ignores annotations behaves identically to one whose server never sent them. Run a quick count against the live tools/list response:
import json
import subprocess
# Call tools/list over stdio against your local server binary
msg = json.dumps({
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
})
proc = subprocess.run(
["python3", "server.py"],
input=msg + "\n",
capture_output=True,
text=True,
timeout=30,
)
response = json.loads(proc.stdout.strip().splitlines()[0])
tools = response["result"]["tools"]
annotated = [t for t in tools if "annotations" in t]
read_only = [t for t in annotated if t["annotations"].get("readOnlyHint")]
destructive = [t for t in annotated if t["annotations"].get("destructiveHint")]
non_idempotent = [t for t in annotated if t["annotations"].get("idempotentHint") is False]
print(f"tools: {len(tools)}")
print(f"annotated: {len(annotated)}")
print(f"readOnlyHint true: {len(read_only)} -> {[t['name'] for t in read_only]}")
print(f"destructiveHint true: {len(destructive)} -> {[t['name'] for t in destructive]}")
print(f"idempotentHint false: {len(non_idempotent)} -> {[t['name'] for t in non_idempotent]}")
assert len(annotated) == len(tools), "Some tools are missing annotations entirely"
Expected output for the manifest above:
tools: 3
annotated: 3
readOnlyHint true: 2 -> ['fetch_page', 'search_products']
destructiveHint true: 1 -> ['start_bulk_crawl']
idempotentHint false: 2 -> ['search_products', 'start_bulk_crawl']
Then do the behavioral test in the actual client. Give an agent a task that needs one search, and watch whether it re-calls search_products for a query it already ran. Trigger a start_bulk_crawl scenario and confirm the confirmation prompt appears. If you’re building the server for agents specifically, this pairs with testing your MCP scraping server before an agent uses it — annotations belong in that same pre-flight checklist.
When behavior looks wrong, the cause is almost always one of these:
| Symptom | Likely cause | Fix |
|---|---|---|
Agent retries search_products on timeout, burning quota | idempotentHint missing or left at default true | Set idempotentHint: false; state the quota in the description |
| Agent re-runs identical searches in one session | No cost signal in title/description; agent assumes calls are free | Put “costs 1 of N daily requests” in both |
start_bulk_crawl executes without confirmation | destructiveHint missing, or client doesn’t surface hints | Verify annotations in tools/list; if present, the client is non-compliant — file upstream |
Agent asks permission for every fetch_page | destructiveHint left at default true | Set destructiveHint: false and readOnlyHint: true |
Agent avoids fetch_page and invents raw HTTP calls | Tool description too vague; agent distrusts the tool | Rewrite description: what it does, what it doesn’t, what it costs |
The last row is the sneaky one. Agents don’t fail loudly — they route around tools they don’t understand. Silent tool avoidance is the most common annotation-related failure I see, and it shows up in usage dashboards, not error logs.
Wrap-Up
Annotations are five fields per tool and they carry disproportionate weight. The defaults are actively wrong for scraping servers — destructiveHint: true on everything makes harmless fetches feel dangerous, and idempotentHint: true on everything makes quota-burning calls look free. Override both deliberately.
The strategy in one paragraph: mark fetchers read-only and idempotent, mark quota-bound search non-idempotent with the quota stated in plain language, gate anything that creates server-side jobs as destructive, and put cost in the title so it survives truncation. Then verify twice — once that the server serializes the annotations into tools/list, once that the client actually changes behavior because of them.
Gotchas worth repeating: readOnlyHint says nothing about cost, only about state mutation; annotations describe your server’s view, not the destination’s; and a missing annotation is never neutral — it falls back to a default that’s probably wrong for your tool. Write the annotations, run the count script, watch one real agent session before you call it done.
Related Articles
Confirm Before You Fetch: MCP Elicitation for Scraping Tools
Add MCP elicitation to scraping tools: pause for user consent on costly fetches, collect credentials mid-run, and fail cleanly when no one answers.
TechnicalTeach Your Agent to Escalate Its Own Fetches
Wire MCP fetch tools in tiers so your agent tries a cheap plain fetch first, then escalates to JS rendering and geo-routing only when a page needs it.
TechnicalSlow Scrape, No Timeout: MCP Progress and Cancellation
A JS-rendered page can outlast your agent's tool call timeout. Add MCP progress notifications, handle cancellation, and stop paying for abandoned scrapes.