<- Back to all posts

Langoedge Blog

Secure LLM Tool Calling: Keeping Credentials Out of the Model's Context

Arnab Chakraborty, Founder, LangoedgeUpdated Oct 25, 20268 min read

Secure LLM tool calling means an agent can send an email, update a CRM record or book an appointment on a user's behalf without the underlying model ever seeing the password, API key or OAuth token that makes the action possible. The model decides what to do; a layer it cannot see or influence decides whether that's allowed and supplies the credential at the moment of the call. Get that separation wrong and a prompt injection, a leaked log line or a careless system prompt can hand an attacker the same access the agent has — which, for a connected inbox or payment system, is a lot.

Key facts

  • OWASP's GenAI Security Project published the first Top 10 for Agentic Applications on 9 December 2025, naming ASI02 "Tool Misuse" and ASI03 "Identity & Privilege Abuse" (leaked or over-scoped credentials letting an agent "operate far beyond their intended scope") as two of the ten core risks of giving an LLM the ability to call tools.
  • The practical fix isn't a cleverer prompt. It's an architecture where the credential lives in a layer the model has no path to read, write or request directly.
  • Langoedge mints an access token fresh at the moment a tool is invoked and never bakes it into a compiled graph, since a graph is compiled once and can be re-run arbitrarily later.
  • Least privilege is a per-step setting, not a one-time account decision: a connector can expose every tool an app offers, or have specific ones switched off for a given step.

What secure tool calling actually has to stop

Before OWASP's agentic list existed, most "LLM security" content was about prompt injection making a chatbot say something embarrassing. Tool calling changes the stakes: the model's output isn't just text anymore, it's an instruction that triggers a real side effect. OWASP's ASI02 category describes this directly as agents being manipulated into bending "legitimate tools into destructive outputs" — the tool itself was authorized, the call it was tricked into making wasn't. ASI03 covers the companion failure: credentials that leak into a place the model (or an attacker manipulating the model) can reach, which then let the agent act with more authority than anyone intended it to have.

Those are two different problems with two different fixes. ASI03 (credential exposure) is solved by architecture: never let the secret enter the model's context in the first place. ASI02 (tool misuse) is solved by scoping: even with clean credentials, an agent should only be handed the specific tools a given step needs, not every action its connected accounts could theoretically perform. Most of what passes for "LLM tool security" advice only addresses the first one.

The rule: the model never sees the credential

In Langoedge's own architecture, this isn't a coding convention a developer has to remember to follow — it's structural. The platform's integrations documentation states it plainly: "Your credentials — OAuth tokens, API keys, database passwords — are never exposed to the LLM or the frontend. The model sees a tool's inputs and whatever the app returns, nothing else."

That holds differently depending on how a tool reaches the agent:

  • MCP connectors (Gmail, Slack, HubSpot, Stripe and the rest of a 3,000-plus-app catalogue) hold credentials in the connect layer, referenced only by an opaque account ID. The access token itself is minted fresh at the moment a tool is actually invoked, not stored inside the compiled graph definition, because a graph is compiled once, cached, and can be triggered again days or months later — baking a live token into that artifact would mean replaying a stale, possibly revoked credential every time.
  • API tools and hand-written integrations get their authentication headers injected by the backend at request time, following a fixed merge order: standard headers already on the user's browser request, then secure account tokens pulled from the credentials vault database, then any custom headers set directly in the node editor. The model configures which header slot a request uses; it never sees what gets placed into it.
flowchart TD A["🧠 Model decides: call send_email"] --> B["🔌 MCP connector node (tool definition only)"] B --> C["⏱️ Runtime needs a token to execute the call"] C --> D["🔐 Connect layer mints token for this account ID"] D --> E["📤 Request sent to Gmail API with the token attached"] E --> F["📥 Result returned to the model as plain text"] style A fill:#2a78d6,stroke:#2a78d6,color:#fff style B fill:#4a3aa7,stroke:#4a3aa7,color:#fff style C fill:#4a3aa7,stroke:#4a3aa7,color:#fff style D fill:#1baf7a,stroke:#1baf7a,color:#fff style E fill:#1baf7a,stroke:#1baf7a,color:#fff style F fill:#eb6834,stroke:#eb6834,color:#fff

The model's context never contains step D's output. It sees the request it asked for (A) and the result it gets back (F) — the token exists only inside the two green steps.

