Skip to main content
Glama
advancedcommunities

Salesforce MCP Server

generate_trigger

Destructive

Creates an Apex trigger file and its metadata for a Salesforce object, with options for name, sObject, event, and output directory.

Instructions

Generates the Apex trigger *.trigger file and associated metadata file. These files must be contained in a parent directory called "triggers" in your package directory. Either run this command from an existing directory of this name, or use the --output-dir flag to generate one or point to an existing one. If you don't specify the --sobject flag, the .trigger file contains the generic placeholder SOBJECT; replace it with the Salesforce object you want to generate a trigger for. If you don't specify --event, "before insert" is used.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.7.0

TDQS

B3.2/5.0
Behavior2/5

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

Annotations declare destructiveHint=true and idempotentHint=false, yet the description never addresses whether existing files are overwritten or how conflicts are handled — the single most important behavior for a generator with those hints. It explains file placement but not the destructive/irreversible implications.

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?

Four sentences, each earning its place about file location, defaults, and placeholder behavior. Front-loaded with the generation action and reasonably free of padding.

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?

For a file-generating tool with no output schema and nested params, the description covers location and default behavior but omits overwrite semantics, return value, and the mismatch around the nonexistent --event flag. Annotations already flag destructiveness but the description should confirm it.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is reported at 0% for the top-level 'input' object, so the description must carry meaning, and it does map '--output-dir' to outputDir and '--sobject' to sObjectName. But it references a '--event' flag with a 'before insert' default that does not exist as a parameter in the schema, which is misleading.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: 'Generates the Apex trigger *.trigger file and associated metadata file.' It's clearly distinguishable in content from a generic action, but it never differentiates itself from the closely related siblings generate_class and generate_component, all of which produce source files.

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?

It gives contextual instructions about where files must live ('a parent directory called triggers') and how to use --output-dir, which is genuinely useful usage guidance. However, it offers no when-to-use/when-not guidance relative to generate_class/generate_component and no prerequisites such as org auth.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.