Retrieve Salesforce Metadata
salesforce_retrieve_metadataRetrieve a Salesforce metadata component (e.g., Flow, ApexClass) as XML for inspection or reference before redeployment.
Instructions
Retrieve a metadata component (Flow, ApexClass, ValidationRule, etc.) from the Salesforce org as XML via SF CLI.
Use this to:
Inspect an existing Flow's XML as a reference before authoring a new one
Fetch a component, modify the XML, then redeploy via salesforce_deploy_metadata
Supported metadata types: Flow, ApexClass, ApexTrigger, ValidationRule, PermissionSet, Layout, CustomObject
Args:
metadata_type: The type of metadata to retrieve
api_name: Metadata API name
object_name: Required for ValidationRule (parent sObject)
Requires SALESFORCE_SF_CLI_USERNAME. This tool is read-only — allowed even under SALESFORCE_READONLY.
Returns: The raw *-meta.xml content (and .cls/.trigger body for Apex).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"metadata_type": "<metadata_type>",
"api_name": "<api_name>"
},
"name": "salesforce_retrieve_metadata"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| api_name | Yes | Metadata API name | |
| object_name | No | Parent sObject API name — required for ValidationRule | |
| metadata_type | Yes | Metadata type. Supported: Flow, ApexClass, ApexTrigger, ValidationRule, PermissionSet, Layout, CustomObject |