Skip to main content
Glama
tsmztech

Salesforce MCP Server

by tsmztech

salesforce_read_apex

Read-only

Retrieve Apex class source code and metadata from Salesforce by exact name or wildcard pattern. Includes class body, API version, length, and last modified date.

Instructions

Read Apex classes from Salesforce.

Examples:

  1. Read a specific Apex class by name: { "className": "AccountController" }

  2. List all Apex classes with an optional name pattern: { "namePattern": "Controller" }

  3. Get metadata about Apex classes: { "includeMetadata": true, "namePattern": "Trigger" }

  4. Use wildcards in name patterns: { "namePattern": "AccountCont" }

Notes:

  • When className is provided, the full body of that specific class is returned

  • When namePattern is provided, all matching class names are returned (without body)

  • Use includeMetadata to get additional information like API version, length, and last modified date

  • If neither className nor namePattern is provided, all Apex class names will be listed

  • Wildcards are supported in namePattern: * (matches any characters) and ? (matches a single character)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
classNameNoName of a specific Apex class to read
namePatternNoPattern to match Apex class names (supports wildcards * and ?)
includeMetadataNoWhether to include metadata about the Apex classes
Behavior5/5

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

The description goes well beyond the readOnlyHint annotation by explaining exactly what is returned in each mode: full body with className, only names with namePattern, and additional metadata with includeMetadata. It also discloses the default behavior when neither parameter is provided and documents wildcard support, providing rich behavioral context.

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

Conciseness3/5

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

The description is front-loaded with a clear summary but then expands into 4 examples and 5 notes. While each point adds information, the length is excessive for a 3-parameter read tool. Some examples are redundant (e.g., example 3 is similar to example 2 with metadata), making it less concise than it could be.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a read tool with no output schema, the description covers the main return behaviors (full body, names, metadata) and default listing. It is missing edge-case context like conflicting parameters or not-found behavior, but given the tool's simplicity and the presence of annotations, it is mostly complete.

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

Parameters4/5

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

Schema descriptions are present for all parameters (100% coverage), so baseline is 3. The description adds value by showing concrete examples of valid input combinations, clarifying the effect of includeMetadata, and explaining wildcards in namePattern. However, it does not describe the behavior when both className and namePattern are provided, which is a slight gap.

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 clearly states 'Read Apex classes from Salesforce' and provides examples of reading a specific class, listing classes by pattern, and fetching metadata. It distinguishes from write operations and from other read tools by focusing on Apex classes, though it doesn't explicitly differentiate from the sibling salesforce_read_apex_trigger.

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?

The examples and notes imply when to use each parameter (className for full body, namePattern for listing, includeMetadata for metadata), but there is no explicit guidance on when to choose this tool over alternatives like read_apex_trigger or describe_object. Usage is implied rather than explicitly stated.

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