Skip to main content
Glama
JereSalguero30

Salesforce MCP Server

salesforce_write_apex_trigger

Create or update Apex triggers in Salesforce by providing the trigger name, object, body, and optional API version.

Instructions

Create or update Apex triggers in Salesforce.

Examples:

  1. Create a new Apex trigger: { "operation": "create", "triggerName": "AccountTrigger", "objectName": "Account", "apiVersion": "58.0", "body": "trigger AccountTrigger on Account (before insert, before update) { /* implementation */ }" }

  2. Update an existing Apex trigger: { "operation": "update", "triggerName": "AccountTrigger", "body": "trigger AccountTrigger on Account (before insert, before update, after update) { /* updated implementation */ }" }

Notes:

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

  • For 'create' operations, triggerName, objectName, and body are required

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

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

  • The body must be valid Apex trigger code

  • The triggerName in the body must match the triggerName parameter

  • The objectName in the body must match the objectName parameter (for 'create')

  • Status information is returned after successful operations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bodyYesFull body of the Apex trigger
operationYesWhether to create a new trigger or update an existing one
apiVersionNoAPI version for the Apex trigger (e.g., '58.0')
objectNameNoName of the Salesforce object the trigger is for (required for 'create')
triggerNameYesName of the Apex trigger to create or update
Behavior3/5

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

With no annotations provided, the description must carry the full burden of behavioral disclosure. It does add useful context: valid API versions, the constraint that triggerName/objectName in the body must match the parameters, and that status information is returned. However, it does not disclose potential side effects of updating an existing trigger (e.g., trigger activation state or impact on running automation) or any permission requirements, which are significant for a mutating tool.

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: a one-sentence purpose statement, two concrete examples, and a bulleted list of caveats. Every section contributes directly to successful invocation, and the content is front-loaded. It is longer than average, but the complexity of a create/update tool with conditional parameters justifies each line.

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?

Given the tool's complexity (two operation modes, five parameters, no output schema), the description covers the essentials: required fields per operation, validation rules, default behavior for apiVersion, and the fact that status is returned. Minor gaps exist around effect on existing trigger state and permission requirements, but overall it is complete enough for an agent to invoke the tool 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%, so the baseline is 3. The description adds meaningful semantics beyond the schema: it clarifies conditional requirements by operation (objectName is only required for create), notes that apiVersion defaults to latest, and provides two full examples showing valid JSON payloads. This exceeds the baseline by giving actionable usage details.

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 opens with a specific verb-resource pair: 'Create or update Apex triggers in Salesforce.' This precisely identifies the operation and resource, and the sibling tools include salesforce_read_apex_trigger and salesforce_write_apex, so it clearly distinguishes an Apex-trigger-specific write tool from read or generic write alternatives.

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 delimits usage by operation: create requires triggerName, objectName, and body; update requires triggerName and body. It also notes that apiVersion is optional and defaults to latest. While it does not explicitly name alternatives or exclusions, the operation-specific requirements and examples provide secure context for when to use each mode.

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