One detail worth being precise about: a graph runs against its owner's connected accounts, not the accounts of whoever happens to be using it at the time. That matters the moment you publish a graph or embed it as a widget — the actions it takes are performed as the person who built it, not the visitor interacting with it, so the account you connect on the Connect page is the one every run of that graph will act through.

Least privilege is a scoping choice, not a trust exercise

Giving an agent a connected Gmail account doesn't have to mean giving it every Gmail action. When an MCP connector node is added to a Text Graph and an app is chosen, it loads that app's entire tool catalogue and exposes all of it by default — read, send, delete, everything the app's API offers. An Enabled tools control on that same node lets a builder switch specific ones off, so a connector attached to a customer-support step can keep Slack's read and post tools while turning off the ones that would let it remove a channel or a member.

flowchart TD A["Step needs a Slack action"] --> B{"Tool in this step's enabled list?"} B -->|"Yes — e.g. post_message"| C["✅ Call proceeds, connect layer handles the token"] B -->|"No — e.g. delete_channel was switched off"| D["🚫 Call rejected before it reaches Slack"] style A fill:#2a78d6,stroke:#2a78d6,color:#fff style B fill:#4a3aa7,stroke:#4a3aa7,color:#fff style C fill:#1baf7a,stroke:#1baf7a,color:#fff style D fill:#e34948,stroke:#e34948,color:#fff

Scoping happens once, on the node, not re-evaluated by hoping the prompt is worded carefully enough each time.

This is also why Langoedge keeps a handful of integrations — Cliniko, ServiceM8, Twilio, Telnyx, Pinecone and Qdrant — hand-written instead of running them through the generic MCP path. Some of those sit on the live voice call itself, where a slow or unpredictable third-party tool catalogue is a latency risk as much as a security one; a dedicated tool with a fixed, reviewed set of actions removes an entire category of "which of this app's 40 exposed actions could a manipulated prompt reach" questions for exactly the integrations where the call can least afford either kind of surprise.

What this doesn't fix

Keeping credentials out of the model's context closes ASI03. It does not, on its own, close ASI02. A connector scoped down to only send_email still lets an agent send an email — and if a prompt injection convinces the model that sending twenty angry emails to a customer's contact list is the right response to "summarize my inbox," credential isolation did its job perfectly and the mailbox still gets abused. Scoping tools narrowly, logging every call with its outcome, and treating any destructive action (delete, send, pay) as a step worth a stricter gate than a read are the mitigations for that half of the problem, and they're a design discipline, not a feature a platform can fully automate for you. Langoedge's own architecture handles the credential half structurally; the scoping half is still a decision every graph builder makes when they choose what to switch on.

FAQ

What does "secure LLM tool calling" actually mean?

It means a large language model can trigger an external action — sending an email, querying a database, booking an appointment — without the credential that authorizes that action (an API key, OAuth token or password) ever appearing in the model's prompt, context window or output. A separate layer holds the credential and supplies it only at the moment of the call.

Why is this riskier than a normal chatbot?

A chatbot's output is just text a person reads. A tool-calling agent's output is an instruction that triggers a real side effect. OWASP's Top 10 for Agentic Applications (December 2025) names this shift explicitly, treating tool misuse and privilege abuse as distinct, first-class risk categories rather than variants of a chatbot saying something wrong.

How does Langoedge keep tokens away from the model?

MCP-connector credentials are held by the connect layer and referenced by an opaque account ID; the real access token is minted fresh at the moment a tool is called rather than stored in the compiled graph. API-tool and hand-written-integration requests get their auth headers injected by the backend at request time, in a fixed priority order, so the model only ever sees a tool's inputs and the data the tool returns.

Does scoping which tools are enabled actually stop misuse?

It reduces the blast radius. If a step's connector only has read and post tools enabled, a manipulated prompt can't use that step to delete a channel or export a mailing list, because the action was never available to call in the first place — the request fails before it reaches the third-party app. It doesn't stop misuse of whatever tools are left enabled.

Does this apply to voice agents the same way as chat agents?

Yes, with one addition: a Voice Graph can't block the live call waiting on a slow MCP tool catalogue, which is one reason integrations on the real-time path (Cliniko, ServiceM8, Twilio, Telnyx, Pinecone, Qdrant) are hand-written with a fixed action set rather than resolved generically — fewer unreviewed actions reachable mid-call, and no catalogue-lookup latency added to the turn.

Sources


About the author. Arnab Chakraborty is the founder of Langoedge, a Melbourne company building voice and text AI agents on LangGraph with direct SIP telephony. Disclosure: the credential-isolation and tool-scoping mechanics described here are Langoedge's own architecture.