Newer Version Available

This content describes an older version of this product. View Latest

Use the mobile-core Toolset

The mobile-core toolset contains a subset of tools from the mobile toolset focused on development, testing, and optimization of offline capable Lightning web components and the most essential device-native capabilities.

The Mobile Offline LWC tools provide guidance and automated analysis, with a specific focus on patterns that prepare LWCs for offline use by the Komaci offline static analysis engine. This process ensures compatibility with offline-supported applications such as Salesforce Mobile App Plus and the Field Service Mobile App, which depend on Komaci for efficient offline data priming.

  • get_mobile_lwc_offline_guidance – Provides expert review instructions to identify and correct specific offline violations in Lightning web components that require agentic analysis and the ability to recognize contextual patterns.
  • get_mobile_lwc_offline_analysis – Performs comprehensive expert-driven static analysis of Lightning web component bundles to detect offline compatibility violations and provide specific remediation instructions through automated rule-based analysis.

The Mobile Native Capabilities tools assist in creating Lightning web components that integrate with device-native capabilities such as barcode scanning, location services, and biometric functionality.

  • create_mobile_lwc_barcode_scanner – Provides TypeScript API documentation for Salesforce LWC Barcode Scanner, offering expert guidance for implementing barcode scanning features in Lightning Web Components.
  • create_mobile_lwc_location – Provides TypeScript API documentation for Salesforce LWC Location Service, offering expert guidance for implementing location services in Lightning Web Components.
  • create_mobile_lwc_biometrics – Provides TypeScript API documentation for Salesforce LWC Biometrics Service, offering expert guidance for implementing biometric authentication features in Lightning Web Components.

The Mobile Native Capabilities tools are invoked automatically based on your prompts. Below are some possible prompts that invoke the Mobile Native Capabilities MCP tools.

Mobile MCP tools for LWC development uses generative AI, which can produce inaccurate or harmful responses. The output generated by AI is often nondeterministic. Before using the generated output, review it for accuracy and safety. You assume responsibility for how the outcomes are applied to your organization.

Note

Mobile Offline Guidance (get_mobile_lwc_offline_guidance)

When using mobile offline guidance the tool:

  • The get_mobile_lwc_offline_guidance tool is designed to generate instructions first, so you don't need to provide your LWC component bundle initially.
  • The tool provides a structured set of instructions for the AI to execute. It guides the AI to review your LWC code for complex, pattern-based issues that automated scans might miss, such as:
    • Unsupported conditional rendering: Finding modern lwc:if directives and providing guidance to convert them to the legacy if:true/if:false format required for offline compatibility.
    • Inline GraphQL queries: Detecting GraphQL queries written directly inside @wire adapters and guiding on how to refactor them into separate getter methods.
  • The instructions returned by the tool include a crucial automated step. After the AI review is complete, the client is directed to automatically call the companion tool, get_mobile_lwc_offline_analysis.

Mobile Offline Analysis (get_mobile_lwc_offline_analysis)

When using mobile offline analysis the tool:

  • If the tool hasn’t already been executed, start by calling the get_mobile_lwc_offline_analysis tool and provide your complete LWC component bundle as input.
  • The tool automatically runs a static analysis using rules from @salesforce/eslint-plugin-lwc-graph-analyzer. It then returns a structured list of any offline compatibility violations it finds.
  • For each issue found, the tool's output provides:
    • The precise location of the issue, including line and column numbers.
    • A description of why the code is an issue for offline compatibility.
    • A detailed suggested action for how to fix the violation.
  • To ensure a complete report, the client combines the results from this tool's automated scan with the AI-driven review from the companion get_mobile_lwc_offline_guidance tool. This provides a single, comprehensive set of recommendations to make your LWC fully offline-compatible.

Barcode Scanner LWC Tool (create_mobile_lwc_barcode_scanner)

To generate an LWC that uses the device's camera to scan a barcode, use a prompt that invokes the create_mobile_lwc_barcode_scanner tool.

  • Create a mobile-friendly Lightning Web Component (LWC) named productDelivery.
    • The component should feature a button, such as Scan Item for Delivery.
    • When the user taps this button, it should activate the device's native barcode scanner.
    • Upon a successful scan, the component must display the captured barcode data in a text field. It should also present a Confirm Delivery button.
    • Once the user confirms the delivery, the component should reset, clearing the barcode field to prepare for the next scan.

Location Service LWC Tool (create_mobile_lwc_location)

To generate an LWC that gets the user's current GPS location, use a prompt that invokes the create_mobile_lwc_location tool.

  • Create a mobile-friendly Lightning Web Component (LWC) named locationLogger.
    • This component should have a button labeled Log Current Location.
    • When the user taps this button, the component should retrieve the device's current GPS coordinates.
    • Display the obtained latitude and longitude in separate, read-only text fields.
    • Also, include a Clear button to reset the location fields for a new log entry.

Biometrics Service LWC Tool (create_mobile_lwc_biometrics)

To generate an LWC that uses biometric authentication, use a prompt that invokes the create_mobile_lwc_biometrics tool.

  • Create a mobile-friendly Lightning Web Component (LWC) named expenseApproval.
    • The component needs to display basic expense details and an Approve with Biometrics button.
    • When the user taps the button, it must prompt for biometric verification (such as Face ID or a fingerprint scan).
    • If the authentication is successful, display a message stating, "Expense Approved." If it fails, show an error message: "Authentication failed. Please try again."