Skip to main content
Glama
usama-dtc

Salesforce MCP Server

by usama-dtc

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 main handler function that executes the Salesforce describe operation, fetches metadata, and formats the output as text.
    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 with name, description, and input schema for validating the objectName parameter.
    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:37-47 (registration)
    The tool is registered in the listTools response by including DESCRIBE_OBJECT in the tools array.
      tools: [
        SEARCH_OBJECTS, 
        DESCRIBE_OBJECT, 
        QUERY_RECORDS, 
        DML_RECORDS,
        MANAGE_OBJECT,
        MANAGE_FIELD,
        SEARCH_ALL,
        UPLOAD_REPORT_XML  // Add new tool to the list
      ],
    }));
  • src/index.ts:63-67 (registration)
    The tool name is matched in the switch statement and dispatches to 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);
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It describes what the tool does (get metadata) but lacks details on behavioral traits such as whether it requires authentication, has rate limits, returns paginated results, or handles errors. For a tool with no annotation coverage, this is a significant gap in transparency.

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 appropriately sized and front-loaded, with the first sentence stating the core purpose and the second providing illustrative examples. Every sentence earns its place by clarifying usage without unnecessary details, making it efficient and easy to understand.

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 the tool's complexity (metadata retrieval) and the absence of annotations and output schema, the description is adequate but incomplete. It covers the purpose and usage with examples, but lacks details on behavioral aspects and return values, which are important for a tool that likely returns structured metadata. A minimum viable description is provided, but gaps remain.

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, with the single parameter 'objectName' well-documented in the schema. The description adds minimal value beyond the schema by providing examples ('Account', 'Case', 'Custom_Object__c'), but does not elaborate on parameter semantics like format constraints or usage nuances. Baseline 3 is appropriate as the schema does the heavy lifting.

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 verb ('Get detailed schema metadata') and resource ('any Salesforce object'), with concrete examples ('Account', 'Case') that illustrate what the tool retrieves. It distinguishes itself from sibling tools like salesforce_query_records or salesforce_search_objects by focusing on schema metadata rather than data records or object searches.

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 provides clear context for when to use this tool: to obtain schema metadata including fields, relationships, and properties. It implies usage through examples like 'Account' and 'Case', but does not explicitly state when not to use it or name specific alternatives among the sibling tools, such as salesforce_search_objects for finding objects rather than describing them.

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/usama-dtc/salesforce_mcp'

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