Custom Lightning Type Creation with Lightning Types MCP Tool (Developer Preview)
The Lightning Types Model Context Protocol (MCP) tool in Salesforce DX MCP Server simplifies and accelerates the creation of LightningTypeBundle metadata. The MCP server uses large language models (LLMs) to analyze your request, generate the required LightningTypeBundle metadata files, and stage them in your local repository so you can use natural language prompts instead of manually creating the JSON files.
Access this tool through Agentforce Vibes in your integrated development environment (IDE). Salesforce DX MCP Server protects your data and credentials with multiple layers of security. See Salesforce DX MCP Server and Tools (Beta).
See Also
- Install and Configure the Salesforce DX MCP Server (Beta)
- MCP Solutions for Developers
- Custom Lightning Types
- LightningTypeBundle Metadata Type
The Lightning Types MCP tool feature is available as a developer preview. Feature isn’t generally available unless or until Salesforce announces its general availability in documentation or in press releases or public statements. All commands, parameters, and other features are subject to change or deprecation at any time, with or without notice. Don’t implement functionality developed with these commands or tools.
To create custom Lightning types by using natural language, install and configure Salesforce DX MCP Server to use Lightning Types tool.
Before you use the Lightning Types MCP tool, review the Salesforce DX MCP server prerequisites and make sure that you have:
- An org with custom Lightning types enabled
- A project connected to a version control system
- A Salesforce IDE, such as Agentforce Vibes IDE or Visual Studio Code (VS Code), that your Salesforce admin has accepted the Terms and Conditions for
- A configured IDE project. To learn how, see Create Projects.
- An IDE connected to the same Salesforce org where you enabled the feature. Connect and authenticate your IDE to this org.
- A cloned project repository open in your IDE’s workspace
- An MCP client, such as the Agentforce Vibes Extension. For setup instructions, see Set Up Agentforce Vibes Extension.
Salesforce DX MCP Server is preconfigured in the Agentforce Vibes Extension. Open your IDE and turn on Salesforce DX MCP Server in the Agentforce Vibes Extension. See Enable Salesforce DX MCP Server.
To enable the Lightning Types MCP tool, configure the Salesforce DX MCP Server arguments. In the args option, use the --tools flag and specify the tool name create_lightning_type. See Configure the Salesforce DX MCP Server for Your Environment (Beta).
You interact with the server by entering natural language prompts in Agentforce. Agentforce Vibes is available from the Activity Bar and includes a chat window where you enter prompts.
To use VS Code as the MCP client, see Quick Start Using the VS Code With Copilot MCP Client (Beta).
See Also
- Install and Configure the Salesforce DX MCP Server (Beta)
- Agentforce Vibes IDE: Supported Editions
- Salesforce Extensions for Visual Studio Code
- Configure the Salesforce DX MCP Server for Your Environment (Beta)
Use natural language prompts to create and configure custom Lightning type bundle files, including schema.json, editor.json, and renderer.json.
How It Works
The create_lightning_type tool generates the necessary LightningTypeBundle metadata files based on your prompts. This tool doesn’t create Lightning Web Components (LWC). You can build the LWC components by using the orchestrate_lwc_component_creation tool.
The tool first analyzes your prompt to generate the schema.json file with the specified properties. By default, the tool doesn’t create editor.json and renderer.json files. To generate the UI override files (editor.json or renderer.json), you must explicitly request them. You can include this request in your initial prompt or use a follow-up prompt. This step links your schema to a Lightning Web Component. The tool stages the new or modified files by using git add.
Sample Workflow: Object-Based Custom Lightning Type
This workflow shows how to create a custom Lightning type by specifying the properties directly in your prompt.
-
Create the schema
Prompt: “Create a custom Lightning type named
LuxuryPropertyListingto showcase premium real estate properties. Include properties foraddress(text),price(number), andisAvailable(boolean).”Sample Response: “Success! The custom Lightning type
LuxuryPropertyListinghas been created inforce-app/main/default/lightningTypes/LuxuryPropertyListing/schema.json. The file has been staged. Please review.” -
Create the LWC
You can create the Lightning Web Component (LWC) manually or use a prompt to generate it with the
orchestrate_lwc_component_creationtool.Prompt: “Create a modern, elegant LWC renderer named
luxuryPropRendererfor this CLT.”The
orchestrate_lwc_component_creationtool handles this prompt.Sample Response: “Success! The LWC
luxuryPropRendererhas been created atforce-app/main/default/lwc/luxuryPropRenderer/. You can now reference it asc/luxuryPropRenderer.” -
Link the LWC to the CLT Schema
Prompt: “Create the renderer metadata for
LuxuryPropertyListing. Link the LWC fields to the Schema fields.”Sample Response: “Success! The
renderer.jsonfile has been created for theLuxuryPropertyListingbundle and staged. It’s configured to usec/luxuryPropRendererand maps its fields to the schema. Please review.”
Sample Workflow: Apex-Based Custom Lightning Type
This workflow shows how to create a custom Lightning type that references an existing Apex class.
-
Create the schema
Prompt: “Create a custom Lightning type that references an Apex class for flight booking. Apex Class:
c__FlightAgent\$AvailableFlight.”Sample Response: “Success! The custom Lightning type
FlightBookinghas been created inforce-app/main/default/lightningTypes/FlightBooking/schema.json. The file has been staged. Please review.” -
Create the LWC
You can create the Lightning Web Component (LWC) manually or use a prompt to generate it with the
orchestrate_lwc_component_creationtool.Prompt: “Create a modern, elegant LWC renderer named
flightBookingRendererfor this CLT.”The
orchestrate_lwc_component_creationtool handles this prompt.Sample Response: “Success! The LWC
flightBookingRendererhas been created atforce-app/main/default/lwc/flightBookingRenderer/. You can now reference it asc/flightBookingRenderer.” -
Link the LWC to the CLT Schema
Prompt: “Create the renderer metadata for
FlightBooking. Link the LWC fields to the Schema fields.”Sample Response: “Success! The
renderer.jsonfile has been created for theFlightBookingbundle and staged. It’s configured to usec/flightBookingRendererand maps its fields to the schema. Please review.”
See Also
Find detailed descriptions and sample prompts for the tool.
| Tool | Description | Sample Prompts |
|---|---|---|
create_lightning_type | (Developer Preview) Creates, enhances, and provides expert guidance and best practices for custom Lightning types. Generates and maintains LightningTypeBundle components, including schema.json, editor.json, renderer.json, and validation rules, for use across Salesforce applications. |
|
If Agentforce Vibes doesn’t automatically invoke the tool, add “using the MCP tool” to your prompt.