salesforce_describe
Retrieve detailed field information and metadata for Salesforce objects to understand data structure and schema relationships.
Instructions
Describe an SObject and return field information
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": {
"args": "<args>"
},
"name": "salesforce_describe"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| args | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fields | Yes | ||
| object_api_name | Yes |
Implementation Reference
- sfmcp/tools/describe.py:31-59 (handler)The main handler function for the 'salesforce_describe' tool. It retrieves the object description using SalesforceClient, processes the fields (including picklist values), and returns a structured DescribeResult.
async def describe_object(args: DescribeArgs) -> DescribeResult: sf = SalesforceClient.from_env() describe_data = await sf.describe_object(args.object_api_name) # Extract field information fields = [] for field_data in describe_data.get("fields", []): # Extract picklist values if present picklist_values = None if ( field_data.get("type") == "picklist" and "picklistValues" in field_data ): picklist_values = [ pv.get("value") for pv in field_data["picklistValues"] if pv.get("active") ] field_info = FieldInfo( name=field_data.get("name", ""), type=field_data.get("type", ""), label=field_data.get("label"), nillable=field_data.get("nillable"), picklistValues=picklist_values, ) fields.append(field_info) return DescribeResult(object_api_name=args.object_api_name, fields=fields) - sfmcp/tools/describe.py:9-24 (schema)Pydantic models defining the input (DescribeArgs), intermediate field info (FieldInfo), and output (DescribeResult) schemas for the tool.
class DescribeArgs(BaseModel): object_api_name: str = Field(..., description="SObject API name, e.g., Account") class FieldInfo(BaseModel): name: str type: str label: str | None = None nillable: bool | None = None picklistValues: List[str] | None = None class DescribeResult(BaseModel): object_api_name: str fields: List[FieldInfo] - sfmcp/server.py:25-25 (registration)Registration of the describe tool module by calling its register function on the FastMCP instance. The import is at line 11: from .tools import describe as tool_describe
tool_describe.register(mcp) - sfmcp/salesforce_client.py:94-111 (helper)Helper method in SalesforceClient that runs the SF CLI command to describe a Salesforce SObject, used by the tool handler.
async def describe_object(self, object_name: str) -> Dict[str, Any]: """Get detailed information about a Salesforce object""" command = [ "sf", "force:schema:sobject:describe", "--target-org", self._org_alias, "-s", object_name, "--json", ] result = await self._run_cli_command(command) if "result" in result: return result["result"] # type: ignore[no-any-return] else: raise Exception("Unexpected response format from Salesforce CLI")