Skip to main content
Glama
salesforce-mcp

salesforce-mcp

by uoparaji

salesforce_get_metadata_component

Fetches a single Salesforce metadata component by type and record ID through the Tooling API, returning full source or body for Apex classes, triggers, pages, and similar assets.

Instructions

Retrieve a single metadata component by type and full name using the Tooling API. Useful for getting the full body/source of an Apex class, trigger, page, etc.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "type": "<type>",
      "recordId": "<recordId>"
    },
    "name": "salesforce_get_metadata_component"
  }
}

Input Schema

NameRequiredDescriptionDefault
typeYesThe Tooling API sObject type (e.g. ApexClass, ApexTrigger, ApexPage, AuraDefinitionBundle)
recordIdYesThe 15 or 18 character record ID

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.2/5.0
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 behavioral burden. It discloses that this uses the Tooling API and retrieves source/body content, which implies a read-only operation. It does not cover permissions, error behavior for unsupported types, size limitations, or the exact return shape.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two concise sentences with the core action front-loaded. The trailing 'etc.' is slightly vague, but there is no wasted prose.

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 simple two-parameter read tool, the description gives enough purpose and usage context to support selection. But with no output schema, it should clarify the returned metadata record and reconcile the 'full name' wording with the required recordId parameter.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the schema documents both parameters. But the description says 'by type and full name', while the required parameter is recordId (a 15- or 18-character ID). This is a misleading conflict rather than added clarity.

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

Purpose4/5

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

The description uses a specific verb and resource: retrieve a single metadata component via the Tooling API. It also gives examples like Apex class, trigger, and page, which helps distinguish it from generic record tools. However, it says retrieval is by 'type and full name' while the required schema field is recordId, creating a mismatch.

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

Usage Guidelines3/5

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

It states a useful context: getting the full body/source of an Apex class, trigger, or page. It does not explain when to use this instead of siblings like salesforce_get_record, salesforce_describe_tooling_object, or salesforce_tooling_query, nor does it state any exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.