Skip to main content
Glama

salesforce_describe_object

Retrieve comprehensive schema metadata for any Salesforce object, 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 main handler function that performs the Salesforce object description by calling conn.describe(), processing the metadata, and formatting it into a human-readable text output including fields, types, requirements, references, and picklist values.
    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 definition object specifying the name, description, and input schema (requiring 'objectName' string) for the salesforce_describe_object tool.
    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:35-45 (registration)
    Registers the DESCRIBE_OBJECT (salesforce_describe_object) in the list of available tools returned by listTools request handler.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [
        SEARCH_OBJECTS, 
        DESCRIBE_OBJECT, 
        QUERY_RECORDS, 
        DML_RECORDS,
        MANAGE_OBJECT,
        MANAGE_FIELD,
        SEARCH_ALL
      ],
    }));
  • src/index.ts:61-65 (registration)
    Dispatch switch case in callTool request handler that validates input arguments and invokes the handleDescribeObject function for salesforce_describe_object.
    case "salesforce_describe_object": {
      const { objectName } = args as { objectName: string };
      if (!objectName) throw new Error('objectName is required');
      return await handleDescribeObject(conn, objectName);
    }
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses that the tool retrieves metadata (not data) and includes examples of what information is returned (fields, relationships, properties). However, it lacks details on permissions required, rate limits, error conditions, or the structure/format of the returned metadata, which are important for a tool with no output schema.

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 front-loaded with the core purpose in the first sentence, followed by illustrative examples that reinforce understanding without redundancy. Both sentences earn their place by enhancing clarity and usability, with no wasted words.

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?

For a tool with no annotations and no output schema, the description adequately covers the purpose and basic usage but lacks sufficient behavioral context (e.g., authentication needs, response format, error handling). Given the complexity of Salesforce metadata and the absence of structured output documentation, more detail would improve completeness.

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, clearly documenting the single required parameter 'objectName'. The description adds value by providing examples ('Account', 'Case', 'Custom_Object__c') that clarify valid inputs beyond the schema's generic description, but does not explain parameter behavior or constraints further.

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

Purpose5/5

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

The description clearly states the specific action ('Get detailed schema metadata') and resource ('any Salesforce object'), with concrete examples ('Account', 'Case') that illustrate the scope. It distinguishes this read-only metadata tool from sibling tools that perform DML operations, manage objects/fields, or query/search records.

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

Usage Guidelines4/5

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

The description implies usage for obtaining schema metadata, which differentiates it from data-oriented siblings like salesforce_query_records or salesforce_dml_records. However, it does not explicitly state when to use this tool versus alternatives like salesforce_search_objects or provide exclusions (e.g., not for data retrieval).

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

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