Skip to main content
Glama
semwalajay83-sem

salesforce-metadata-mcp

Get Apex Class Source

sf_get_apex_class
Read-onlyIdempotent

Retrieve the full source code of an Apex class by name via the Tooling API. Use to inspect current logic before modifying or debugging, returning the class body, API version, and status.

Instructions

Retrieves the full source code of an existing Apex class by exact name, via the Tooling API. Use before modifying a class (to see current logic), when debugging, or when a user asks "show me the X class" / "what does this class do". Returns the class body, API version, and status. Not to be confused with sf_create_apex_class, which deploys new or updated code — this tool only reads.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
classNameYesApex class name to retrieve
Behavior4/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false. The description adds context by specifying return contents ('class body, API version, and status') and the exact-name matching behavior, which is useful beyond the structured annotations. No contradictions.

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 two sentences, front-loaded with the core purpose, then usage context, then a contrasting sibling reference. Every sentence earns its place without redundancy.

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

Completeness5/5

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

Given the tool's simplicity (one parameter, read-only, no output schema), the description covers what it does, when to use it, and what it returns. It is fully sufficient for an agent to select and invoke it correctly.

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 coverage is 100% for the single parameter, but the description adds semantics: 'exact name' and 'existing Apex class' clarify required matching and preconditions. This enhances the schema's minimal 'Apex class name to retrieve'.

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 states a specific verb ('Retrieves') and resource ('full source code of an existing Apex class by exact name, via the Tooling API'), and explicitly differentiates from sibling sf_create_apex_class, which writes/deploys code. This leaves no ambiguity about the tool's function.

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

Usage Guidelines5/5

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

The description provides explicit use cases: 'Use before modifying a class (to see current logic), when debugging, or when a user asks...' and names the alternative tool to avoid confusion. It clearly states this tool only reads, making the usage context unmistakable.

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/semwalajay83-sem/salesforce-metadata-mcp'

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