Skip to main content
Glama
simonl77

Salesforce MCP Server

by simonl77

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 handler function that performs the core logic: calls conn.describe(objectName), formats the object metadata including fields, types, requirements, references, and picklist values into a structured 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 definition including 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:79-83 (registration)
    Registration in the tool dispatch switch statement: validates input and calls the handler 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:45-63 (registration)
    Registration of the tool in the listTools handler, including DESCRIBE_OBJECT in the exported tools list.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [
        SEARCH_OBJECTS, 
        DESCRIBE_OBJECT, 
        QUERY_RECORDS, 
        AGGREGATE_QUERY,
        DML_RECORDS,
        MANAGE_OBJECT,
        MANAGE_FIELD,
        MANAGE_FIELD_PERMISSIONS,
        SEARCH_ALL,
        READ_APEX,
        WRITE_APEX,
        READ_APEX_TRIGGER,
        WRITE_APEX_TRIGGER,
        EXECUTE_ANONYMOUS,
        MANAGE_DEBUG_LOGS
      ],
    }));
Behavior3/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. It discloses that the tool retrieves metadata (a read operation) and specifies the types of metadata included (fields, relationships, properties). However, it lacks details on behavioral traits such as permissions required, rate limits, error handling, or whether it returns all metadata at once or supports pagination.

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 usage without redundancy. Every sentence earns its place by adding clarity or context, and there is no wasted verbiage.

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 moderate complexity (single parameter, no output schema, no annotations), the description is adequate but has gaps. It explains what metadata is retrieved but does not cover the return format, error cases, or dependencies. For a metadata tool without annotations or output schema, more detail on behavioral aspects 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, with the parameter 'objectName' clearly documented. The description adds value by providing examples ('Account', 'Case') and clarifying that it includes custom fields and relationships, which enhances understanding beyond the schema's technical definition. This meets the baseline for high schema 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 specific action ('Get detailed schema metadata') and resource ('any Salesforce object'), with concrete examples ('Account', 'Case') that illustrate the scope. It distinguishes this from sibling tools by focusing on object schema metadata rather than querying, DML, or code management operations.

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 context through examples (e.g., 'Account' shows all Account fields) and mentions what metadata is included (fields, relationships, field properties). However, it does not explicitly state when to use this tool versus alternatives like 'salesforce_search_objects' or 'salesforce_query_records', which could provide overlapping or related functionality.

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

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