Skip to main content
Glama
ACSGenUI
by ACSGenUI

List AEM Blocks

list_blocks

Retrieve all available AEM blocks with metadata including descriptions, file paths, and counts from blocks.json files.

Instructions

List all available AEM blocks with metadata from blocks.json

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The asynchronous handler function for the 'list_blocks' tool. It maps the BLOCKS_METADATA array into a structured format and returns it as JSON text content, with error handling.
    async () => {
      try {
        const blocks = BLOCKS_METADATA.map(block => ({
          name: block.name,
          description: block.description,
          jsFile: block.js_file,
          cssFile: block.css_file,
          helperFile: block.helper_file || null,
          hasCSS: !!block.css_file,
          hasJS: !!block.js_file,
          hasHelper: !!block.helper_file,
          fileCount: [block.js_file, block.css_file, block.helper_file].filter(Boolean).length
        }));
    
        return {
          content: [{ 
            type: "text", 
            text: JSON.stringify({
              blocks,
              total: blocks.length,
              mode: 'metadata-only',
              message: 'Using embedded blocks metadata for analysis',
              source: 'embedded-data'
            }, null, 2) 
          }]
        };
      } catch (error) {
        return {
          content: [{ 
            type: "text", 
            text: JSON.stringify({
              error: 'Failed to list blocks',
              details: error.message
            }, null, 2) 
          }]
        };
      }
    }
  • index.js:155-198 (registration)
    The server.registerTool call that registers the 'list_blocks' tool, specifying its title, description, and handler function.
    server.registerTool("list_blocks",
      {
        title: "List AEM Blocks",
        description: "List all available AEM blocks with metadata from blocks.json",
      },
      async () => {
        try {
          const blocks = BLOCKS_METADATA.map(block => ({
            name: block.name,
            description: block.description,
            jsFile: block.js_file,
            cssFile: block.css_file,
            helperFile: block.helper_file || null,
            hasCSS: !!block.css_file,
            hasJS: !!block.js_file,
            hasHelper: !!block.helper_file,
            fileCount: [block.js_file, block.css_file, block.helper_file].filter(Boolean).length
          }));
    
          return {
            content: [{ 
              type: "text", 
              text: JSON.stringify({
                blocks,
                total: blocks.length,
                mode: 'metadata-only',
                message: 'Using embedded blocks metadata for analysis',
                source: 'embedded-data'
              }, null, 2) 
            }]
          };
        } catch (error) {
          return {
            content: [{ 
              type: "text", 
              text: JSON.stringify({
                error: 'Failed to list blocks',
                details: error.message
              }, null, 2) 
            }]
          };
        }
      }
    );
  • Embedded constant array BLOCKS_METADATA containing metadata for all available AEM blocks (name, description, js_file, css_file, optional helper_file), directly used by the list_blocks handler.
    const BLOCKS_METADATA = [
      {
        "name": "Accordion",
        "description": "Implements an accordion UI pattern, allowing users to expand and collapse sections of content, styled with borders, padding, and transitions for visual feedback.",
        "js_file": `${BC_DOMAIN}/blocks/accordion/accordion.js`,
        "css_file": `${BC_DOMAIN}/blocks/accordion/accordion.css`
      },
      {
        "name": "Cards",
        "description": "Displays content in a card-like format with images and text, using a grid layout for responsiveness and basic styling for borders and spacing.",
        "js_file": `${BC_DOMAIN}/blocks/cards/cards.js`,
        "css_file": `${BC_DOMAIN}/blocks/cards/cards.css`
      },
      {
        "name": "Carousel",
        "description": "Creates a carousel or slider to showcase content, featuring navigation buttons, slide indicators, and CSS for basic layout and appearance.",
        "js_file": `${BC_DOMAIN}/blocks/carousel/carousel.js`,
        "css_file": `${BC_DOMAIN}/blocks/carousel/carousel.css`
      },
      {
        "name": "Columns",
        "description": "Arranges content into columns, adapting to different screen sizes with CSS flexbox for layout control.",
        "js_file": `${BC_DOMAIN}/blocks/columns/columns.js`,
        "css_file": `${BC_DOMAIN}/blocks/columns/columns.css`
      },
      {
        "name": "Embed",
        "description": "Embeds external content (videos, social posts) into a page, using placeholders and lazy loading for performance.",
        "js_file": `${BC_DOMAIN}/blocks/embed/embed.js`,
        "css_file": `${BC_DOMAIN}/blocks/embed/embed.css`
      },
      {
        "name": "Footer",
        "description": "Loads and displays footer content, fetching it as a fragment and applying basic styling for background color and font size.",
        "js_file": `${BC_DOMAIN}/blocks/footer/footer.js`,
        "css_file": `${BC_DOMAIN}/blocks/footer/footer.css`
      },
      {
        "name": "Form",
        "description": "Generates forms from JSON definitions, handling submissions and confirmations, with CSS for structuring fields and basic input styling.",
        "js_file": `${BC_DOMAIN}/blocks/form/form.js`,
        "css_file": `${BC_DOMAIN}/blocks/form/form.css`,
        "helper_file": `${BC_DOMAIN}/blocks/form/form-fields.js`
      },
      {
        "name": "Fragment",
        "description": "Includes content from another page fragment into the current page.",
        "js_file": `${BC_DOMAIN}/blocks/fragment/fragment.js`,
        "css_file": `${BC_DOMAIN}/blocks/fragment/fragment.css`
      },
      {
        "name": "Header",
        "description": "Loads and displays header content, fetching it as a fragment and applying CSS for layout and navigation.",
        "js_file": `${BC_DOMAIN}/blocks/header/header.js`,
        "css_file": `${BC_DOMAIN}/blocks/header/header.css`
      },
      {
        "name": "Hero",
        "description": "Presents a hero section with a large image and heading, using CSS for positioning and basic styling.",
        "js_file": `${BC_DOMAIN}/blocks/hero/hero.js`,
        "css_file": `${BC_DOMAIN}/blocks/hero/hero.css`
      },
      {
        "name": "Modal",
        "description": "Creates modal dialogs that can be opened via links, styled with CSS for appearance and positioning.",
        "js_file": `${BC_DOMAIN}/blocks/modal/modal.js`,
        "css_file": `${BC_DOMAIN}/blocks/modal/modal.css`
      },
      {
        "name": "Quote",
        "description": "Displays a quote with an optional attribution, styled with CSS for quotation marks and alignment.",
        "js_file": `${BC_DOMAIN}/blocks/quote/quote.js`,
        "css_file": `${BC_DOMAIN}/blocks/quote/quote.css`
      },
      {
        "name": "Search",
        "description": "Implements a search feature with a search box and results display, using CSS for layout and highlighting search terms.",
        "js_file": `${BC_DOMAIN}/blocks/search/search.js`,
        "css_file": `${BC_DOMAIN}/blocks/search/search.css`
      },
      {
        "name": "Table",
        "description": "Renders data in a tabular format, providing options for header display, striping, and borders via CSS classes.",
        "js_file": `${BC_DOMAIN}/blocks/table/table.js`,
        "css_file": `${BC_DOMAIN}/blocks/table/table.css`
      },
      {
        "name": "Tabs",
        "description": "Creates a tabbed interface for organizing content into panels, using CSS for layout and basic styling of tabs and panels.",
        "js_file": `${BC_DOMAIN}/blocks/tabs/tabs.js`,
        "css_file": `${BC_DOMAIN}/blocks/tabs/tabs.css`
      },
      {
        "name": "Video",
        "description": "Embeds videos from various sources (YouTube, Vimeo, local files), using placeholders and lazy loading for performance, with CSS for basic layout and styling.",
        "js_file": `${BC_DOMAIN}/blocks/video/video.js`,
        "css_file": `${BC_DOMAIN}/blocks/video/video.css`
      }
    ];
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the source ('blocks.json') and output includes metadata, but fails to describe key behaviors like whether this is a read-only operation, potential performance impacts, error handling, or format of the returned data. This leaves significant gaps for an agent to understand how the tool behaves.

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?

The description is a single, efficient sentence that front-loads the key information ('List all available AEM blocks') and adds necessary detail ('with metadata from blocks.json') without any wasted words. It's appropriately sized for a simple tool.

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

Completeness3/5

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

Given the tool's simplicity (0 parameters, no output schema, no annotations), the description is minimally adequate. It states the purpose and source, but lacks details on behavioral traits and output format, which are important for an agent to use it correctly. It meets the basic requirement but has clear gaps in completeness.

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

Parameters4/5

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

The tool has 0 parameters, and schema description coverage is 100%, so there are no parameters to document. The description doesn't need to add parameter semantics, and a baseline of 4 is appropriate as it doesn't mislead or omit parameter information.

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?

The description clearly states the action ('List') and resource ('AEM blocks'), and specifies the source ('blocks.json') and what's included ('with metadata'). It's specific about what the tool does, though without sibling tools to differentiate from, it can't achieve a perfect 5.

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?

The description provides no guidance on when to use this tool, such as prerequisites, context, or alternatives. It simply states what the tool does without indicating any usage scenarios or constraints.

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/ACSGenUI/mcp-block-collection'

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