Skip to main content
Glama
semwalajay83-sem

salesforce-metadata-mcp

Create Apex Trigger

sf_create_apex_trigger
Idempotent

Create and deploy an Apex Trigger on any Salesforce object. Specify trigger events and body code; the trigger declaration is auto-generated and deployed via Metadata API.

Instructions

Creates and deploys an Apex Trigger on any Salesforce object. Specify the trigger events (before insert, after update, etc.) and the trigger body code. The trigger declaration (trigger Name on Object (events)) is auto-generated — just provide the code that goes inside the trigger body. Deployed via Metadata API SOAP deploy.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
eventsYesTrigger events, e.g. ['before insert', 'before update']
apiVersionNoAPI version for this trigger66.0
objectNameYesObject API name the trigger fires on, e.g. 'Account'
triggerBodyYesFull trigger body code (the code between the trigger { })
triggerNameYesTrigger name, e.g. 'AccountTrigger'
Behavior4/5

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

The description adds valuable behavioral context beyond annotations: it discloses that deployment happens via Metadata API SOAP deploy, and that the trigger declaration is auto-generated so users only provide the inner body. This helps the agent understand side effects and what code is expected, complementing the idempotentHint and non-destructive annotations.

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 three sentences, each adding distinct value: purpose, user-specified parts (events/body), and key behavior (auto-generated declaration, deployment method). No fluff or repeated schema information, making it concise and well-structured.

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?

With a 5-parameter tool, no output schema, and annotations covering safety, the description provides enough detail for basic usage. It lacks explicit mention of return values or how to handle deployment failures, but given the tool's straightforward create/deploy nature and the presence of sibling tools like sf_check_deploy_status, this is a minor gap.

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%, but the description still adds meaning by clarifying that triggerBody is only the code inside the braces, and by explicitly mentioning the event examples ('before insert, before update'). This prevents ambiguity about how the body parameter relates to the generated wrapper, which the schema alone doesn't convey.

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 clearly states the tool creates and deploys an Apex Trigger on any Salesforce object, with a specific verb ('creates and deploys'), resource ('Apex Trigger'), and scope ('any Salesforce object'). This distinguishes it from sibling tools like sf_create_apex_class or sf_get_apex_trigger.

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 clear context: it explains how to specify events and body code, and that the trigger declaration is auto-generated. It doesn't explicitly name alternatives or exclusions, but the purpose is specific enough to infer when to use this tool for Apex triggers rather than other metadata creation tools.

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