get-lessjs
Retrieve documentation for Shoplazza LessJS components, including properties, methods, events, and example code, to streamline development and integration processes.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| componentName | Yes |
Implementation Reference
- src/index.ts:18-41 (handler)The main handler function for the 'get-lessjs' tool. It fetches the component HTML from the LessJS API and processes it with extractComponentDocumentation to return JSON-formatted documentation.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) } ] }; }
- src/index.ts:15-17 (schema)Input schema for the 'get-lessjs' tool, requiring a 'componentName' string parameter.{ componentName: z.string() },
- src/index.ts:14-42 (registration)Registration of the 'get-lessjs' tool on the MCP server using server.tool().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) } ] }; } );
- src/extractor.ts:170-180 (helper)Helper function that parses LessJS component HTML into structured documentation data, used by the tool handler.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) }; }