Agentforce
Expose Agentforce agents and Prompt Builder templates as MCP tools to allow external AI assistants to invoke Salesforce’s native AI capabilities as part of their workflow. This creates a pathway for tools like Slack’s AI assistant, ChatGPT, or Claude to delegate specialized tasks to Agentforce agents or execute prompt templates server-side, rather than attempting to replicate that logic themselves.
Choose this approach when you want external AI assistants to use domain-specific agents that you built in Salesforce, or when you need prompt templates to execute server-side with access to Salesforce data and the Einstein Trust Layer.
You configure agent-backed and prompt-backed tools through the custom server Setup UI. Select the backing type (Agentforce Agent or Prompt Template), select which agent or template to expose, name the tool, provide a description, and publish. See Custom MCP Servers for the full configuration walkthrough.
When an assistant invokes an agent tool, Salesforce routes the request to the specified Agentforce agent, which processes it using its configured instructions, actions, and knowledge sources. When an assistant invokes a prompt template tool, Salesforce executes the template server-side via the Generations API, applies the Einstein Trust Layer, and returns the result.
Use Agentforce agents as MCP tools when:
- You built specialized Agentforce agents with domain expertise, specific instructions, or access to proprietary knowledge that external AI assistants can invoke.
- You want external assistants to delegate tasks to Salesforce instead of performing those tasks themselves using primitive tools like record queries.
- You need the external assistant to trigger multi-step workflows or complex decision logic that an Agentforce agent already encapsulates.
Use Prompt Builder templates as MCP tools when:
- Your organization has invested in Prompt Builder templates and you want agents in external systems to execute those templates autonomously as part of multi-step workflows.
- You need the prompt to run server-side with access to Salesforce data, rather than requiring the external assistant to retrieve that data and pass it through its own context.
- You want to apply the Einstein Trust Layer—grounding, toxicity detection, and other safeguards that Prompt Builder provides.
Use Apex Actions or Flows instead when:
- The operation is a deterministic business process (updating records, running validation, triggering approvals) rather than generating content or reasoning through a problem.
- You need precise, step-by-step control rather than LLM-driven reasoning.
Agentforce agents:
-
Support triage agent: An external AI assistant in Slack invokes an Agentforce support agent to analyze a case description, determine severity, suggest troubleshooting steps, and identify the right team to route the case to — leveraging the agent’s training on historical case data and org-specific knowledge.
-
Account research agent: A sales rep using ChatGPT asks about a customer’s contract status and renewal likelihood. ChatGPT invokes an Agentforce account intelligence agent that has access to opportunity history, past interactions, and account health metrics, and returns a summary with recommendations.
Prompt templates:
-
Meeting summary generation: An AI assistant in Slack invokes a Prompt Builder template that pulls recent activity records for an account, formats them according to the template’s instructions, and generates talking points for an upcoming meeting — all server-side, with the Einstein Trust Layer applied.
-
Email drafting: A sales rep working in an external tool asks Claude to draft a follow-up email. Claude invokes a Prompt Builder template designed for email generation, passing in the opportunity ID. The template retrieves relevant data from Salesforce, applies the org’s tone and formatting guidelines, and returns a draft.
A single Agentforce agent often handles multiple distinct tasks. For example, a sales-oriented agent might both schedule meetings and predict when deals will close. Even though the same agent performs both functions, create separate MCP tools for each task — one named and described for scheduling meetings, another for deal forecasting — both pointing to the same underlying agent.
This approach makes tool selection more reliable. External AI assistants choose tools based on name and description. A focused, task-specific tool name like “Schedule Customer Meeting” is easier for an assistant to match to user intent than a generic “Sales Agent” tool that does many things.
When the tool name and description clearly signal what the tool does, the assistant is more likely to invoke it at the right time — and less likely to invoke it when a different tool would be better. This is especially important as you add more tools to a custom server. Clear, specific tool names help agents navigate larger tool sets.
Keep tool descriptions synchronized with the underlying agent’s behavior. When you update an agent’s instructions or capabilities, review the MCP tool descriptions in Setup to ensure they accurately reflect what the agent does. Stale descriptions can lead to incorrect tool selection.
- Agentforce agents and Prompt Builder templates must be explicitly configured as tools in a custom MCP server. They are not automatically available.
- Agent and prompt execution runs in the authenticated user’s context—sharing rules, field-level security, and Einstein Trust Layer policies apply.
- The inputs that the agent or prompt template requires become the tool’s parameter schema. Complex or ambiguous input requirements make the tool harder for external assistants to invoke correctly.