Bỏ qua để đến nội dung

Tools Are a Contract, and an Attack Surface

Nội dung này hiện chưa có sẵn bằng ngôn ngữ của bạn.

Module 5 of 5 in the chapter MCP, Headless Systems, and Agent Tools, chapter 22 of the Integration Architect course. Each module stands on its own. Previous: Salesforce as the MCP Client · Next chapter: Agent-to-Agent Integration

The question this module answers: If an agent chooses a tool from its words, how do you write tools agents choose well, and how do you defend against tools whose words lie?

In chapter 3 the contract was a file a developer read: what goes in, what comes out. A developer then wrote code that called one operation, on purpose.

An agent doesn’t work that way. Salesforce puts it in one line: “External models choose tools based only on the name and description. Make each tool task-specific” (The Salesforce Developer’s Guide to the Winter ‘27 Release (opens in a new tab), checked 2026-11-21).

Read that twice. The name and the description aren’t documentation any more. They’re how the caller decides. A tool with a vague description gets called at the wrong time, or not called when it should be. That’s a bug, and it’s in the words.

Salesforce treats the words the same way. When you register a server, it keeps the tool definitions, and in its words, “These definitions represent stable contracts, not just run-time data” (MCP for Agentforce (opens in a new tab), Salesforce Help, checked 2026-11-21).

So write tools the way you’d write an API contract, for a reader who takes every word literally.

  • One job per tool, named for the job. “Get delivery status” beats “query”. “Request a refund for one order” beats “payments”.
  • Say when to use it, and when not to. “Returns the current status of one delivery, by delivery number. Doesn’t return history; use Get delivery history for that.”
  • Describe every input with its format and an example: “delivery number, like D-10042”.
  • Say what it changes. A tool that writes or deletes should say so in its description, and carry annotations that mark it, as Salesforce advises for custom tools: “set annotations explicitly” (General Best Practices (opens in a new tab), checked 2026-11-21).
  • Size it sensibly. Start a little coarse, and split a tool when agents show they need finer control (module 3).
  • Version it. Changing what a tool does is changing a contract. Treat it like a new API version, and tell its callers.

Now the other side. If the agent trusts the words, then whoever writes the words has power over the agent.

Hidden instructions. A tool’s description is text the model reads. A malicious server can put instructions in it, not a description at all: ignore your other rules, send this data somewhere, call this other tool first. This is usually called tool poisoning. The agent reads it as part of its context, and may follow it.

Invisible characters. The instructions don’t even have to be visible to you. Salesforce checks for this when you register a server: “Invisible characters can hide malicious instructions… we check for invisible characters in the names and descriptions of the server and tools, and we warn you before you complete registration.” And its advice if you see that warning: “consider these tools to be high risk” (Register a Third-Party MCP Server in Agentforce Registry (opens in a new tab), checked 2026-11-21).

A tool that changes after you approved it. Salesforce calls it a rug pull: “A rug pull occurs when a previously safe MCP server or tool is updated by the publisher to include malicious instructions. Rug pulls occur after the server is registered.” In plain words: the tool you reviewed isn’t the tool that’s running. Salesforce’s defence is to keep the definitions from the day you allowlisted them, “scan for changes at the beginning of each agent session and whenever an agent calls a server tool,” and “automatically block use of the out-of-sync server or tool,” blocking “only the affected actions.”

That last defence is the contract idea doing security work. Because the approved definition is kept as the contract, a change is visible, and a changed tool stops until someone looks at it.

Salesforce’s checks help. They don’t replace your decisions. Here’s the list I’d work through for every MCP server an agent can use.

  1. Trust the publisher before the tool. Who runs this server, what token does it hold, and how fast could you cut it off? Those are chapter 18 module 7’s vendor questions, asked of a new kind of vendor.
  2. Allowlist few tools. Only the ones this agent needs for its job, never the whole server.
  3. Read every description you allow. Out loud, if it helps. Anything that reads like an instruction to the agent rather than a description of the tool is a reason to stop. Treat Salesforce’s invisible-character warning as a no.
  4. Limit what the identity can do. Whatever a poisoned tool talks the agent into, it can only do what the agent’s identity allows. That’s least privilege, from the Identity course’s Agent Identity chapter.
  5. Put a person in front of the irreversible. As I put it at Dreamforce: high consequence or irreversible action, require human oversight. A refund, a deletion, a payment: the agent proposes, a person approves.
  6. Review changes on purpose. When a tool is blocked for changing, someone reads the new definition and decides. Salesforce suggests using “trace data in Agentforce Builder to identify when MCP tool actions are out of sync.”

Now picture a company with a dozen agents and a dozen MCP servers. If every agent connects to every server on its own, you’ve drawn chapter 5’s web again, with agents as the boxes: credentials everywhere, allowlists everywhere, and no single place that sees what every agent did.

So put one door in front of the tools.

Agents and tools, through one gateway Agents and tools, through one gateway. On top, three callers that choose: a service agent that helps reps with orders, a sales agent that prepares quotes, and an outside AI client, a person's own assistant. Each calls the MCP gateway in the middle, in navy, one door in front of every tool, which checks who is calling, which tools are allowed, how often, whether the tool has changed, and keeps the log. The gateway passes allowed calls to three MCP servers underneath: a shipping company's tracking tools, a payment provider's refund tools, and your ERP through the integration layer. The footnote: without the gateway, every agent connects to every server on its own, chapter 5's web with agents as the boxes. {"author": "Steve Simpson", "blueprint": "1.0.0", "builder": "standard 1.59.0", "built": "2026-11-20", "id": "DGM-INT-AM-02", "rights": "\u00a9 2026 Twinshark LLC. All rights reserved.", "template": "layers 0.1.0", "theme": "stevetecharc 1.4.0"} Agents and AI clients A service agent helps reps with orders A sales agent prepares quotes An outside AI client a person's own assistant The MCP gateway one door in front of every tool who is calling which tools are allowed how often has the tool changed? the log MCP servers A shipping company tracking tools A payment provider refund tools Your ERP through the integration layer calls calls calls allowed allowed allowed Without the gateway, every agent connects to every server on its own: chapter 5's web, with agents as the boxes. HOW TO READ IT Callers that choose: agents and AI clients The gateway: the door policy for tools Tools, each with a name, a description and a contract © 2026 Twinshark LLC · stevetecharc.com
Click to enlarge

Every agent, every tool, one door.

That’s chapter 18’s gateway, doing the job it was heading for. Salesforce’s own version is Agentforce Gateway, where “you can create and apply policies to govern MCP server usage and behavior, including rules for specific agents and MCP tools” (MCP for Agentforce (opens in a new tab)). Across vendors, the MCP gateways from module 4 do the same.

And look at what the picture is. A contract on every tool. Something in the middle that checks every call. A list of what each agent may call. The same three ideas from chapter 17, in their newest form. Chapter 23 adds the last piece: when the thing an agent calls is another agent.

Beyond the exam. Tool design and tool poisoning aren’t in the Integration Architect exam’s objectives. The exam’s security habits carry straight over: least privilege, a narrow contract, a review before anything new is trusted, and one place to control and log access.

  • The words on every tool you publish: one job, when to use it, every input, what it changes, and its version.
  • Which servers and tools each agent may use, after the publisher and every description have been reviewed.
  • The identity behind each agent, so a poisoned tool can’t do much.
  • Which actions need a person’s approval.
  • Who reviews a changed tool, and how quickly.
  • The gateway in front of every tool, with the log in one place.