Skip to main content
Glama
tsmztech

Salesforce MCP Server

salesforce_describe_object

Retrieve comprehensive schema metadata for Salesforce objects, including fields, relationships, and properties, to understand data structure and relationships.

Instructions

Get detailed schema metadata including all fields, relationships, and field properties of any Salesforce object. Examples: 'Account' shows all Account fields including custom fields; 'Case' shows all Case fields including relationships to Account, Contact etc.

Input Schema

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

Implementation Reference

  • The handler function that executes the tool: calls conn.describe(objectName), formats the fields info into a text response.
    export async function handleDescribeObject(conn: any, objectName: string) { const describe = await conn.describe(objectName) as SalesforceDescribeResponse; // Format the output const formattedDescription = ` Object: ${describe.name} (${describe.label})${describe.custom ? ' (Custom Object)' : ''} Fields: ${describe.fields.map((field: SalesforceField) => ` - ${field.name} (${field.label}) Type: ${field.type}${field.length ? `, Length: ${field.length}` : ''} Required: ${!field.nillable} ${field.referenceTo && field.referenceTo.length > 0 ? `References: ${field.referenceTo.join(', ')}` : ''} ${field.picklistValues && field.picklistValues.length > 0 ? `Picklist Values: ${field.picklistValues.map((v: { value: string }) => v.value).join(', ')}` : ''}` ).join('\n')}`; return { content: [{ type: "text", text: formattedDescription }], isError: false, }; }
  • Tool schema definition including name, description, and input schema requiring 'objectName'.
    export const DESCRIBE_OBJECT: Tool = { name: "salesforce_describe_object", description: "Get detailed schema metadata including all fields, relationships, and field properties of any Salesforce object. Examples: 'Account' shows all Account fields including custom fields; 'Case' shows all Case fields including relationships to Account, Contact etc.", inputSchema: { type: "object", properties: { objectName: { type: "string", description: "API name of the object (e.g., 'Account', 'Contact', 'Custom_Object__c')" } }, required: ["objectName"] } };
  • src/index.ts:79-83 (registration)
    Server switch case registration that handles calls to 'salesforce_describe_object' by invoking the handler.
    case "salesforce_describe_object": { const { objectName } = args as { objectName: string }; if (!objectName) throw new Error('objectName is required'); return await handleDescribeObject(conn, objectName); }
  • Type definitions for the describe response and fields used in the handler.
    export interface SalesforceDescribeResponse { name: string; label: string; fields: SalesforceField[]; custom: boolean; }
  • src/index.ts:48-48 (registration)
    Inclusion of the tool in the server's listTools response.
    DESCRIBE_OBJECT,

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/tsmztech/mcp-server-salesforce'

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