Skip to main content
Glama
zeluizr

Adobe Commerce MCP

Add a plugin (interceptor)

add-plugin
Read-onlyIdempotent

Generates before, after, or around plugin classes and di.xml declarations to modify core or third-party method behavior without rewriting the class.

Instructions

Generate a before, after or around plugin class and its di.xml declaration for a public method of a class or interface, adapted from the official plugins docs. Returns the files for the caller to write. Use it to change the behavior of a core or third-party method without rewriting the class.

Input Schema

NameRequiredDescriptionDefault
areaNodi.xml area: global (etc/di.xml) or an area folder (default global)
typeYesPlugin type. The docs advise after over around unless the chain must be stopped.
methodYesPublic method to intercept (e.g. "getName", "save")
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>")
sortOrderNosortOrder attribute in di.xml
pluginNameNoPlugin name in di.xml (default "<vendor>_<module>_<target>_<method>")
pluginClassNoPlugin class name inside <Module>\Plugin (default "<TargetShortName>Plugin")
targetClassYesClass or interface whose public method is intercepted (e.g. "Magento\Catalog\Model\Product")

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.2/5.0
Behavior4/5

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

The line 'Returns the files for the caller to write' is genuinely valuable: it explains why readOnlyHint=true is consistent with a scaffolding tool and tells the agent it must perform the write itself. What remains unstated is what happens when a target file already exists, whether directories are created, and what error conditions look like.

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?

Two sentences with zero padding; the artifact produced is front-loaded and the caller's responsibility (writing the files) follows immediately. Nothing is repeated from the schema.

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 an output schema present and full parameter documentation, the description needn't explain return values, and the 'returns files for the caller to write' note covers the key contract gap. Minor omissions: no mention of overwrite/conflict behavior for a generator that may target existing plugin files.

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% and every parameter (area, type, method, module, basePath, pluginName, pluginClass, sortOrder, targetClass) is documented with defaults and examples in the schema itself. The description only restates the before/after/around enum and the 'public method' constraint, adding no syntax or default guidance beyond the structured fields. Baseline 3 applies.

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?

States a concrete verb and artifact: 'Generate a before, after or around plugin class and its di.xml declaration' for a public method of a class or interface. That resource is clearly distinct from the sibling scaffolders (add-observer, add-controller, add-db-schema), so an agent can pick it without opening the schema.

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?

'Use it to change the behavior of a core or third-party method without rewriting the class' gives a clear positive condition for selection, and the 'without rewriting the class' clause implicitly contrasts it with a class rewrite. It stops short of naming when not to use it (e.g., event-driven changes should go to add-observer instead) or any prerequisite such as the module already existing.

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