Skip to main content
Glama

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
argsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
fieldsYes
object_api_nameYes

Implementation Reference

  • 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)
  • 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)
  • 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")
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool returns field information, which implies a read-only operation, but doesn't clarify permissions, rate limits, error handling, or what 'Describe' entails beyond the output. For a tool with zero annotation coverage, this is inadequate, scoring 2.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's front-loaded with the core action and outcome, making it easy to parse. Every word earns its place, scoring 5.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (describing Salesforce objects), the description is minimal but functional. The presence of an output schema reduces the need to explain return values in the description. However, with no annotations and low parameter coverage, it lacks details on usage and behavior, making it barely adequate, scoring 3.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 1 parameter with 0% description coverage, meaning the parameter 'args' is undocumented in the schema. The description adds no information about parameters, such as what 'args' should contain or how to specify the SObject. It fails to compensate for the low schema coverage, scoring 2.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Describe') and resource ('an SObject'), specifying what the tool does. It distinguishes from sibling tools like 'salesforce_list_objects' (which lists objects) and 'salesforce_query' (which queries data) by focusing on metadata/field information. However, it doesn't explicitly mention the sibling differentiation, keeping it at 4 rather than 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'salesforce_list_objects' or 'salesforce_query'. It doesn't specify prerequisites, context, or exclusions, leaving the agent to infer usage based on tool names alone. This is minimal guidance, scoring 2.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mattmahowald/sfmcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server