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, 
Behavior3/5

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

With no annotations provided, the description carries full burden. It discloses the tool's behavior as a metadata retrieval operation ('Get detailed schema metadata'), which implies it's read-only and non-destructive. However, it lacks details on permissions required, rate limits, error handling, or output format, leaving gaps for a tool with no annotation coverage.

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. Both sentences earn their place by clarifying scope and usage without redundancy, making it efficient and well-structured.

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 no annotations and no output schema, the description adequately covers the tool's purpose and basic usage. However, for a metadata retrieval tool with potential complexity in output (e.g., nested field properties), it lacks details on what the return data includes, error cases, or authentication needs, leaving room for improvement in 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?

Schema description coverage is 100%, so the input schema already documents the 'objectName' parameter fully. The description adds minimal value by providing examples ('Account', 'Case') that reinforce the schema's guidance, but doesn't explain parameter semantics beyond what's in the schema, aligning with the baseline for high coverage.

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 verb ('Get detailed schema metadata') and resource ('any Salesforce object'), specifying what the tool does. It distinguishes from siblings by focusing on schema metadata rather than querying, DML operations, or code management, and provides concrete examples ('Account', 'Case') to illustrate scope.

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 retrieving object schema details, with examples suggesting it's for exploring field and relationship structures. However, it doesn't explicitly state when to use this tool versus alternatives like 'salesforce_search_objects' or 'salesforce_query_records', nor does it mention prerequisites or exclusions.

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

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