Skip to main content
Glama
Lingzhhiiii

Shoplazza MCP Tool

by Lingzhhiiii

get-lessjs

Retrieve documentation for Shoplazza LessJS components to access properties, methods, events, and example code.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
componentNameYes

Implementation Reference

  • The handler function for the 'get-lessjs' tool. Fetches HTML documentation for the specified component from the LessJS API, extracts structured data using extractComponentDocumentation, and returns it as text content.
    async ({componentName}) => {
    
      const response = await fetch(
        `https://lessjs.shoplazza.com/latest/components/${componentName}/`,
        {
          method: "GET",
        }
      );
    
      if (!response.ok) {
        throw new Error(`HTTP error! status: ${response.status}`);
      }
    
      const html = await response.text();
      const docData = extractComponentDocumentation(html);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(docData, null, 2)
          }
        ]
      };
    }
  • Input schema for the 'get-lessjs' tool, defining a required string parameter 'componentName'.
      componentName: z.string()
    },
  • src/index.ts:14-42 (registration)
    Registration of the 'get-lessjs' tool on the MCP server, including schema and handler.
    server.tool("get-lessjs", 
      {
        componentName: z.string()
      },
      async ({componentName}) => {
    
        const response = await fetch(
          `https://lessjs.shoplazza.com/latest/components/${componentName}/`,
          {
            method: "GET",
          }
        );
    
        if (!response.ok) {
          throw new Error(`HTTP error! status: ${response.status}`);
        }
    
        const html = await response.text();
        const docData = extractComponentDocumentation(html);
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(docData, null, 2)
            }
          ]
        };
      }
    );
  • Helper function that parses HTML documentation and extracts structured component data (title, description, usage, properties, methods, events, examples).
    export function extractComponentDocumentation(html: string): ComponentDoc {
      return {
        name: 'spz-accordion',
        ...extractTitleAndDescription(html),
        usage: extractUsage(html),
        properties: extractProperties(html),
        methods: extractMethods(html),
        events: extractEvents(html),
        examples: extractExamples(html)
      };
    }
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/Lingzhhiiii/shoplazza-mcps'

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