Retire a tool agents still call: Deprecation and Sunset fields, a notice MCP clients can read, a strict alias, an inventory by prompt version and a removal gate.
Why agents make retirement harder
Retiring an endpoint used to be a conversation between teams. You announced it, the owners of the calling services changed their code, and you watched the traffic fall to zero. When the caller is an agent, the call is not in code anyone reviews. It is chosen by a model from a tool list and a prompt, possibly through a gateway or an MCP server that wraps the endpoint. Three things change.
The caller does not read your announcement. A model never sees an email or a changelog, and it does not see HTTP response fields unless the tool layer passes them on. The same agent can call the old and the new tool in the same week, depending on the prompt version and on which tool description it happened to weigh. And the call volume of an agent depends on traffic, so a tool that looks unused on a quiet Monday may be called hundreds of times on Saturday.
So retirement needs signals for the humans who own the agents, a deterministic path that keeps old calls working while they move, and evidence that nobody is still calling before you remove anything. This guide builds all three for a fictional Belgavi's Book Store tool, lookup_order_v1, replaced by lookup_order.
Signal the deprecation where machines and owners can see it
For HTTP endpoints two standard response fields exist. RFC 9745, published in March 2025, defines Deprecation: an item structured field whose value is a date, written as @ followed by seconds since the epoch, meaning the resource is deprecated from that moment (a date in the future announces it in advance). It also registers the deprecation link relation, which points to documentation about the deprecation. RFC 8594 defines Sunset: an HTTP-date after which the resource is expected to become unresponsive. RFC 9745 adds a constraint between them: the Sunset timestamp must not be earlier than the Deprecation timestamp.
Deprecation: @1796083200
Sunset: Fri, 15 Jan 2027 00:00:00 GMT
Link: <https://docs.bookstore.test/tools/lookup-order-migration>; rel="deprecation"; type="text/html"The companion example tool_deprecation_inventory formats these fields from a plan and refuses a plan whose sunset precedes its deprecation. Both RFCs treat the fields as hints: clients are not obliged to act on them, and the Sunset RFC says explicitly that resources may disappear earlier or later. That is acceptable, because the fields are only the first of three controls.
MCP tool definitions have no deprecation field. In the 2025-11-25 and 2026-07-28 schemas, a Tool has a name, a description, input and output schemas, annotations and _meta. So the notice has to travel in what the model reads and in what tools on the host side can read:
{"name": "lookup_order_v1",
"description": "DEPRECATED: use lookup_order (same result, argument order_id). Removed after 2027-01-15.",
"_meta": {"bookstore.test/deprecation": {"replacement": "lookup_order", "sunset": "2027-01-15"}}}The description changes model behaviour; a namespaced _meta key lets a host, a gateway or a linter detect deprecated tools without parsing English. If the server supports notifications/tools/list_changed, send it after the change so connected clients refresh their tool lists.
Keep old calls working with a deterministic alias
During the migration window, calls to the old tool should still succeed, but through the new implementation, so there is only one code path to maintain. The alias belongs in the gateway or the MCP server, not in the prompt, and it must be strict:
# Author: Sandeep Belgavi. Excerpt from tool_deprecation_inventory/example.py
def alias(call):
"""Deterministic translation of the old argument name; anything unexpected is rejected, not guessed."""
args = dict(call['args'])
if set(args) != {'order_ref'}:
return None, f"unexpected arguments {sorted(args)}"
return {'tool': PLAN['replacement'], 'args': {'order_id': args['order_ref']}}, 'translated'In the example's synthetic log, 62 calls translate cleanly and one is rejected because it carried an extra include argument that the old tool silently ignored. Rejecting it is deliberate. A translation that guesses would change behaviour without anyone deciding to, and the rejected call shows up in the inventory below where an owner can look at it.
Return the Deprecation and Sunset fields on aliased calls too, and include a short warning in the tool result if your host shows results to the model. A model that reads "this tool is deprecated, use lookup_order" in a result is more likely to switch in the same run than one that only saw the description at the start.
Inventory callers by agent and prompt version
The decisive control is knowing who still calls. Log every call to the deprecated tool at the gateway with the caller identity, the agent's prompt or configuration version, and the run ID. Then group:
| Caller | Prompt version | Calls in 14 days |
|---|---|---|
| helpdesk-agent | prompt-41 | 29 |
| nightly-report (service) | none | 14 |
| returns-agent | prompt-7 | 13 |
| helpdesk-agent | prompt-42 | 6 |
The table in the example says more than "62 calls remain". The help-desk agent's newer prompt still calls the old tool six times, so updating the description was not enough for that prompt; someone should look at those runs. The old prompt is still deployed somewhere and accounts for most calls. And a plain service, the nightly report, is in the list too. Agents are rarely the only callers, and the deterministic callers are usually the easiest to fix once you know they exist.
Group by prompt version rather than by agent name. When a team says "we updated the agent", the inventory can confirm whether the deployed version they updated is the one still calling.
Remove only when the gate opens
The removal gate in the example has two conditions: the sunset date has passed, and the inventory window shows no calls. Either alone is insufficient. A date without an empty inventory breaks callers you know about; an empty inventory before the sunset breaks the promise you made to callers who simply had a quiet fortnight.
Size the window from traffic patterns. If an agent handles a monthly stock audit, two weeks of silence proves nothing; use a window longer than the longest cycle of any caller you know, or ask owners to confirm.
After removal, keep the alias rejecting with a clear, stable error for a while instead of returning a generic not-found. An agent that calls a removed tool should get "lookup_order_v1 was removed on 2027-01-15; use lookup_order", which it can act on, rather than a failure it may retry.
Test the migration before the deadline
Three tests make the migration boring, which is the goal.
First, an equivalence test for the alias. Take a sample of recorded calls to the old tool, run each through the alias and through the new tool with the translated arguments, and assert that the results match. Run it in continuous integration until removal, because the new tool keeps changing and the alias must keep producing the old tool's answers.
Second, a behaviour check on each agent version before it ships. Replay a fixed set of cases against the candidate prompt and the current tool list, and fail the release if any run calls the deprecated tool. This catches the situation in the inventory above, where a newer prompt still reached for the old name.
Third, a removal rehearsal. In a staging environment, make the old tool return the final "removed" error and run the same case set. Every agent should recover by calling the replacement, and every deterministic caller should already be gone.
What stays deterministic
Everything in this process except the model's choice of tool is ordinary code: the header values, the alias, the inventory query and the removal gate. That is the point. The model's behaviour is influenced by the description and the result warnings, but the system's correctness never depends on the model having read them. If the model keeps calling the old tool, the alias keeps working until the gate opens, and the inventory keeps telling a person exactly which prompt is responsible.
When this is more machinery than you need
If a tool has a single caller, owned by the same team, and the change is a rename inside one deployment, change both in one release and skip the alias. The machinery above pays off when callers are spread across teams, prompts or deployments that you do not control, which is exactly the situation shared agent tools tend to create.
Limits of this guide
The header semantics are quoted from RFC 9745 and RFC 8594, and the MCP tool fields from the 2025-11-25 and 2026-07-28 schemas. The plan, the log and the counts in the example are synthetic. The _meta key shown is an application-specific name, not a protocol feature.