HSCP-R-009 · recipe · Security
Bound an agent's tools: declare by right, freeze the descriptions, trace what is loaded
Written entry, version 0.1, checked on 2026-11-21.
At a glance
| Implements | HSCP-G-005 Manage access authorisations to data |
|---|---|
| Case | Instantiates: applies an existing practice to a context. |
| Context | an AI agent calls tools of the product (application functions, MCP servers), whether their definitions are loaded in advance into the model context or on demand |
| Verification | open test · review |
Implements HSCP-G-005, Manage access authorisations to data. Case: instantiates the practice for the case where the authorised actor is an agent that chooses its own tools. Complemented by HSCP-R-003 for the trace of accesses, and by HSCP-G-004 when a tool comes from a third-party server.
When
An agent receives a list of tools and chooses which one to call. Model providers make it possible to load a tool's definition only on demand: the model then chooses on the name and the description. This on-demand loading lightens the context; it removes no right: a deferred tool remains declared, and therefore callable. Two mistakes are to be avoided: taking "deferred" for "forbidden", and leaving the model as sole judge of what it may call.
How
- Keep a register of the agent's tools, drawn from the code: name, description, parameter schema, originating server, right required of the user.
- Build the list declared to the model at each request, from the rights of the user on whose behalf the agent acts. A tool the user has no right to is not declared: for the model, it does not exist.
- Check the right a second time in the server that executes the tool, without relying on the declared list. This check does not depend on the model.
- Freeze what the model reads of each tool (name, description, schema) with a fingerprint, kept in the repository. A discrepancy between the register and the fingerprints fails the build. For a third-party MCP server, compare the list it exposes with the fingerprints at each connection, and refuse any added or modified tool until it has been reviewed.
- Choose what is loaded upfront: the few tools used in almost every conversation. Defer the others.
- Keep, together with the access log, the trace returned by the model's API: tools searched, definitions loaded, call made.
- Measure before and after on real conversations: input tokens, latency, task success rate.
What runs where:
Examples
List declared by right, and fingerprints (Python 3.13, run on 21/11/2026: the non-permitted tool is not declared, a modified description and an added tool are detected):
import hashlib, json
def empreinte(outil):
"""Fingerprint of what the model reads: name, description, schema."""
vu = {k: outil[k] for k in ("name", "description", "input_schema")}
return hashlib.sha256(json.dumps(vu, sort_keys=True, ensure_ascii=False).encode()).hexdigest()
def ecarts(registre, verrou_fige):
actuel = {o["name"]: empreinte(o) for o in registre}
return sorted(n for n in set(actuel) | set(verrou_fige) if actuel.get(n) != verrou_fige.get(n))
def outils_declares(registre, droits, frequents=()):
"""Only the tools permitted to the user are sent in the request."""
return [{"name": o["name"], "description": o["description"], "input_schema": o["input_schema"],
"defer_loading": o["name"] not in frequents}
for o in registre if o["droit"] in droits]
The defer_loading field is the one used by the Google, Anthropic and OpenAI APIs at the date of the recipe. Sending to a real API has not been executed.
Verification
- CI test: for a user without the right, the tool is absent from the declared list, and a direct call to the server is refused.
- CI test: a modified description or an added tool without an update of the fingerprints fails the build.
- Audit agent: identify the points where the tool list is built and check that it starts from the user's rights, not from a fixed list; identify the third-party tool servers and check the comparison with the fingerprints at connection.
Evidence produced
Register of tools with the required right, versioned fingerprint file, dated test report, trace extract from a conversation (tools searched, loaded, called).
Evidence items
Each item attests the recipe at a given date. Frequency given for a product in service.
- Register Register of tools with the permission each one requires
- Configuration or schema Versioned file of tool description fingerprints
- Test report Dated test report: tool absent without the permission, direct call refused, changed fingerprint blocking
- Log extract Trace extract of a conversation: tools searched, loaded, called
Own mappings
In addition to those of the practice:
| Identifier | What the recipe adds |
|---|---|
anssi_ia_agentique_v1.0/2.2 |
the tool register is the inventory of the agent's capabilities, and the list declared by right enforces it outside the model |
anssi_ia_agentique_v1.0/5.1 |
the right check in the tool server is filtering that the agent cannot bypass |
anssi_ia_agentique_v1.0/7.1 |
the fingerprints verify the integrity of tool definitions, third-party ones included |
anssi_ia_agentique_v1.0/7.4 |
the trace of tools searched, loaded and called helps reconstruct the sequence of a request |
References outside the catalogue
- Google, "Introducing Tool Retrieval in the Gemini API", 19/11/2026.
- Anthropic, "Advanced tool use", 24/11/2025.
- OpenAI, "Tool search" documentation, read on 21/11/2026.
- Claude Code, "Connect Claude Code to tools via MCP" documentation, read on 21/11/2026.
- Trail of Bits, "Jumping the line", 21/04/2025.
Versions
| Version | Status | Date |
|---|---|---|
| 0.1 | Draft | 2026-11-21 |
How to cite: “Health Software Common Practices”, HSCP-R-009, version 0.1, https://healthtechpractices.org/en/recettes/hscp-r-009/, under the CC BY-NC-SA 4.0 licence. Licence