DEV Community

Akarshan Gandotra
Akarshan Gandotra

Posted on

Your Agent's Tool List Is Not a Permission Model

Most agent setups make one access decision, and they make it before the agent starts: which tools does it get? Email, calendar, the CRM, a shell, a browser. Pick from the menu and you're done.

I think that's the wrong unit. A tool isn't a permission. It's a bundle of every call the tool can make, and the risk lives in the call.

The same tool, two different calls

email.send(to="me@mycompany.com", body="Here's your summary") is a convenience.

email.send(to="someone@elsewhere.com", body=<last quarter's contract pricing>) is a data leak.

Same tool, same agent, same entry on the allowlist. The difference is entirely in the arguments: who it goes to and what it carries. An allowlist of tool names can't tell those two apart, and neither can a scope like email:send.

The same goes for almost every useful tool. http.fetch covers both "read a docs page" and "post our data to any URL". files.write covers both a draft and an overwritten config. shell.run covers everything.

Authorize the call, not the tool

So the check has to happen on every call, with the call in hand:

  • Who: the agent, the user it works for and the session.
  • What: the tool and the arguments that matter, such as the recipient, path, amount or destination.
  • Where the data goes: inside the organization, or out.
  • What the session has already touched: an agent that read customer records five minutes ago is a different risk when it asks to send an email.

That last one matters more than it looks. Simon Willison calls it the lethal trifecta: an agent with access to private data, exposure to untrusted content and a way to send data out can be talked into leaking. Each tool looks fine on its own. The combination is the problem, and only something that sees the whole session can catch it.

A policy for one tool might look something like this. It's a sketch, not a spec:

tool: email.send
allow:
  to: "*@mycompany.com"
ask:
  to: "*"            # anyone else: show the user the recipient and the body
deny:
  if_session_read: [customer_pii, contract_pricing]
Enter fullscreen mode Exit fullscreen mode

Don't let tools describe their own risk

MCP lets a tool server mark its tools with hints like readOnlyHint and destructiveHint. They're useful for display, and the spec itself says to treat them as untrusted unless the server is trusted. A tool that calls itself read-only isn't read-only because it says so.

Tool descriptions have the same problem. They're text the model reads, written by whoever runs the server, and they can change after you approved them. Pin the definitions you reviewed, diff them like a dependency when they change, and keep the risk rating with whoever owns the policy, not with the tool's author.

Put a gateway between the agent and its tools

The enforcement point is a tool gateway that every call the agent makes goes through. It holds the real credentials, so the agent never sees an API key. It checks each call against policy, and it records the call with the agent, the user, the session and the arguments.

We made the same move years ago with API gateways for people. Nobody gives a browser the database password, and we shouldn't give an agent the Slack token either.

Ask about calls, not tools

When a call does need a human, the prompt should show the call. "Send this email to someone@elsewhere.com?", with the body underneath, beats "Allow this agent to use email?" People can judge a recipient. They can't judge a tool name.

This also keeps prompts rare. Most calls are plainly fine or plainly not, and a policy can decide those. The ones left over are the ones worth a person's attention.


Tools are how agents touch the world. Gate the touch, not the menu.

This follows my earlier post, Zero Standing Access for AI Agents, which covers how an agent gets access in the first place. This one is about what it does with that access.

Top comments (5)

Collapse
 
noahberg_cs profile image
Noah Berg •

This is the bit that keeps biting teams who think an MCP allowlist is enough.

We ran into the email.send version of this with social publish tools: same tool, totally different risk if the call is a draft to a client folder vs publish-now to every connected account. Tool name on the allowlist looked fine. Arguments were the whole story.

Two things that helped on our side:

  1. Treat destructive or outbound calls as ask-by-default, and show the resolved args in the prompt (network, account, caption preview), not a tool name.
  2. Keep a short session note of what the agent already read. If it pulled private analytics or a client brief earlier, an outbound publish should escalate even if the tool itself was already allowed.

The gateway idea matches how we'd rather wire agents anyway. Credentials stay outside the model, and the policy lives next to the call, not in the tool description the vendor wrote.

Collapse
 
freedailypro profile image
FreeDailyPro •

This matches what I've been hitting in practice. Allowlisting email.send felt like security until the agent used it with a recipient outside the org after reading a private doc in the same session.

One thing I'd add to your gateway sketch: treat MCP readOnlyHint / destructiveHint as UI only and re-derive risk from the call args on your side. I've seen servers flip those annotations between versions, so pinning the reviewed tool schema (and failing closed on a diff) is the only way I've trusted the menu at all.

Curious whether you've tried denying http.fetch when the session already touched PII, the way you sketched for email — that combo has bitten me harder than any single tool.

Collapse
 
botquests profile image
BotQuests •

The point about the session is the part people most often miss. Per-call checks on arguments catch the email-to-the-wrong-domain case, but not an agent that read sensitive data earlier and now has an outbound channel, so tracking what the session has touched really does matter. One practical addition: make the policy layer deny by default and run it outside the model, in the tool server or a gateway, so a prompt-injected agent can't talk its way past it. For the 'ask' cases, show the user the resolved arguments (the actual recipient and the actual body) rather than the model's description of what it intends to do. Logging each decision with the call and session context also makes policies much easier to tune later.

Collapse
 
kevinhall profile image
Kevin Hall •

agree, and on our side we cap the call instead of the tool, a max charge on every call limits what one loose filter can cost

not a policy by any means, but it makes a wrong argument a cheap mistake and not a bill

Collapse
 
sattyamjjain profile image
Sattyam Jain •

On the question in the comments about denying http.fetch once a session has touched sensitive data: I maintain agent-airlock, and it has a grant-time version of a similar rule. Its capability union check treats filesystem read or credential access combined with non-allowlisted network egress as an exfiltration path, and denies the second grant with an error naming the earlier lease. Allowlisted egress does not count.
github.com/sattyamjjain/agent-airl...

Limits, so nobody over-reads it: it works on capability categories the operator tags at grant time, not by inspecting each call's arguments. You call the engine yourself; the @Airlock decorator does not call it. It runs in-process, so it is not the gateway you recommend. And leases are not signed and do not expire.

So I agree with your main point. The tool list says what exists, and a separate layer has to decide what a session may combine.