Skip to main content
Glama

promotions_enable_rule

Enable a cart price rule by passing action parameters in JSON format. Manage promotions directly.

Instructions

Enable a cart price rule.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsNoAction parameters as a JSON object

Implementation Reference

  • The handler function for 'promotions.enable_rule' tool. Validates input via EnableRuleSchema, requires confirmation (risk tier), then calls Magento PUT /V1/salesRules/:rule_id with is_active: true.
    // ── Enable Rule ───────────────────────────────────────────────────────
    {
      name: 'promotions.enable_rule',
      description: 'Enable a cart price rule.',
      riskTier: RiskTier.Risk,
      requiresAuth: true,
      handler: async (params: Record<string, unknown>, context: ActionContext) => {
        const validated = EnableRuleSchema.parse(params);
        guardrails.requireConfirmation(RiskTier.Risk, params);
    
        const client = context.getClient();
        const result = await client.put(`/V1/salesRules/${validated.rule_id}`, {
          rule: { rule_id: validated.rule_id, is_active: true },
        });
        return { message: 'Rule enabled successfully', rule: result };
      },
    },
  • EnableRuleSchema: Zod schema defining input fields (rule_id as number, confirm literal true, reason string min 1) for enabling a rule.
    export const EnableRuleSchema = z.object({
      rule_id: z.number().int(),
      confirm: z.literal(true),
      reason: z.string().min(1),
    });
  • src/index.ts:76-80 (registration)
    Registration: Action name 'promotions.enable_rule' is converted to 'promotions_enable_rule' (dots to underscores) and registered as an MCP tool via mcpServer.tool().
    for (const action of allActions) {
      // Convert dots to underscores for MCP tool names (e.g. "auth.login" -> "auth_login")
      const toolName = action.name.replace(/\./g, '_');
    
      mcpServer.tool(
  • src/index.ts:51-61 (registration)
    The action is collected into allActions array via createPromotionsActions(planStore, guardrails, config) at line 54.
    const allActions: ActionDefinition[] = [
      ...createAuthActions(sessionStore),
      ...createScopeActions(sessionStore),
      ...createPromotionsActions(planStore, guardrails, config),
      ...createCatalogActions(planStore, guardrails, idempotencyLedger, config),
      ...createPricingActions(planStore, guardrails, idempotencyLedger, config),
      ...createCmsActions(planStore, guardrails, config),
      ...createSeoActions(planStore, guardrails, config),
      ...createDiagnosticsActions(),
      ...createCacheActions(guardrails, config),
    ];
Behavior1/5

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

No annotations provided, and the description only says 'enable' without disclosing effects, required permissions, idempotency, or state changes. The tool could modify system state, but no details are given.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Extremely concise (one sentence), but at the expense of completeness. It does state the purpose, but lacks crucial details, making it under-specified.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description fails to provide sufficient context for an agent to correctly invoke the tool. The vague 'params' object is not explained.

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

Parameters1/5

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

The input schema has one parameter 'params' described as 'Action parameters as a JSON object', which is vague. The description adds no additional meaning or guidance on required keys or format.

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?

Clearly states the action 'enable' and the resource 'cart price rule', distinguishing from sibling 'promotions_disable_rule'. However, it could be more specific about what enabling entails.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives, no prerequisites or context provided. Only states the basic action.

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/thomastx05/magento-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server