Skip to main content
Glama

cms_commit_bulk_update_pages

Execute a previously prepared bulk update to modify multiple CMS pages in one action.

Instructions

Execute a previously prepared CMS page bulk update.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsNoAction parameters as a JSON object

Implementation Reference

  • The handler for the 'cms.commit_bulk_update_pages' tool. It validates input via CmsCommitBulkUpdatePagesSchema (which wraps CommitPlanSchema), consumes the plan from PlanStore, then iterates over page_ids making PUT requests to /V1/cmsPage/{pageId} for each page. Returns summary of successes and errors.
    // ── Commit Bulk Update Pages ──────────────────────────────────────────
    {
      name: 'cms.commit_bulk_update_pages',
      description: 'Execute a previously prepared CMS page bulk update.',
      riskTier: RiskTier.Risk,
      requiresAuth: true,
      handler: async (params: Record<string, unknown>, context: ActionContext) => {
        const validated = CmsCommitBulkUpdatePagesSchema.parse(params);
        guardrails.requireConfirmation(RiskTier.Risk, params);
    
        const plan = planStore.consume(validated.plan_id);
        if (!plan) {
          throw new Error('Plan not found or expired.');
        }
    
        const payload = plan.payload as {
          page_ids: number[];
          page_identifiers?: Record<number, string>;
          updates: Record<string, unknown>;
          scope?: { store_view_code?: string };
        };
        const client = context.getClient();
        const storeCode = payload.scope?.store_view_code;
    
        let successCount = 0;
        const errors: Array<{ page_id: number; error: string }> = [];
    
        for (const pageId of payload.page_ids) {
          try {
            // Include identifier in payload — required by Magento for pages whose
            // identifier is reserved in config (e.g. CMS Home Page "home")
            const identifier = payload.page_identifiers?.[pageId];
            const pagePayload: Record<string, unknown> = { id: pageId, ...payload.updates };
            if (identifier) {
              pagePayload.identifier = identifier;
            }
            await client.put(`/V1/cmsPage/${pageId}`, {
              page: pagePayload,
            }, storeCode);
            successCount++;
          } catch (err) {
            errors.push({ page_id: pageId, error: err instanceof Error ? err.message : String(err) });
          }
        }
    
        return {
          message: `Updated ${successCount}/${payload.page_ids.length} CMS pages.`,
          success_count: successCount,
          error_count: errors.length,
          errors: errors.length > 0 ? errors : undefined,
        };
      },
    },
  • CommitPlanSchema is the underlying schema used by CmsCommitBulkUpdatePagesSchema. It validates plan_id (UUID), confirm (must be literal true), reason (non-empty string), and optional idempotency_key.
    export const CommitPlanSchema = z.object({
      plan_id: z.string().uuid(),
      confirm: z.literal(true),
      reason: z.string().min(1),
      idempotency_key: z.string().optional(),
    });
  • CmsCommitBulkUpdatePagesSchema is simply an alias for CommitPlanSchema, meaning the tool expects plan_id, confirm (true), reason, and optional idempotency_key.
    export const CmsCommitBulkUpdatePagesSchema = CommitPlanSchema;
  • The createCmsActions function returns an array of ActionDefinitions, which includes the 'cms.commit_bulk_update_pages' tool registration at index covering lines 128-180.
    export function createCmsActions(
      planStore: PlanStore,
      guardrails: Guardrails,
      config: McpConfig,
    ): ActionDefinition[] {
      return [
  • Helper function that resolves matching pages by page_ids or identifier filter, used by the prepare step to gather pages for the bulk update plan.
    async function resolveMatchingPages(
      client: MagentoRestClient,
      match: { page_ids?: number[]; identifier?: string },
    ): Promise<Array<Record<string, unknown>>> {
      const filterGroups: Array<{ filters: Array<{ field: string; value: string; conditionType?: string }> }> = [];
    
      if (match.page_ids && match.page_ids.length > 0) {
        filterGroups.push({
          filters: [{ field: 'page_id', value: match.page_ids.join(','), conditionType: 'in' }],
        });
      }
      if (match.identifier) {
        filterGroups.push({
          filters: [{ field: 'identifier', value: `%${match.identifier}%`, conditionType: 'like' }],
        });
      }
    
      const searchParams = client.buildSearchParams({
        filterGroups: filterGroups.length > 0 ? filterGroups : undefined,
        pageSize: 200,
      });
    
      const result = await client.get<{ items: Array<Record<string, unknown>> }>('/V1/cmsPage/search', searchParams);
      return result.items || [];
    }
Behavior2/5

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

No annotations are provided, and the description only says 'execute', which implies mutation but does not disclose any behavioral traits such as idempotency, error handling, or prerequisites.

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 extremely concise (6 words) and front-loaded with the key action and object. While more detail could be added, it efficiently conveys the core purpose.

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 role in executing a bulk update, the description lacks details on dependencies (e.g., preparation ID), return values, error conditions, and side effects. Output schema is absent, and the description does not fill the gap.

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 tool description does not address parameters; the single parameter 'params' is described in the schema as 'Action parameters as a JSON object', which is too generic. The description adds no additional meaning.

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 clearly states the verb 'execute' and the resource 'previously prepared CMS page bulk update', distinguishing it from the sibling 'cms_prepare_bulk_update_pages' and other commit tools.

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?

The phrase 'previously prepared' implies it should be used after a prepare step, but no explicit guidance on when not to use or alternatives is provided.

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