According to an article published on Salesforce Blog, most tool calls within the Model Context Protocol (known as MCP) conclude when a tool running on an MCP server returns a JSON result, and the large language model (LLM) inside the AI assistant, such as Claude or Slackbot, summarizes the received data. This approach leaves it up to the model to decide what details to emphasize and which data points will be included in the final displayed output. Salesforce's Headless Experience Layer (or HXL for short) allows developers to determine how output is presented to end users by defining the interface once as a structured widget and displaying it natively in supporting AI assistants. Currently, HXL supports Agentforce employee agents in Lightning Experience, along with ChatGPT, Claude, and Slackbot as beta channels, and the offering is provided under the Beta Services Terms. The HXL layer is part of the Headless Toolkit that brings interactive experiences to AI assistants, with the Headless Toolkit serving as a collection of MCP servers, skills, APIs, and developer tools powering the AIforce strategy to bring all Salesforce context to the interface where the user works.
Three Ways to Present Salesforce Action Results and When to Rule Out HXL
When a developer can determine how output is displayed, they can choose what to emphasize and how to render the information for each use case, even when the data originates from the same MCP server. According to the article, there are three ways to present the result of a Salesforce action to users: letting the AI assistant render it on its own, sending an HXL widget, or building a Lightning web component (or LWC) for users who do not work inside an AI assistant. The guiding rule is to send an HXL widget when each value must appear in the same place every time the result is shown, and to let the assistant render the result when the user only needs an answer. If users do not work inside an AI assistant, the interface is built on a Lightning page.
The article details when to rule out the use of HXL in advance: if users perform their work on a Lightning record page or in a console application such as Service Console and do not turn to an AI assistant to obtain results, HXL is not needed. In these cases, it is recommended to start with standard page components, and build a Lightning web component only when standard components cannot display what the user needs. This principle also applies to an Experience Cloud site that does not yet have an agent embedded in it. Conversely, if users request results inside Claude, ChatGPT, Slackbot, or through an Agentforce employee agent in Lightning Experience, developers face only two options: let the assistant render the tool result or send an HXL widget.
When Assistant Rendering Is Sufficient and When an HXL Widget Is Needed
Displaying a result inside an AI assistant does not require using a widget. Assistants such as Claude, ChatGPT, and others already render MCP tool results as text, lists, and tables. For exploratory questions, such as checking what is happening with a specific client account, this presentation is entirely sufficient. The user wants an answer, and a summary that varies from run to run causes no harm, meaning adding a widget would only introduce unnecessary build and maintenance overhead.
In contrast, an HXL widget should be sent when the presentation itself matters: which fields appear and in what order, how they are grouped and labeled, and which buttons are presented to the user. Leaving this to the AI assistant means it decides all these details and can decide differently on every run. A tighter output structure from the action only shapes the data the assistant receives back, leaving the assistant to choose how to lay it out. A widget, by comparison, renders from its own standalone definition, which is why only a widget fixes the component order, grouping, and buttons. A widget defines the structure once, allowing it to be tested in advance.
Approval requests are a good example of this. A sales manager approves discounts in Slackbot several times a day. If the assistant renders each request on its own, the discount rate might lead one answer but appear halfway down the next, and the policy limit might not appear at all. A widget positions the requested discount directly alongside the policy limit in the same place every time it renders, with Approve and Reject buttons that send the manager's decision back to the assistant, which then calls the approval action. In this way, the manager can make a decision without reading the entire response.
Design Once and Ship to Multiple AI Assistants
The sales manager from the approvals example is likely to use a common pairing: an Agentforce agent in Lightning Experience alongside Slackbot. If the manager works in Salesforce during morning hours and in Slack for the rest of the day, the discount request needs to look identical in both environments. Without HXL, two separate builds of the same card are required: a Lightning web component to render the action output in Agentforce, and a custom Block Kit message for Slack. With HXL, a single widget that both interfaces can render replaces both builds. The developer still connects the widget to external MCP channels via metadata, but the card itself is built only once. The cost of building the widget remains the same whether it renders in a single assistant or across four, so the investment pays off more as users operate in more assistants.
In addition, the HXL Playground environment enables developers to define the interface once as a widget and preview how it renders in Agentforce, Slackbot, ChatGPT, and Claude using mock data.
Technical Structure: HXL Components, Lightning Types, and MCP Server Wiring
HXL widgets are defined in metadata rather than being arbitrary React applications. The widget resides inside the Salesforce organization (org) and describes what the user sees: which HXL components appear, in what order, and which fields from the action's output populate them. Each supported assistant renders these components in its native style.
A developer composes the widget in JSON format from HXL's 22 components, such as rows, tables, badges, links, callouts, and buttons. The same definition is deployed to Agentforce, Slackbot, ChatGPT, and Claude without changes. Each assistant renders it in its native style, and a few component properties behave differently across interfaces. A widget can be built and tested in the HXL Playground or generated using Agentforce Vibes.
Custom Lightning types connect the widget to data by mapping the fields of the action's structured output to the widget's attributes: one Apex-based type for Agentforce, and two object-based types for MCP channels—one as a result wrapper and one as the payload.
To display the widget in an AI assistant, it is attached to the action that returns the data. In Agentforce, the custom Lightning type is selected as the action's output rendering. For Slackbot, ChatGPT, and Claude, the action is added as a tool on a custom MCP server within the org, the widget is attached to that tool, and each assistant is connected to the server, which is configured once for all three. This path currently works exclusively for invocable actions, requiring the approval request to be built as an Apex invocable action from the start.
Widget Limitations and Scenarios Unsuited for HXL
This path is not suitable for every approval scenario. If the manager wishes to compare the request against a chart showing past account discounts, the widget cannot draw a chart, because none of the 22 components in the HXL beta release is a chart component. In this situation, the AI assistant should be allowed to render the result, as Claude and ChatGPT can draw a chart from a tool result when the user requests one. Alternatively, if the manager works exclusively in Agentforce within Lightning Experience, a Lightning web component based on the same custom Lightning type can draw the chart.
Furthermore, if the manager wants to drag the discount amount and see how the profit margin recalculates before granting approval, that is modeling work. Work of this nature belongs on the Opportunity record page in Lightning Experience, rather than in a conversational exchange with an AI assistant.
In summary of the decision framework, the article emphasizes choosing based on where users work and what they need to see: if they work on a Lightning record page or on an Experience Cloud site without an agent, build using LWC components and leave HXL out. If they work in an AI assistant, allow the assistant to render the result when they only require an answer (including chart requests). Conversely, ship an HXL widget when it matters where each value appears and what sits beside it, as the model could place it elsewhere on the next run. The article points to further reading in Salesforce trust and architecture guides, a developer post on building interactive UI, and the HXL developer guide.