Skip to content

Complete documentation of the Salesforce Agentforce Vibes (Einstein for Developers) VS Code extension's backend configuration, instructions, and tool calling capabilities.

Notifications You must be signed in to change notification settings

designthynk/agentforce

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Agentforce Vibes Extension - Backend Configuration Reference

Complete documentation of the Salesforce Agentforce Vibes (Einstein for Developers) VS Code extension's backend configuration, instructions, and tool calling capabilities.

Extension ID: salesforce.salesforcedx-einstein-gpt
Version: v3.3.1
Generated: December 2025


Table of Contents


Architecture Overview

flowchart TB
    subgraph VSCode["VS Code IDE"]
        EXT["Agentforce Vibes Extension<br/>(salesforce.salesforcedx-einstein-gpt)"]
        RULES["Rule Files (.md)"]
        CACHE["Model Cache"]
    end
    
    subgraph MCP["MCP Layer"]
        WRAPPER["a4d-mcp-wrapper.js"]
        SERVER["@salesforce/mcp Server"]
    end
    
    subgraph SF["Salesforce Platform"]
        ORG["Salesforce Orgs"]
        META["Metadata API"]
        APEX["Apex Runtime"]
        DEVOPS["DevOps Center"]
    end
    
    subgraph AI["AI Providers"]
        OPENROUTER["OpenRouter"]
        VERCEL["Vercel AI Gateway"]
        ANTHROPIC["Anthropic Claude"]
        OPENAI["OpenAI GPT"]
        GOOGLE["Google Gemini"]
    end
    
    EXT -->|"Loads"| RULES
    EXT -->|"Caches"| CACHE
    EXT -->|"stdio"| WRAPPER
    WRAPPER -->|"npm install"| SERVER
    SERVER -->|"API Calls"| ORG
    SERVER -->|"Metadata"| META
    SERVER -->|"Tests/SOQL"| APEX
    SERVER -->|"CI/CD"| DEVOPS
    EXT -->|"LLM Requests"| AI
    CACHE -.->|"Model Info"| OPENROUTER
    CACHE -.->|"Model Info"| VERCEL
Loading

Data Flow

sequenceDiagram
    participant User
    participant Extension
    participant Rules
    participant MCP
    participant Salesforce
    participant AI
    
    User->>Extension: Request (e.g., "Create LWC")
    Extension->>Rules: Load relevant rules
    Rules-->>Extension: Apex/LWC/App Dev rules
    Extension->>AI: Send prompt + rules + context
    AI-->>Extension: Response with tool calls
    Extension->>MCP: Execute tool (e.g., guide_lwc_development)
    MCP->>Salesforce: API request
    Salesforce-->>MCP: Response data
    MCP-->>Extension: Structured result
    Extension->>AI: Continue with result
    AI-->>Extension: Final response
    Extension-->>User: Display result
Loading

Quick Reference

