Deploy Salesforce Metadata
salesforce_deploy_metadataUpsert metadata components such as Flows, ApexClasses, and ValidationRules to Salesforce via the SF CLI. Perform a dry-run to validate changes before deployment.
Instructions
Deploy a metadata component (Flow, ApexClass, ValidationRule, etc.) to the Salesforce org via the SF CLI.
Use this to create OR update declarative metadata. Salesforce deploy is upsert-style: if 'api_name' already exists in the org, this overwrites it.
Typical workflow for creating a new Flow:
(Optional) salesforce_retrieve_metadata to pull an existing Flow as a template
Author the Flow XML (...)
Call this tool with check_only=true to validate (dry-run)
Re-run with check_only=false to actually deploy
Supported metadata types: Flow, ApexClass, ApexTrigger, ValidationRule, PermissionSet, Layout, CustomObject
Args:
metadata_type: One of the supported types above.
api_name: Metadata API name, e.g. 'My_New_Flow'. Must match Salesforce naming rules.
xml_content: Full *-meta.xml content. For Flows, a complete document.
body_content: Required for ApexClass (.cls body) and ApexTrigger (.trigger body).
object_name: Required for ValidationRule — parent sObject (e.g. 'Account').
check_only: If true, validate without committing (dry-run). Default: false.
Blocked entirely when SALESFORCE_READONLY=true (including dry-runs). Requires SALESFORCE_SF_CLI_USERNAME and the Salesforce user to have metadata deploy permissions (e.g. 'Customize Application' or 'Modify Metadata Through Metadata API Functions').
Returns: Deploy status with per-component successes and failures (with error messages).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| api_name | Yes | Metadata API name (e.g., My_New_Flow) | |
| check_only | No | Validate only (dry-run). Default: false | |
| object_name | No | Parent sObject API name — required for ValidationRule | |
| xml_content | Yes | Full *-meta.xml content for the component | |
| body_content | No | Body text — required for ApexClass (.cls) and ApexTrigger (.trigger) | |
| metadata_type | Yes | Metadata type. Supported: Flow, ApexClass, ApexTrigger, ValidationRule, PermissionSet, Layout, CustomObject |