Skip to main content
Glama
JereSalguero30

Salesforce MCP Server

salesforce_write_apex

Create or update Apex classes in Salesforce. Specify operation, class name, and code body to deploy Apex logic.

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
bodyYesFull body of the Apex class
classNameYesName of the Apex class to create or update
operationYesWhether to create a new class or update an existing one
apiVersionNoAPI version for the Apex class (e.g., '58.0')
Behavior4/5

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

With no annotations, the description carries the full burden. It discloses key behaviors: operation restrictions, required fields, apiVersion default, body validity, className matching, and return of status info. This is substantial transparency, though it could also mention side effects like overwriting existing classes or permission requirements.

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 well-structured with a clear opening line, two illustrative examples, and concise notes. Every sentence provides useful information without redundancy. The length is appropriate for a tool with two operation modes and multiple validation rules.

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?

The description covers the core functionality, examples, validation rules, and return status. While no output schema exists, the description adequately describes what the tool returns. It could be more complete by addressing error cases or authentication, but for a create/update tool with this complexity, it is sufficiently 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 coverage is 100%, so the baseline is 3. The description adds value beyond the schema by providing concrete examples, clarifying that apiVersion is optional and defaults to the latest, and highlighting the constraint that className in the body must match the className parameter. This extra context justifies a 4.

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 starts with a specific verb+resource: 'Create or update Apex classes in Salesforce.' This clearly distinguishes from siblings like salesforce_read_apex (read) and salesforce_write_apex_trigger (triggers).

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 clearly implies when to use the tool: when creating or updating Apex classes. It provides operation-specific guidance (create vs update) and notes about required/optional parameters. However, it does not explicitly mention alternatives or when not to use this tool, which prevents a 5.

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

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