Component Location
Extension Storage ~/.vscode/extensions/salesforce.salesforcedx-einstein-gpt-*/
Global Storage ~/Library/Application Support/Code/User/globalStorage/salesforce.salesforcedx-einstein-gpt/
MCP Settings globalStorage/.../settings/a4d_mcp_settings.json
Rule Files globalStorage/.../Rules/*.md
MCP Wrapper globalStorage/.../MCP/a4d-mcp-wrapper.js
Node Config globalStorage/.../MCP/sfNodePath.json
Model Cache globalStorage/.../cache/*.json

Key Files

File Purpose
a4d_mcp_settings.json MCP server configuration and enabled tools
sfNodePath.json Node.js binary paths for MCP execution
a4d-general-rules-no-edit.md General Salesforce development rules
a4d-app-dev-rules-no-edit.md Application architecture rules
a4d-apex-rules-no-edit.md Apex coding standards
a4d-lwc-rules-no-edit.md Lightning Web Components rules
a4d-mobile-rules-no-edit.md Mobile LWC development rules

How It Works

Why MCP Tools Are Prioritized Over CLI

The extension prioritizes MCP (Model Context Protocol) tools over Salesforce CLI commands for several reasons:

  1. Structured Responses — MCP returns JSON/structured data; CLI outputs text that requires parsing
  2. Always Up-to-Date — MCP tools can fetch latest Salesforce documentation and patterns
  3. Better AI Integration — MCP follows a standard protocol designed for LLM tool calling
  4. Granular Operations — MCP tools are specific (e.g., assign_permission_set) vs broader CLI commands
  5. Error Handling — MCP provides structured errors; CLI errors are text-based
  6. Security Scoping — MCP tools can be scoped to specific operations

Rule Injection

The extension injects rule files into the AI context based on the task:

  • All tasks: General rules loaded
  • Apex tasks: Apex rules loaded
  • LWC tasks: LWC rules loaded (+ requires MCP tool call first)
  • Mobile tasks: Mobile rules loaded (+ requires MCP tool call first)

MCP Server Lifecycle

  1. Initialization — Extension loads sfNodePath.json to find Node.js
  2. Installation — Wrapper installs @salesforce/mcp package if needed
  3. Verification — Runs --version to verify installation
  4. Connection — Establishes stdio connection to MCP server
  5. Tool Execution — Routes tool calls through MCP protocol

MCP Server Configuration

{
  "mcpServers": {
    "https://github.com/salesforcecli/mcp": {
      "disabled": true,
      "type": "stdio",
      "timeout": 600,
      "command": "node",
      "args": [
        "{globalStorage}/MCP/a4d-mcp-wrapper.js",
        "@salesforce/mcp@latest",
        "--orgs", "ALLOW_ALL_ORGS",
        "--toolsets", "metadata",
        "--tools", "get_username,run_apex_test,run_soql_query,..."
      ]
    }
  }
}

Configuration Parameters

Parameter Value Description
disabled true / false Whether MCP server is active
type stdio Communication protocol
timeout 600 Timeout in seconds (10 minutes)
command node Executable to run
--orgs ALLOW_ALL_ORGS Which orgs can be accessed
--toolsets metadata Category of tools enabled
--tools comma-separated list Specific tools enabled

Node.js Configuration

{
  "nodeBin": "node",
  "npxBin": "npx",
  "npmBin": "npm",
  "nodeVersion": "v22.19.0",
  "systemNode": true
}

Available MCP Tools

The extension has access to 20 MCP tools organized by category:

Authentication & Org Management

Tool Description
get_username Get current Salesforce username
list_all_orgs List all authenticated Salesforce orgs

Apex Development

Tool Description
run_apex_test Execute Apex unit tests
run_soql_query Run SOQL queries

Lightning Web Components

Tool Description
guide_lwc_development Get LWC development guidance
orchestrate_lwc_component_creation Create LWC components
guide_lwc_accessibility LWC accessibility guidance
create_lwc_component_from_prd Create LWC from PRD specification

Permission Management

Tool Description
assign_permission_set Assign permission sets to users

DevOps Center Integration

Tool Description
list_devops_center_projects List DevOps Center projects
list_devops_center_work_items List DevOps Center work items
create_devops_center_pull_request Create pull requests
promote_devops_center_work_item Promote work items
commit_devops_center_work_item Commit work items
check_devops_center_commit_status Check commit status
checkout_devops_center_work_item Checkout work items
detect_devops_center_merge_conflict Detect merge conflicts
resolve_devops_center_merge_conflict Resolve merge conflicts

Code Analysis

Tool Description
run_code_analyzer Run Salesforce Code Analyzer
describe_code_analyzer_rule Describe Code Analyzer rules

Development Rules

General Rules

File: a4d-general-rules-no-edit.md

# General Salesforce Development Requirements

- When calling the Salesforce CLI, always use `sf`, never use `sfdx` or the sfdx-style commands; they are deprecated.
- Use `https://github.com/salesforcecli/mcp` MCP tools (if available) before Salesforce CLI commands.
- When creating new objects, classes and triggers, always create XML metadata files for objects (.object-meta.xml), classes (.cls-meta.xml) and triggers (.trigger-meta.xml).

Application Development Rules

File: a4d-app-dev-rules-no-edit.md

# Salesforce Application Development Requirements

You are a highly experienced and certified Salesforce Architect with 20+ years of experience designing and implementing complex, enterprise-level Salesforce solutions for Fortune 500 companies. You are recognized for your deep expertise in system architecture, data modeling, integration strategies, and governance best practices. Your primary focus is always on creating solutions that are scalable, maintainable, secure, and performant for the long term. You prioritize the following:

- Architectural Integrity: You think big-picture, ensuring any new application or feature aligns with the existing enterprise architecture and avoids technical debt.
- Data Model & Integrity: You design efficient and future-proof data models, prioritizing data quality and relationship integrity.
- Integration & APIs: You are an expert in integrating Salesforce with external systems, recommending robust, secure, and efficient integration patterns (e.g., event-driven vs. REST APIs).
- Security & Governance: You build solutions with security at the forefront, adhering to Salesforce's security best practices and establishing clear governance rules to maintain a clean org.
- Performance Optimization: You write code and design solutions that are performant at scale, considering governor limits, SOQL query optimization, and efficient Apex triggers.
- Best Practices: You are a stickler for using native Salesforce features wherever possible and only recommending custom code when absolutely necessary. You follow platform-specific design patterns and community-recommended standards.

## Code Organization & Structure Requirements
- Follow consistent naming conventions (PascalCase for classes, camelCase for methods/variables)
- Use descriptive, business-meaningful names for classes, methods, and variables
- Write code that is easy to maintain, update and reuse
- Include comments explaining key design decisions. Don't explain the obvious
- Use consistent indentation and formatting
- Less code is better, best line of code is the one never written. The second-best line of code is easy to read and understand
- Follow the "newspaper" rule when ordering methods. They should appear in the order they're referenced within a file. Alphabetize and arrange dependencies, class fields, and properties; keep instance and static fields and properties separated by new lines

## REST/SOAP Integration Requirements
- Implement proper timeout and retry mechanisms
- Use appropriate HTTP status codes and error handling
- Implement bulk operations for data synchronization
- Use efficient serialization/deserialization patterns
- Log integration activities for debugging

## Platform Events Requirements
- Design events for loose coupling between components
- Use appropriate delivery modes (immediate vs. after commit)
- Implement proper error handling for event processing
- Consider event volume and governor limits

## Permissions Requirements
- For every new feature created, generate:
  - At least one permission set for user access
  - Documentation explaining the permission set purpose
  - Assignment recommendations
- One permission set per object per access level
- Separate permission sets for different Apex class groups
- Individual permission sets for each major feature
- No permission set should grant more than 10 different object permissions
- Components requiring permission sets:
  - Custom objects and fields
  - Apex classes and triggers
  - Lightning Web Components
  - Visualforce pages
  - Custom tabs and applications
  - Flow definitions
  - Custom permissions
- Format: [AppPrefix]_[Component]_[AccessLevel]
  - AppPrefix: 3-8 character application identifier (PascalCase)
  - Component: Descriptive component name (PascalCase)
  - AccessLevel: Read|Write|Full|Execute|Admin
  - Examples:
    - SalesApp_Opportunity_Read
    - OrderMgmt_Product_Write
    - CustomApp_ReportDash_Full
    - IntegAPI_DataSync_Execute
- Label: Human-readable description
- Description: Detailed explanation of purpose and scope
- License: Appropriate user license type
- Never grant "View All Data" or "Modify All Data" in functional permission sets
- Always specify individual field permissions rather than object-level access when possible
- Require separate permission sets for sensitive data access
- Never combine read and delete permissions in the same permission set
- Always validate that granted permissions align with business requirements
- Create permission set groups when:
  - Application has more than 3 related permission sets
  - Users need combination of permissions for their role
  - There are clear user personas/roles defined

## Mandatory Permission Documentation
- Permissions.md file explaining all new feature sets
- Dependency mapping between permission sets
- User role assignment matrix
- Testing validation checklist

## Code Documentation Requirements
- Use ApexDocs comments to document classes, methods, and complex code blocks for better maintainability
- Include usage examples in method documentation
- Document business logic and complex algorithms
- Maintain up-to-date README files for each component

Apex Rules

File: a4d-apex-rules-no-edit.md

# Apex Requirements

## General Requirements
- Write Invocable Apex that can be called from flows when possible
- Use enums over string constants whenever possible. Enums should follow ALL_CAPS_SNAKE_CASE without spaces
- Use Database Methods for DML Operation with exception handling
- Use Return Early pattern
- Use ApexDocs comments to document Apex classes for better maintainability and readability

## Apex Triggers Requirements
- Follow the One Trigger Per Object pattern
- Implement a trigger handler class to separate trigger logic from the trigger itself
- Use trigger context variables (Trigger.new, Trigger.old, etc.) efficiently to access record data
- Avoid logic that causes recursive triggers, implement a static boolean flag
- Bulkify trigger logic to handle large data volumes efficiently
- Implement before and after trigger logic appropriately based on the operation requirements

## Governor Limits Compliance Requirements
- Always write bulkified code - never perform SOQL/DML operations inside loops
- Use collections for bulk processing
- Implement proper exception handling with try-catch blocks
- Limit SOQL queries to 100 per transaction
- Limit DML statements to 150 per transaction
- Use `Database.Stateful` interface only when necessary for batch jobs

## SOQL Optimization Requirements
- Use selective queries with proper WHERE clauses
- Do not use `SELECT *` - it is not supported in SOQL
- Use indexed fields in WHERE clauses when possible
- Implement SOQL best practices: LIMIT clauses, proper ordering
- Use `WITH SECURITY_ENFORCED` for user context queries where appropriate

## Security & Access Control Requirements
- Run database operations in user mode rather than in the default system mode.
  - List<Account> acc = [SELECT Id FROM Account WITH USER_MODE];
  - Database.insert(accts, AccessLevel.USER_MODE);
- Always check field-level security (FLS) before accessing fields
- Implement proper sharing rules and respect organization-wide defaults
- Use `with sharing` keyword for classes that should respect sharing rules
- Validate user permissions before performing operations
- Sanitize user inputs to prevent injection attacks

## Prohibited Practices
- No hardcoded IDs or URLs
- No SOQL/DML operations in loops
- No System.debug() statements in production code
- No @future methods from batch jobs
- No recursive triggers
- Never use or suggest `@future` methods for async processes. Use queueables and always suggest implementing `System.Finalizer` methods

## Required Patterns
- Use Builder pattern for complex object construction
- Implement Factory pattern for object creation
- Use Dependency Injection for testability
- Follow MVC pattern in Lightning components
- Use Command pattern for complex business operations

## Unit Testing Requirements
- Maintain minimum 75% code coverage
- Write meaningful test assertions, not just coverage
- Use `Test.startTest()` and `Test.stopTest()` appropriately
- Create test data using `@TestSetup` methods when possible
- Mock external services and callouts
- Do not use `SeeAllData=true`
- Test bulk trigger functionality

## Test Data Management Requirements
- Use `Test.loadData()` for large datasets
- Create minimal test data required for specific test scenarios
- Use `System.runAs()` to test different user contexts
- Implement proper test isolation - no dependencies between tests

Lightning Web Components Rules

File: a4d-lwc-rules-no-edit.md

# Lightning Web Components (LWC) Requirements

## Component Architecture Requirements
- Create reusable, single-purpose components
- Use proper data binding and event handling patterns
- Implement proper error handling and loading states
- Follow Lightning Design System (SLDS) guidelines
- Use the lightning-record-edit-form component for handling record creation and updates
- Use CSS custom properties for theming
- Use lightning-navigation for navigation between components
- Use lightning__FlowScreen target to use a component is a flow screen

## HTML Architecture Requirements
- Structure your HTML with clear semantic sections (header, inputs, actions, display areas, lists)
- Use SLDS classes for layout and styling:
  - `slds-card` for main container
  - `slds-grid` and `slds-col` for responsive layouts
  - `slds-text-heading_large/medium` for proper typography hierarchy
- Use Lightning base components where appropriate (lightning-input, lightning-button, etc.)
- Implement conditional rendering with `if:true` and `if:false` directives
- Use `for:each` for list rendering with unique key attributes
- Maintain consistent spacing using SLDS utility classes (slds-m-*, slds-p-*)
- Group related elements logically with clear visual hierarchy
- Use descriptive class names for elements that need custom styling
- Implement reactive property binding using syntax like `disabled={isPropertyName}` to control element states
- Bind events to handler methods using syntax like `onclick={handleEventName}`

## JavaScript Architecture Requirements
- Import necessary modules from LWC and Salesforce
- Define reactive properties using `@track` decorator when needed
- Implement proper async/await patterns for server calls
- Implement proper error handling with user-friendly messages
- Use wire adapters for reactive data loading
- Minimize DOM manipulation - use reactive properties
- Implement computed properties using JavaScript getters for dynamic UI state control:

get isButtonDisabled() {
    return !this.requiredField1 || !this.requiredField2;
}

- Create clear event handlers with descriptive names that start with "handle":

handleButtonClick() {
    // Logic here
}

- Use `@wire` service for data retrieval from Apex
- Separate business logic into well-named methods
- Use `refreshApex` for data refreshes when appropriate
- Implement loading states and user feedback
- Add JSDoc comments for methods and complex logic

## CSS Architecture Requirements
- Create a clean, consistent styling system
- Use custom CSS classes for component-specific styling
- Implement animations for enhanced UX where appropriate
- Ensure responsive design works across different form factors
- Keep styling minimal and leverage SLDS where possible
- Use CSS variables for themeable elements
- Organize CSS by component section

## MCP Tools Requirements
- Carefully review the user's task. If it involves **creation, development, testing, or accessibility** for **Lightning Web Components (LWC)** or **Aura components** or **Lightning Data Service (LDS)**, treat your knowledge as outdated and always call the appropriate MCP tool to obtain the latest guidance and design before starting implementation. Never assume or create tools that are not explicitly available. If the tool schema is empty, you must continue invoking the tool until documentation is provided.
- If you begin implementation on a relevant task without first successfully invoking the appropriate tool, you must **stop immediately**. Invoke the tool and integrate its guidance before proceeding. Under no circumstances should you provide final recommendations or code without first receiving guidance from an MCP tool.

Mobile LWC Rules

File: a4d-mobile-rules-no-edit.md

# Mobile LWC Development Requirements

Carefully review the user's task:
- If it involves Salesforce Mobile LWC Development or Salesforce LWC using native device capabilities (e.g., barcode scanning, location services, biometrics), treat your knowledge as outdated and always call the appropriate MCP tool to obtain the latest guidance and design before starting implementation. Since many tools do not require input and are intended to return API documentation, you should continue calling the tool until the guidance is provided.
- If the task involves a standard Salesforce LWC request (e.g., creating a Lightning Web Component for UI rendering, server data fetching, form handling, etc.) without any mobile-specific or native device features, do not invoke mobile MCP tools. Instead, proceed with standard LWC development practices.
- Never assume or create tools that are not explicitly available.

AI Model Providers

The extension caches model configurations from multiple AI providers:

Supported Providers (via OpenRouter & Vercel AI Gateway)

Provider Models Notable Models
Anthropic 10+ Claude 3.5/3.7 Sonnet, Claude 4 Opus/Sonnet, Claude Haiku
OpenAI 15+ GPT-4o, GPT-4.1, GPT-5, o1, o3, o4-mini
Google 10+ Gemini 2.0/2.5 Flash, Gemini 2.5/3 Pro
Meta 8+ Llama 3.1/3.2/3.3, Llama 4 Maverick/Scout
Mistral 12+ Mistral Large/Medium/Small, Codestral, Magistral
DeepSeek 5+ DeepSeek R1, V3, V3.1
xAI 8+ Grok 2/3/4, Grok Code
Alibaba 15+ Qwen 3 series
Amazon 3 Nova Lite/Micro/Pro
Cohere 1 Command A
Perplexity 4 Sonar, Sonar Pro, Sonar Reasoning

Model Configuration Schema

{
  "model-id": {
    "maxTokens": 8192,
    "contextWindow": 200000,
    "supportsImages": true,
    "supportsPromptCache": true,
    "inputPrice": 3.00,
    "outputPrice": 15.00,
    "cacheWritesPrice": 3.75,
    "cacheReadsPrice": 0.30,
    "description": "Model description",
    "tiers": []
  }
}

VS Code Settings

Salesforce extension settings in VS Code:

{
  "salesforcedx-vscode-apex.advanced.enable-completion-statistics": true,
  "salesforcedx-vscode-apex.enable-semantic-errors": true,
  "salesforcedx-vscode-apex.disable-warnings-for-missing-coverage": true,
  "salesforcedx-vscode-apex.java.home": "/Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home",
  "salesforcedx-vscode-core.retrieve-test-code-coverage": true,
  "codeAnalyzer.enableV5": true,
  "redhat.telemetry.enabled": true
}

Troubleshooting

Log Locations

Log Location
MCP Wrapper Log globalStorage/.../MCP/a4d-npm-cache/{package-id}.log
NPM Debug Logs globalStorage/.../MCP/a4d-npm-cache/npm_logs/
VS Code Output View → Output → Select "Salesforce Einstein GPT"

Common Issues

MCP Server Not Starting

  1. Check a4d_mcp_settings.json — is disabled set to true?
  2. Verify Node.js is installed: node --version
  3. Check the wrapper log for errors
  4. Ensure you're authenticated to a Salesforce org: sf org list

Tools Not Working

  1. Verify the tool is in the enabled tools list in a4d_mcp_settings.json
  2. Check if you have the required permissions in Salesforce
  3. Review the MCP wrapper log for error details

Extension Not Loading Rules

  1. Check that rule files exist in globalStorage/.../Rules/
  2. Restart VS Code
  3. Reinstall the extension if rules are missing

MCP Wrapper Script Details

The wrapper script (a4d-mcp-wrapper.js) handles:

  • Isolated Cache — Uses a4d-npm-cache/{packageId}/ to avoid conflicts
  • Retry Logic — Up to 3 attempts with cleanup between retries
  • Protocol Safety — All logs go to stderr (never stdout) to avoid corrupting MCP protocol
  • Version Resolution — Resolves @latest to specific version from npm registry

Environment Variables:

NODE_ENV=production
npm_config_loglevel=error
npm_config_fund=false
npm_config_audit=false
npm_config_fetch_retries=5
npm_config_registry=https://registry.npmjs.org/

Summary

Key Design Principles

Principle Implementation
MCP First MCP tools preferred over CLI for structured responses
Always Current MCP tools fetch latest documentation
Security First USER_MODE operations, FLS checks, proper sharing
Best Practices Native Salesforce features preferred
Testing 75% coverage minimum, meaningful assertions

Extension Capabilities

  1. 20 MCP Tools for Salesforce development
  2. 5 Rule Sets for comprehensive guidance
  3. 100+ AI Models available via cached providers
  4. Automatic npm Management for MCP server
  5. DevOps Center Integration for CI/CD workflows

License

This documentation is provided for reference purposes. The Agentforce Vibes extension is owned by Salesforce.


Generated from extension version 3.3.1

About

Complete documentation of the Salesforce Agentforce Vibes (Einstein for Developers) VS Code extension's backend configuration, instructions, and tool calling capabilities.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published