Skip to main content
Glama
boejucci

Salesforce MCP Server (Extended)

by boejucci

salesforce_write_apex

Create or update Apex classes in Salesforce by providing the class name, body, and operation type (create or update).

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?

No annotations are provided, so the description carries full burden. It mentions that className in body must match the parameter and status is returned, but it omits critical behavioral traits such as permissions required, potential overwriting, rate limits, or API version implications. This leaves gaps for an agent.

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 well-structured with examples and bullet-point notes, making it easy to parse. However, the examples are verbose; a more concise summary could suffice, but the structure aids understanding.

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?

There is no output schema, so the description should detail return values. It only says 'Status information is returned', which is vague. Given the tool's complexity (4 parameters, write operation), more context on response format, error handling, or limits would be beneficial.

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 description coverage is 100%, so baseline is 3. The description adds value by showing usage examples, clarifying that apiVersion is optional for create, and noting that className in body must match. This extends beyond the schema.

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 explicitly states 'Create or update Apex classes in Salesforce', using a specific verb and resource. This clearly distinguishes it from sibling tools like salesforce_write_apex_trigger (writes triggers) and salesforce_read_apex (reads).

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 provides examples and notes on required fields (operation, className, body) and optional apiVersion. However, it does not explicitly guide when to use this tool versus alternatives like salesforce_write_apex_trigger or salesforce_read_apex, which would improve clarity.

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

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