Use the Lightning Data Service MCP Tools (Beta)

The Lightning Data Service (LDS) MCP tools help you work better with Salesforce records by providing guidance on the UI API and applying data consistency and referential integrity best practices.

MCP Tools for LWC is a pilot or beta service that is subject to the Beta Services Terms at Agreements - Salesforce.com or a written Unified Pilot Agreement if executed by Customer, and applicable terms in the Product Terms Directory. Use of this pilot or beta service is at the Customer's sole discretion.

  • guide_lds_development - LDS development guidelines and component integration
  • guide_lds_data_consistency - Data consistency patterns and best practices for using LDS-based components and wire adapters
  • guide_lds_referential_integrity - Referential integrity patterns for LDS data management
  • explore_lds_uiapi - Explores and documents LDS UI API capabilities
  • orchestrate_lds_data_requirements - Analyzes and clarifies LDS data requirements to produce PRD-ready specifications
  • guide_lds_graphql - Provides guidelines on implementing GraphQL patterns to work with Salesforce data through the GraphQL wire adapter
  • fetch_lds_graphql_schema - Fetches static GraphQL schema information that contains all the common types referred to by Salesforce GraphQL schemas
  • create_lds_graphql_read_query - Provides guidelines for creating GraphQL read queries

To use these tools, pass the --toolsets flag as part of the args property of your MCP configuration file and specify lwc-experts. See Use DX MCP Tools for LWC for configuration details.

When working with these tools using Agentforce Vibes Extension, you must enable the a4d-general-rules-no-edit.md and a4d-lwc-rules-no-edit.md global rules. The a4d-general-rules-no-edit.md rule is enabled by default. For more information on configuring rules in Agentforce Vibes, see Agentforce Rules in the Agentforce Vibes Extension Developer Guide.

Here are some possible prompts that invoke the LDS MCP tools.

The explore_lds_uiapi tool provides UI API documentation, wire adapters, and type definitions for LWC development.

To use this tool, ask about using UI API for LWC development. Example prompts include:

  • List the available UI API wire adapters and when to use each.
  • Generate the UI API field schema and types for Account.Name, Account.Industry, Contact.Email.
  • Compare imperative vs wired UI API calls for fetching and updating records.

Ths guide_lds_data_consistency tool provides guidance on implementing data consistency patterns when working with Salesforce record data.

To use this tool, ask about maintaining data consistency using LDS-based wire adapters and other data strategies. Examples prompts include:

  • Explain how to use getRecordNotifyChange to keep multiple components in sync.
  • Recommend strategies to handle concurrent edits and stale data with LDS.
  • Outline cache invalidation rules when creating, updating, and deleting related records.

The guide_lds_development tool provides LDS guidelines covering data consistency, referential integrity, and choosing UI API vs Apex, with review checklists and links to specialized knowledge tools.

To use this tool, ask about evaluating a component using LDS development guidelines. Example prompts include:

  • Recommend when to use base components (lightning-record-form) vs custom LDS wires.
  • Provide a checklist for building a record editor: validation, errors, toasts, and refresh.
  • Suggest performance tips for LDS-heavy pages (field minimization, batching, memoization).

The guide_lds_referential_integrity tool provides guidance on implementing referential integrity best practices to make your LWC code resilient against object or field name changes.

To use this tool, ask about referential integrity recommendations. Example prompts include:

  • Describe how to prevent orphaned contact records when deleting a parent account.
  • Recommend validations before updating lookups to maintain relationship integrity.
  • Handle missing or soft-deleted related records gracefully in UI and data flows.

The orchestrate_lds_data_requirements tool provides workflow guidance for analyzing and clarifying LDS data requirements to produce PRD-ready specifications.

To use this tool, ask about LDS data requirements covering objects and fields, relationships, data operations, security, offline considerations, and recommended UI API adapters vs Apex.

  • Generate a step-by-step LDS data requirements spec for my LWC.
  • Help me define objects, fields, and adapters for my LWC using LDS.
  • Create a PRD-ready LDS data access plan for my LWC.

The orchestrate_lds_data_requirements tool calls explore_lds_uiapi to access the latest UI API documentation for LWC development. It can also call the guide_lds_graphql tool to facilitate GraphQL query generation.

The guide_lds_graphql tool gets detailed guidance on implementing GraphQL patterns in LWC when working with Salesforce data through GraphQL API.

To use this tool, ask about working with Salesforce data through a standalone query or via the GraphQL wire adapter. Example prompts include:

  • Design a read query for Account by Id with paginated Contacts, sorted by LastModifiedDate and filtered Opportunities.
  • How do I create a GraphQL query to read accounts with contact information?
  • Use create_lds_graphql_read_query to query contacts with their related Account (query accounts on contacts).
  • Create a GraphQL query for displaying a case queue. Query case by status and priority, with cursor-based pagination.

The tool can further prompt you to select an introspection method: manual, Connect API, or Salesforce CLI. You can't skip introspection because the LDS GraphQL workflow requires it to avoid invalid field and relationship names. Alternatively, the tool prompts you to provide information such as the relationship name so it can generate a query without introspection.

The guide_lds_graphql tool can invoke these tools to help with task completion.

These tools aren't guaranteed to be invoked by guide_lds_graphql. See LWC MCP Tools Usage Considerations

For known limitations on using GraphQL with LWC, see GraphQL Wire Adapter Limitations in the GraphQL API Developer Guide.

The fetch_lds_graphql_schema tool retrieves the full GraphQL introspection schema from a connected Salesforce org and saves it to the local filesystem, returning the file path and metadata.

To use this tool, you can ask about GraphQL schema information, which contains all the common types referred to by Salesforce GraphQL schemas. Example prompts include:

  • Show me the GraphQL schema for the account object.
  • Retrieve input operator definitions for Date, DateTime, and Picklist filtering.
  • List scalar types, enums, and directives for the GraphQL wire adapter.

The create_lds_graphql_read_query tool is called as part of the guide_lds_graphql workflow only. Don't use this tool directly.

The create_lds_graphql_read_query tool provides guidance on creating GraphQL read queries for LDS. For example, it facilitates creating GraphQL read queries, including query structure and syntax, field selection best practices, filtering and sorting techniques, and wire adapter integration.

If you try to invoke the create_lds_graphql_read_query tool, the tool prompts you to run the guide_lds_graphql tool first. Alternatively, you can invoke the create_lds_graphql_read_query tool by asking about creating or modifying a read query.

The create_lds_graphql_mutation_query tool is called as part of the guide_lds_graphql workflow only. Don't use this tool directly.

The tool provides guidance on creating GraphQL mutation queries for LDS, such as for creating, updating, and deleting record data.

The test_lds_graphql_query tool tests a GraphQL query against a connected Salesforce org and returns the result. test_lds_graphql_query is invoked only from the create_lds_graphql_read_query and create_lds_graphql_mutation_query MCP tools.

See Also