Skip to main content
Glama
zeluizr

Adobe Commerce MCP

Add an event observer

add-observer
Read-onlyIdempotent

Generates an observer class and events.xml subscription for a specified Adobe Commerce event, returning files to add so your module can react to dispatched events.

Instructions

Generate an observer class and its events.xml subscription (global or per area), adapted from the official events and observers docs. Returns the files for the caller to write. Use it to react to a dispatched event.

Input Schema

NameRequiredDescriptionDefault
areaNoglobal (etc/events.xml, all areas) or one area folder (default global)
eventYesEvent name to observe (e.g. "catalog_product_save_after", "checkout_cart_add_product_complete")
moduleYesModule name as Vendor_Module (e.g. "Acme_Reviews"), as registered in registration.php
basePathNoModule directory relative to the Commerce root (default "app/code/<Vendor>/<Module>")
observerNameNoObserver name in events.xml (unique per event)
observerClassNoObserver class name inside <Module>\Observer (default derived from the event name)

Output Schema

NameRequiredDescriptionDefault
filesYesFiles to write. The server never writes to disk.
notesYesNext steps and caveats

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false. The description adds meaningful context beyond them: it produces files and returns them "for the caller to write," so the agent knows no disk mutation occurs here, and notes the output is adapted from official docs.

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?

Three short sentences, front-loaded with what is generated, followed by the return behavior and the use case. No redundant phrasing.

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?

An output schema exists and the description correctly notes it returns files for the caller to write, so return values need no elaboration. The one gap is that it doesn't clarify the relationship to plugin-based interception or when an observer is preferable.

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 description coverage is 100%, so the enum for area, the module format, and observer naming are fully documented in the schema. The description only echoes the global/per-area distinction, meeting the baseline rather than adding syntax or format detail.

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 uses a specific verb-plus-resource: "Generate an observer class and its events.xml subscription (global or per area)." It distinguishes itself from siblings like add-plugin and add-controller by naming exactly what artifacts are produced.

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?

"Use it to react to a dispatched event" gives a when-to-use condition, but the description doesn't contrast this tool with alternatives such as add-plugin for intercepting behavior or add-controller for routing. Implied usage, no exclusions.

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