Skip to main content
Glama

get_object_fields

Retrieve field names, labels, and types for any Salesforce object by specifying the object name, simplifying metadata access for Salesforce integrations.

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 implementation in SalesforceClient: retrieves, filters, caches, and returns JSON of object fields using Salesforce describe() API.
    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(): defines name, description, and input schema for 'get_object_fields'.
    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"], }, ),
  • MCP @server.call_tool() handler: dispatches 'get_object_fields' tool calls to SalesforceClient method 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}", ) ]

Other Tools

Related 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/leilaabdel/MCP-Salesforce'

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