Skip to main content
Glama
ampcome-mcps

MCP Salesforce Connector

by ampcome-mcps

get_object_fields

Retrieve field names, labels, and data types for any Salesforce object to understand its structure and enable accurate data operations.

Instructions

Retrieves field Names, labels and types for a specific Salesforce object

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
object_nameYesThe name of the Salesforce object (e.g., 'Account', 'Contact')

Implementation Reference

  • Core handler function in SalesforceClient that fetches object fields using describe(), filters relevant info (label, name, updateable, type, length, picklistValues), caches results, and returns formatted JSON.
    def get_object_fields(self, object_name: str) -> str:
        """Retrieves field Names, labels and typesfor a specific Salesforce object.
    
        Args:
            object_name (str): The name of the Salesforce object.
    
        Returns:
            str: JSON representation of the object fields.
        """
        if not self.sf:
            raise ValueError("Salesforce connection not established.")
        if object_name not in self.sobjects_cache:
            sf_object = getattr(self.sf, object_name)
            fields = sf_object.describe()['fields']
            filtered_fields = []
            for field in fields:
                filtered_fields.append({
                    'label': field['label'],
                    'name': field['name'],
                    'updateable': field['updateable'],
                    'type': field['type'],
                    'length': field['length'],
                    'picklistValues': field['picklistValues']
                })
            self.sobjects_cache[object_name] = filtered_fields
            
        return json.dumps(self.sobjects_cache[object_name], indent=2)
  • Tool registration in list_tools() defining name, description, and input schema.
    types.Tool(
        name="get_object_fields",
        description="Retrieves field Names, labels and types for a specific Salesforce object",
        inputSchema={
            "type": "object",
            "properties": {
                "object_name": {
                    "type": "string",
                    "description": "The name of the Salesforce object (e.g., 'Account', 'Contact')",
                },
            },
            "required": ["object_name"],
        },
    ),
  • JSON Schema for tool input validation: requires 'object_name' string.
    inputSchema={
        "type": "object",
        "properties": {
            "object_name": {
                "type": "string",
                "description": "The name of the Salesforce object (e.g., 'Account', 'Contact')",
            },
        },
        "required": ["object_name"],
    },
  • MCP server tool dispatcher handler that extracts arguments, calls the core get_object_fields, and formats response as TextContent.
    elif name == "get_object_fields":
        object_name = arguments.get("object_name")
        if not object_name:
            raise ValueError("Missing 'object_name' argument")
        if not sf_client.sf:
            raise ValueError("Salesforce connection not established.")
        results = sf_client.get_object_fields(object_name)
        return [
            types.TextContent(
                type="text",
                text=f"{object_name} Metadata (JSON):\n{results}",
            )
        ]
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool 'Retrieves' data, implying a read-only operation, but doesn't clarify if it's safe (non-destructive), has rate limits, requires authentication, or what the output format looks like (e.g., JSON structure). For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior and constraints.

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 that front-loads the key action and resource. It wastes no words, avoids redundancy, and is appropriately sized for a simple tool with one parameter. Every part of the sentence contributes to understanding the tool's purpose.

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 low complexity (1 parameter, no output schema, no annotations), the description is minimally adequate but incomplete. It covers the basic purpose but lacks usage guidelines, behavioral details, and output information, which are important for an agent to use it effectively. With no output schema, the description should ideally hint at the return format, but it doesn't, leaving gaps in contextual understanding.

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

Parameters3/5

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

The input schema has 100% description coverage, with the single parameter 'object_name' well-documented in the schema itself. The description adds no additional parameter details beyond what's in the schema (e.g., examples beyond 'Account' or 'Contact', or handling of custom objects). Since the schema does the heavy lifting, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

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 action ('Retrieves') and the resource ('field Names, labels and types for a specific Salesforce object'), making the purpose immediately understandable. It distinguishes itself from siblings like get_record (which retrieves data records) or run_soql_query (which queries data) by focusing on metadata about object fields. However, it could be slightly more specific about what 'field Names, labels and types' entails (e.g., metadata vs. actual data).

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. It doesn't mention prerequisites (e.g., needing object permissions), compare it to similar tools like tooling_execute (which might also retrieve metadata), or specify use cases (e.g., for building dynamic forms or validating field names). Without this, an agent might struggle to choose it appropriately among siblings.

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/ampcome-mcps/salesforce-mcp'

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