Skip to main content
Glama

salesforce_describe_object

Retrieve comprehensive schema metadata for any Salesforce object, including fields, relationships, and properties. Use this tool to explore object details like custom fields and associations in Salesforce.

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 Salesforce describeGlobal operation, formatting the object metadata into a readable 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, }; }
  • The tool schema defining name, description, and input parameters (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:61-65 (registration)
    Registration in the tool call handler switch statement that invokes the handleDescribeObject function.
    case "salesforce_describe_object": { const { objectName } = args as { objectName: string }; if (!objectName) throw new Error('objectName is required'); return await handleDescribeObject(conn, objectName); }
  • src/index.ts:35-45 (registration)
    Registration in the listTools handler where DESCRIBE_OBJECT is included in the available tools list.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ SEARCH_OBJECTS, DESCRIBE_OBJECT, QUERY_RECORDS, DML_RECORDS, MANAGE_OBJECT, MANAGE_FIELD, SEARCH_ALL ], }));

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

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