Skip to main content
Glama
aaron-pienza

Salesforce MCP Server

by aaron-pienza

salesforce_write_apex

Create or update Apex classes in Salesforce by specifying operation, class name, and body.

Instructions

Create or update Apex classes in Salesforce.

Examples:

  1. Create a new Apex class: { "operation": "create", "className": "AccountService", "apiVersion": "58.0", "body": "public class AccountService { public static void updateAccounts() { /* implementation */ } }" }

  2. Update an existing Apex class: { "operation": "update", "className": "AccountService", "body": "public class AccountService { public static void updateAccounts() { /* updated implementation */ } }" }

Notes:

  • The operation must be either 'create' or 'update'

  • For 'create' operations, className and body are required

  • For 'update' operations, className and body are required

  • apiVersion is optional for 'create' (defaults to the latest version)

  • The body must be valid Apex code

  • The className in the body must match the className parameter

  • Status information is returned after successful operations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
operationYesWhether to create a new class or update an existing one
classNameYesName of the Apex class to create or update
apiVersionNoAPI version for the Apex class (e.g., '58.0')
bodyYesFull body of the Apex class
Behavior3/5

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

Discloses that operation requires valid Apex code and className must match body, and status information is returned. However, with no annotations, it should also cover authentication needs, rate limits, or error handling. Missing details on side effects like overwriting existing classes.

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?

Well-structured with sections for description, examples, and notes. Front-loaded with purpose. Slightly lengthy due to examples but every sentence adds value. Could be slightly more concise.

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?

Input schema is rich with 100% coverage. Description addresses key constraints and return status. Missing output schema details, but overall complete for a complex tool with 4 params. Could elaborate on error scenarios.

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%, so baseline 3. Description adds significant value by explaining required vs optional, defaults (apiVersion defaults to latest), and constraints (className match). Examples further clarify parameter usage.

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?

Clearly states 'Create or update Apex classes in Salesforce' with specific verb+resource. Distinguishes from siblings like salesforce_read_apex and salesforce_write_apex_trigger by focusing on Apex classes and providing examples.

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?

Implies usage via create/update operations but lacks explicit guidance on when to choose this tool over alternatives (e.g., for triggers vs classes). No exclusion statements or context for selecting this among siblings.

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

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