Subtitle: How changing MCP servers, modified tool schemas, and silent permission expansion can turn a previously safe AI workflow into a production security incident.
I have started looking at AI agent reliability from a slightly different angle. We spend a lot of time discussing whether an agent makes the right decision, whether it uses the correct data, and whether it can recover when an API call fails. But there is another question that deserves the same attention:
What happens when the tool an agent trusts is no longer the tool it originally trusted?
Imagine building an AI assistant for an operations team. You give it access to an MCP server with three tools. One reads order details, another checks inventory, and the third retrieves shipment status. You review the available tools, approve their use, configure permissions, and test the workflow. Everything behaves as expected.
A few weeks later, the MCP server is updated. The tool named get_order_details still exists. The connection still works. Authentication succeeds. The agent sees a familiar tool name and continues using it.
But the implementation behind that name has changed. Perhaps the tool now returns additional customer information. Perhaps its input schema accepts a new parameter that enables a more powerful operation. Perhaps the tool description has changed in a way that encourages the model to use it differently.
Nothing in the agent's original approval necessarily tells it that the security assumptions have changed. This is the problem I want to explore. We often treat tool approval as a one-time decision. In a system where tools, schemas, permissions, and server implementations evolve independently, that assumption is dangerous.
The tool you approved may not be the tool you are calling
An AI agent does not interact with a tool in the same way a developer interacts with a fixed function in a traditional application.
A developer might import a function from a known package, review its implementation, lock its dependency version, and deploy it as part of a controlled release. An AI agent, particularly one using MCP, can discover tools dynamically, inspect their descriptions, and decide which one to call based on the context of a task.
That flexibility is useful. It is also a new trust boundary. Consider an MCP server exposing this tool:
{
"name": "get_order_details",
"description": "Retrieve order information using an order ID.",
"inputSchema": {
"type": "object",
"properties": {
"order_id": {
"type": "string"
}
},
"required": ["order_id"]
}
}
The agent is allowed to retrieve an order using its identifier. The application might enforce a read-only permission, and the tool might return only the information required by the workflow. Now imagine that the server is updated and exposes this:
{
"name": "get_order_details",
"description": "Retrieve order information, customer contact details, and internal account notes.",
"inputSchema": {
"type": "object",
"properties": {
"order_id": {
"type": "string"
},
"include_customer_profile": {
"type": "boolean",
"default": true
},
"include_internal_notes": {
"type": "boolean",
"default": true
}
},
"required": ["order_id"]
}
}
The tool still has the same name. It may even be operated by the same organisation. But its behaviour and the data it can expose have changed.
This is not necessarily a malicious update. It could be a legitimate feature release. The problem is that a previously approved capability has silently become broader.
The agent may now have access to information that was never part of the original security review. This is why I would separate the three questions:
- Is this the tool we intended to connect to?
- Is this the exact version of the tool contract we approved?
- Does this particular invocation have permission to perform this particular action?
Those questions are related, but they are not interchangeable. A familiar name answers none of them reliably.
MCP makes tool discovery dynamic, so trust must be dynamic too
One of the useful characteristics of the Model Context Protocol is that clients can discover tools exposed by servers rather than requiring every integration to be hardcoded into the application.
A server can expose a list of tools and their input schemas. Clients can use that information to understand what operations are available. MCP also provides a mechanism for servers to notify clients when their tool list changes.
This is valuable for extensibility. A server can add a capability without requiring an entirely new client implementation.
However, dynamic discovery introduces a security question that traditional static integrations often handle differently: what should happen when the available capabilities change after approval?
Suppose an agent connects to an MCP server at startup. It discovers ten tools, loads their descriptions into its context, and begins processing requests.
Later, the server changes one of those tools. If the client never checks for changes, it might continue operating using an outdated understanding of the server. If it automatically accepts every new tool definition, it might accept a capability expansion without review.
Neither behaviour is a good security policy. The important distinction is between discovering a tool and trusting a tool. Discovery tells the client what the server currently offers. Trust determines whether the application is willing to allow the agent to use that capability.
A tool list is not an authorisation policy.
Tool names are not identities
One of the first changes I would make in an agent architecture is to stop treating a tool name as its identity. A tool named update_customer_record is just a label. Another server can expose a tool with exactly the same name and completely different behaviour.
Even the same server can change the implementation behind that name. For security purposes, I would identify a tool using a combination of attributes:
- The identity of the MCP server.
- The authenticated server endpoint or deployment identity.
- The tool name.
- The approved input schema.
- The approved output contract, where relevant.
- The version of the tool implementation or signed release.
- The capabilities and permissions granted to the tool.
This creates a much stronger identity model. For example, the application might maintain a trusted tool manifest:
{
"server_id": "orders-mcp-production",
"server_identity": "orders-service-prod",
"tool_name": "get_order_details",
"tool_version": "1.4.2",
"schema_fingerprint": "sha256:approved-fingerprint",
"allowed_capabilities": [
"orders.read"
],
"approval_status": "approved"
}
The fingerprint is illustrative, not a real digest. In a real implementation, it would be calculated from a canonical representation of the approved schema.
The point is that the application now has something concrete to compare against.
If the server returns a different schema, the application can detect that the tool contract has changed. It does not have to ask the language model whether the change looks safe.
That decision belongs to the security and policy layer.
Detecting a changed schema before the agent uses it
A schema fingerprint is a useful starting point. The application can serialise a tool schema into a deterministic representation and calculate a cryptographic hash. If the schema changes, the hash changes as well. Here is a simplified Python example:
import hashlib
import json
def schema_fingerprint(schema: dict) -> str:
canonical = json.dumps(
schema,
sort_keys=True,
separators=(",", ":"),
ensure_ascii=False
)
digest = hashlib.sha256(
canonical.encode("utf-8")
).hexdigest()
return f"sha256:{digest}"
The use of sorted keys and consistent serialisation matters. Two JSON objects with identical meaning should not produce different fingerprints simply because their properties appear in a different order.
However, this example is intentionally simple. A production implementation needs a defined canonicalization policy, including how it handles schema references, defaults, descriptions, omitted fields, and version-specific metadata.
It should also distinguish between changes that affect security and changes that do not.
For example, changing a spelling mistake in a description may not require the same response as adding a new parameter that exposes private information.
I would therefore keep two fingerprints where appropriate:
Contract fingerprint: Represents the complete approved tool definition, including descriptions and metadata that influence model behaviour.
Capability fingerprint: Represents the security-relevant aspects of the tool, such as accepted inputs, exposed data, side effects, and required permissions.
This distinction matters because descriptions are not harmless documentation in an AI system. The model may use them to decide when and how to call a tool.
A changed description can influence behaviour even if the input schema remains identical.
At the same time, a schema fingerprint alone cannot prove that the server's implementation is unchanged. A server can preserve its schema while changing what happens behind the API.
That is why schema verification must be combined with server identity, release provenance, runtime authorisation, and implementation controls.
A practical runtime verification layer
I would place a tool verification layer between the MCP client and the agent's tool execution interface. The agent can request a tool call, but the request does not go directly to the MCP server. Instead, the verification layer checks whether the tool is still approved.
The flow looks like this:
User Request
|
v
AI Agent
|
v
Proposed Tool Call
|
v
+---------------------+
| Tool Verification |
| |
| Server Identity |
| Tool Identity |
| Schema Fingerprint |
| Capability Policy |
+---------------------+
|
+-------+-------+
| |
v v
Approved Changed or
Contract Untrusted
| |
v v
Authorisation Block Call
Check Alert / Review
|
v
Input Validation
|
v
MCP Server
|
v
Result Validation
|
v
AI Agent
The important design decision is that the model does not control the verification result.
It can propose a tool invocation, but the application decides whether that invocation is permitted.
Here is a simplified implementation:
class ToolTrustError(Exception):
pass
class ToolVerifier:
def __init__(self, approved_manifest):
self.approved_manifest = approved_manifest
def verify(self, server_id, tool_name, schema):
key = f"{server_id}:{tool_name}"
approved = self.approved_manifest.get(key)
if approved is None:
raise ToolTrustError(
"Tool is not registered as trusted"
)
current_fingerprint = schema_fingerprint(schema)
if current_fingerprint != approved["schema_fingerprint"]:
raise ToolTrustError(
"Tool contract changed after approval"
)
if approved["approval_status"] != "approved":
raise ToolTrustError(
"Tool is not currently approved"
)
return True
The example deliberately fails closed. If the current contract does not match the approved contract, the tool invocation is blocked.
It is important to understand what this code does not do. It does not authenticate the MCP server, prove the server's implementation integrity, validate every input, or enforce authorisation at the resource level. Those controls need to exist separately.
The verifier is one part of the trust boundary, not the entire security architecture.
A changed schema should not automatically mean a malicious tool
There is an important balance here.
I would not want every harmless update to stop an entire production workflow. At the same time, I would not want a tool to gain new permissions just because the server owner added a field.
The answer is a controlled change-management process.
When the application detects a changed tool definition, it should compare the current contract with the approved version and classify the difference.
For example:
| Change | Possible security impact | Suggested response |
|---|---|---|
| Description wording changed | Model behaviour may change | Review and reapprove |
| Optional input added | May expand invocation behaviour | Block pending review |
| Required input changed | Existing calls may behave differently | Block and test |
| Output fields expanded | May expose additional data | Review data permissions |
| New write operation | New side-effect capability | Explicit approval |
| Server identity changed | Trust boundary changed | Reject connection |
| Implementation digest changed | Code provenance changed | Verify release and reapprove |
The exact classification depends on the application.
A change to a tool's description might be low risk in a tightly controlled workflow, but it should not automatically be ignored. A description can contain instructions that influence an agent's behaviour.
A new parameter might also be harmless if it only changes formatting. But if it enables access to internal customer records, it changes the security boundary. The important thing is to make that assessment explicit. I would not allow the language model to decide whether its own tool has become trustworthy. That is a circular security model.
The more dangerous problem: schema unchanged, implementation changed
This is where I think many implementations could develop a false sense of security. Imagine that the original tool has this interface:
def get_order_details(order_id: str):
return database.get_order(order_id)
The tool is read-only and returns the order associated with the supplied identifier. The server is then updated:
def get_order_details(order_id: str):
order = database.get_order(order_id)
audit_service.record_access(order_id)
return {
"order": order,
"customer_profile": database.get_customer(
order.customer_id
),
"internal_notes": database.get_internal_notes(
order.customer_id
)
}
The input schema has not changed at all. The tool still accepts one string called order_id. A schema fingerprint will not detect this implementation change.
The problem is no longer just tool discovery. It is software supply-chain trust. For sensitive MCP servers, I would combine schema verification with additional controls:
1. Server identity verification. The client should authenticate the server and verify that it is connecting to the expected deployment. TLS protects the connection, but the application should also establish the expected service identity.
2. Release provenance. Deployments should have traceable release versions and, where supported, signed artefacts or attestations. The client or deployment platform should be able to establish which approved build is running.
3. Capability enforcement outside the tool. A read-only agent should not become capable of accessing private records simply because a tool implementation starts returning them. The backend must enforce resource-level authorisation.
4. Output filtering. Results should be checked against the data classification and output contract expected by the workflow.
5. Change monitoring. A server release should produce an auditable event that can be compared with the approved deployment state.
The key principle is simple: the schema tells us what a tool claims to accept. It does not prove everything the implementation can do.
The permission problem is bigger than the tool description
I would also avoid giving an agent broad permissions simply because one of its tools needs a particular capability. For example, suppose an agent can retrieve order details and initiate refunds.
A poorly designed system might give the MCP server a general-purpose database credential and a payment API key with broad access. The tool interface might look harmless, but the underlying credentials could allow far more than the agent's approved workflow.
Instead, permissions should be enforced at the action level. For instance:
POLICIES = {
"get_order_details": {
"capabilities": ["orders. read"],
"effect": "read"
},
"reserve_inventory": {
"capabilities": ["inventory.reserve"],
"effect": "write"
},
"issue_refund": {
"capabilities": ["payments.refund"],
"effect": "financial"
}
}
Before executing a call, the application should verify that the authenticated agent has the required capability.
It should also check the resource being accessed, the user's authority, and any business constraints. A tool name is not a permission. A schema is not a permission.
A successful authentication handshake does not permit performing every operation exposed by the server.
This distinction becomes especially important when several agents share the same MCP server. A research agent may need read-only access, while an operations agent may need permission to reserve stock. They should not inherit the same capabilities just because they use the same connection.
Bind approvals to the actual action
There is another problem that appears when a tool invocation requires human approval.
Imagine an agent proposes a refund of ₹25,000. A person reviews the request and approves it. Before execution, the agent changes the amount to ₹75,000. If the system records only that the refund tool was approved, the approval may accidentally be reused for a different action. I would bind the approval to the actual invocation.
That means recording:
- The server identity and tool identity.
- The approved tool contract version.
- The exact resource being affected.
- The action parameters.
- The amount or other sensitive business values.
- The authenticated requester.
- The approval identity.
- An expiry time.
- A unique, single-use approval identifier.
A simplified approval payload might look like this:
{
"approval_id": "approval-8912",
"tool": "issue_refund",
"tool_version": "2.1.0",
"schema_fingerprint": "sha256:approved-fingerprint",
"order_id": "ORD-2048",
"amount": 25000,
"currency": "INR",
"approved_by": "finance-manager",
"expires_at": "2026-11-25T12:00:00Z",
"single_use": true
}
Before executing the refund, the application should compare the proposed action against the approved action.
If the amount, order, destination, or tool contract has changed, the old approval should no longer be valid. This is important because approval is not a general permission slip. It is authorisation for a specific action under specific conditions. The execution layer should also enforce the approval independently. It should not trust the agent to preserve the approved parameters.
What if the tool changes while the workflow is running?
This is a classic time-of-check versus time-of-use problem.
The agent might discover and verify a tool at the beginning of a workflow. Several minutes later, it might invoke that tool after the server has been updated.
A check performed at startup does not guarantee that the tool remains unchanged at execution time. For sensitive operations, I would verify the contract at the point of invocation.
The sequence should look like this:
- Discover the available tool.
- Compare its identity and contract with the approved manifest.
- Authorise the specific action.
- Validate the input against the approved schema.
- Check that the server identity and approved release remain valid.
- Execute the call.
- Validate the response and record the execution evidence.
For long-running workflows, the system should also define what happens when a tool changes between steps.
I would not automatically restart the entire workflow using the new contract. Nor would I silently continue using an old assumption if the server's implementation has been replaced.
Instead, the workflow should preserve the tool version and approval context under which it started.
If the new release is not compatible with that context, the next sensitive operation should stop until the system can establish that it is safe to proceed.
This is particularly important when the workflow contains irreversible operations such as issuing refunds, changing customer permissions, placing orders, or submitting financial transactions.
A tool update should not rewrite the security assumptions of an already-running workflow.
What should happen when verification fails?
I would use explicit states rather than returning a generic tool error.
For example:
| State | Meaning | System behaviour |
|---|---|---|
APPROVED |
Contract matches approved manifest | Continue policy checks |
UNAPPROVED |
Tool has no approved identity | Block invocation |
SCHEMA_CHANGED |
Contract differs from approved version | Quarantine and review |
SERVER_IDENTITY_MISMATCH |
Server identity cannot be verified | Reject connection |
RELEASE_UNVERIFIED |
Implementation provenance is uncertain | Block sensitive actions |
CAPABILITY_DENIED |
Action exceeds granted permission | Reject invocation |
APPROVAL_EXPIRED |
Human approval is no longer valid | Request fresh approval |
MANUAL_REVIEW_REQUIRED |
Change cannot be safely classified | Escalate |
The distinction matters operationally.
A schema change is not necessarily evidence of an attack. But it is evidence that the original approval no longer describes the current contract.
The system should record the observed version, the approved version, the reason for rejection, and the action that was blocked. The agent can then explain that the operation could not proceed because the tool contract changed. It should not be allowed to bypass the restriction by asking for another tool with a similar name.
Build a replay test for tool changes
I would not consider this security control complete until it can be tested automatically.
A useful test suite should contain at least four scenarios.
Scenario 1: An approved tool remains unchanged.
The server identity, tool schema, and approved release match. The tool invocation passes verification and continues to authorisation.
Scenario 2: A new optional parameter appears.
The tool retains its name but now accepts an additional parameter. The verifier detects the contract change and blocks the call pending review.
Scenario 3: The schema remains unchanged, but the server release changes.
The schema fingerprint matches, but the deployment identity or release provenance no longer matches the approved manifest. The system must not assume that the implementation is safe simply because the interface looks familiar.
Scenario 4: A previously approved tool attempts a broader action.
The contract may be valid, but the requested action requires a capability that the agent does not possess. The authorisation layer rejects it.
Here is a simple example using Python:
def test_approved_tool_is_accepted():
verifier = ToolVerifier(approved_manifest)
assert verifier.verify(
"orders-mcp-production",
"get_order_details",
approved_schema
)
def test_changed_schema_is_rejected():
verifier = ToolVerifier(approved_manifest)
try:
verifier. verify(
"orders-mcp-production",
"get_order_details",
modified_schema
)
except ToolTrustError:
return
raise AssertionError(
"Changed tool schema was accepted"
)
These are deliberately small examples. In a real test suite, I would use pytest, fixtures, explicit exception assertions, and integration tests against a controlled MCP server.
I would also test that a notification about changed tools invalidates the appropriate cached contract, that a server restart does not silently restore trust, and that a worker handoff preserves the approved manifest version.
One especially important test is this:
If the same changed tool is presented ten times, does the system consistently reject it until an explicit approval event occurs?
If the answer depends on which agent receives the request, or which worker happens to process it, the trust policy is not deterministic enough.
Tool changes should be auditable events
There is a final engineering detail I would not leave out: the audit trail.
When an agent is blocked from using a tool, the system should record enough information to explain why.
A useful event might contain:
{
"event": "TOOL_CONTRACT_REJECTED",
"server_id": "orders-mcp-production",
"tool_name": "get_order_details",
"approved_fingerprint": "sha256:old-fingerprint",
"observed_fingerprint": "sha256:new-fingerprint",
"approved_version": "1.4.2",
"observed_version": "1.5.0",
"workflow_id": "workflow-7831",
"agent_id": "order-assistant",
"decision": "BLOCKED",
"reason": "APPROVED_CONTRACT_MISMATCH"
}
This makes the decision reproducible.
It also helps distinguish a legitimate deployment from a suspicious change, a configuration error, or a compromised server.
I would keep these events append-only and correlate them with the actual tool invocation attempts. Sensitive credentials, access tokens, and customer data should never be written into the audit log.
The goal is not simply to know that a tool failed.
The goal is to know which contract the application trusted, which contract it observed, which policy it applied, and why the invocation was allowed or rejected.
The architecture I would actually trust
If I were designing this for a production environment, I would separate the responsibilities into four layers.
The discovery layer communicates with MCP servers and retrieves the current tools and schemas. It does not grant permission merely because a tool is discoverable.
The trust layer verifies server identity, approved tool identity, contract fingerprints, release provenance, and version compatibility. It compares observed information against a versioned trusted manifest.
The authorisation layer checks the agent's identity, user authority, resource-level access, action permissions, approval records, and business constraints. It evaluates the actual invocation rather than relying on the tool's description.
The execution layer sends the request, validates the response, records the execution result, and provides evidence for audit and recovery.
This separation prevents a common architectural mistake: allowing the language model to become responsible for both choosing an action and deciding whether the infrastructure is safe enough to execute it.
The agent should be able to propose. The policy layer should decide. The execution layer should enforce. And the audit layer should preserve evidence of what happened.
A practical checklist before deploying an MCP integration
Before I allow an AI agent to use an MCP server in production, I would want clear answers to these questions:
- [ ] Is the MCP server authenticated and bound to an expected identity?
- [ ] Is the approved tool manifest version-controlled?
- [ ] Are tool definitions compared against approved fingerprints?
- [ ] Are descriptions and metadata changes reviewed when they can influence model behaviour?
- [ ] Is implementation provenance verified independently of the schema?
- [ ] Are capabilities enforced outside the language model?
- [ ] Are credentials scoped to the minimum required operations?
- [ ] Are sensitive outputs checked against data-access policies?
- [ ] Are human approvals bound to exact action parameters?
- [ ] Are tool changes detected during long-running workflows?
- [ ] Are changed or unverified tools blocked by default?
- [ ] Are all verification decisions recorded in an auditable event history?
- [ ] Can the security tests reproduce the same decision across retries and worker handoffs?
Not every tool needs the same level of control. A low-risk calculator does not need the same release verification and approval workflow as a tool that can transfer money or modify customer permissions.
But the trust boundary should be explicit in both cases.
The bigger lesson: trust should expire when its assumptions change
I think we have spent a lot of time discussing how an AI agent should decide which tool to call. That is an important problem, but it is only half of the story.
A tool can be selected correctly and still be unsafe to execute.
An agent can follow its instructions perfectly and still operate against a changed interface, a broader permission set, or a different implementation than the one originally reviewed.
This is why I would not treat tool approval as a permanent property attached to a name.
I would treat it as a versioned security decision, tied to an authenticated server identity, a known contract, a verified implementation, and a defined set of capabilities.
When one of those assumptions changes, the application should reassess trust before allowing the next sensitive action.
The language model should not be expected to notice every security-relevant change in a tool description. It should not be asked to determine whether a new parameter is safe. And it should never be allowed to grant itself additional authority simply because a server exposes a new capability.
The most reliable design is one in which the agent can discover new tools, but cannot automatically trust them.
Because in production, the dangerous part is not always that an AI agent makes a bad decision.
Sometimes it makes exactly the decision it was designed to make, using a tool that is no longer what the system originally approved.
The tool's name stayed the same. The trust assumptions did not.
Top comments (6)
Great breakdown of the
get_order_detailssilent schema expansion trap — especially howdefault: trueon newly added fields quietly widens data exposure even when the agent's call-site behavior hasn't changed. One pattern that works well in practice is hashing the canonicalizedinputSchema+descriptionfromtools/listat review time and failing closed in the client middleware whenever the digest drifts, rather than expecting the LLM to spot docstring edits. Pairing that with a deterministic response-field allowlist at the proxy layer also stops newly exposed backend fields from leaking into the context window.Absolutely. I like the combination of schema fingerprinting and response-field allowlisting because they address two different sides of the same problem. The fingerprint detects changes in what a tool is allowed to accept, while the allowlist controls what it can expose in its response. I'd also add one safeguard: treat a digest mismatch as a trust-state change that requires explicit review before execution resumes. A tool should not silently inherit new permissions just because its name and endpoint remain unchanged. The key is to enforce these boundaries in middleware, not rely on the LLM to recognise a security change.
The default-true detail is what makes your example bite — the name and the connection survive the update, and the two new parameters widen what the tool returns without the agent ever making a new decision. Approval bound to the name is approval bound to the one part guaranteed not to change. We hit the same shape from the release side: our verifier re-hashes the artifacts at release time, because a pin you never re-check is just a note you wrote to yourself — the check has to bind to the full definition, description and schema together, not the label. Would you re-approve on any definition change at all, or only on the permission-expanding kind — a new field that narrows what a tool returns would trip the same hash, and I'm not sure it deserves the same stop?
I wouldn't treat every definition change as equally risky. I'd use the full definition, description and schema hash to detect any drift, but let a policy layer classify the change before deciding what happens next. A permission-expanding change, a new parameter with a permissive default, or a change in the tool's meaning should trigger re-approval. A change that demonstrably narrows the response or removes a capability could follow a lower-risk review path. The important distinction is between detecting every change and blocking every change. I'd still require explicit validation before resuming execution, because even a seemingly restrictive change can affect downstream assumptions. A hash tells us something changed; policy determines how seriously we should treat it.
One race to account for: the contract can change between discovery and execution. I'd bind each approved call to the manifest version the policy layer checked, then reject it if that version changes before dispatch. That still won't detect a server changing behavior behind an unchanged schema, so the server-side permissions remain essential.
Exactly. This is where the time-of-check-to-time-of-use gap becomes important. Binding the approval to the exact manifest version ensures the agent executes against the contract that was actually reviewed, not whatever happens to be available at dispatch time. I'd also keep server-side authorization as the final enforcement boundary, because a stable schema doesn't guarantee stable behaviour. Client-side validation protects the approved contract; server-side permissions protect the actual operation. Both are necessary for meaningful security.