Part 10 of 14 · 1 min read
Answering tool-design questions in an interview
How would you secure a server that exposes internal data to an agent?
"Start with least privilege, and make it concrete in layers. Narrow tools instead of a query tool, and I'd say why 'read-only SQL' still leaks. Scopes per tool, with row-level scope taken from the credential, not from arguments. Caps and quotas enforced in code. Short-lived credentials issued per task, with an expiry and an audience. Approval only for irreversible or costly actions, and I'd explain why a rubber-stamp approver is not a control. Useful refusals, and an audit log of every call. I'd assume the model will be fooled by text it reads, so the controls sit outside the model." Follow-up: "How does MCP change this?" The protocol standardises how tools are described and called. It does not decide what a tool may do, so these controls apply to every MCP server regardless.
A tool lets the model run any SQL query, and a poisoned support ticket asks it to dump the customer table. Which control stops that, and why isn't 'tell the model not to' it?
"A narrow tool with a read-only role and a row limit stops it in code, before the request is even attempted. An instruction telling the model not to do something is a request the model may follow anyway. It cannot reliably tell a legitimate instruction from one hidden in data it read." Follow-up: "What is prompt injection and why does it matter here?" Instructions hidden in data the model reads, rather than typed by the user. It's exactly the mechanism behind the poisoned-ticket attack in this module, and Level 10 covers it in depth.