Skip to main content
Glama

promotions_get_rule

Retrieve detailed information about a specific cart price rule, including conditions, actions, and labels.

Instructions

Get details of a specific cart price rule.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsNoAction parameters as a JSON object

Implementation Reference

  • The handler function for the 'promotions.get_rule' tool. Validates params with GetRuleSchema, then makes a GET request to Magento's /V1/salesRules/{rule_id} API to retrieve cart price rule details.
    handler: async (params: Record<string, unknown>, context: ActionContext) => {
      const validated = GetRuleSchema.parse(params);
      const client = context.getClient();
      const result = await client.get(`/V1/salesRules/${validated.rule_id}`);
      return result;
    },
  • Zod validation schema for the tool. Requires a single integer 'rule_id' parameter.
    export const GetRuleSchema = z.object({
      rule_id: z.number().int(),
    });
  • src/index.ts:78-78 (registration)
    Registration loop in index.ts: the action's name ('promotions.get_rule') is converted to 'promotions_get_rule' (dots replaced with underscores) and registered as an MCP tool via mcpServer.tool().
    const toolName = action.name.replace(/\./g, '_');
  • The ActionDefinition object for 'promotions.get_rule' as part of the createPromotionsActions() array. Defines name, description, risk tier, auth requirement, and handler.
    // ── Get Rule ──────────────────────────────────────────────────────────
    {
      name: 'promotions.get_rule',
      description: 'Get details of a specific cart price rule.',
      riskTier: RiskTier.Safe,
      requiresAuth: true,
      handler: async (params: Record<string, unknown>, context: ActionContext) => {
        const validated = GetRuleSchema.parse(params);
        const client = context.getClient();
        const result = await client.get(`/V1/salesRules/${validated.rule_id}`);
        return result;
      },
    },
Behavior2/5

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

No annotations are provided, so the description must carry the burden. It states 'get details' implying a read operation, but does not disclose any behavioral traits such as required authentication, scope limitations, or whether the tool is safe to call multiple times.

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?

The description is a single sentence with no fluff. However, it could be slightly longer to include essential parameter context without losing conciseness.

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

Completeness2/5

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

Given the tool's simplicity (one parameter, no output schema), the description is too sparse. It does not explain how to specify which rule or what the response will contain. The sibling context suggests a search-then-get workflow, which is not mentioned.

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

Parameters2/5

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

The input schema has a single parameter 'params' described as 'Action parameters as a JSON object', which is generic. The description adds no information about what keys (e.g., rule ID) are expected inside this object, despite 100% schema coverage of the parameter name.

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 'Get details of a specific cart price rule' clearly states the action (get) and resource (cart price rule). It distinguishes from sibling tools like promotions_search_rules (search) and promotions_update_rule (update), making its purpose unambiguous.

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 such as promotions_search_rules. It does not specify prerequisites (e.g., needing a rule ID) or the typical workflow (search first, then get details).

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