get_design_rules
Retrieve specific design system rules for Modus Web Components including colors, icons, spacing, typography, and other styling guidelines to maintain consistent UI implementation.
Instructions
Get specific design rules for Modus Web Components (colors, icons, spacing, typography, etc.).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category | Yes | The design rule category (e.g., "colors", "icons", "spacing", "typography", "breakpoints", "radius_stroke") |
Implementation Reference
- src/index.ts:551-579 (handler)The primary handler function implementing the 'get_design_rules' tool logic. It normalizes the category input, searches the pre-loaded rules array for a match by category or filename, and returns the corresponding markdown content or an error with available categories.private async getDesignRules(category: string): Promise<any> { const normalizedCategory = category.toLowerCase(); const rule = this.rules.find( (r) => r.category.toLowerCase() === normalizedCategory || r.filename.toLowerCase().includes(normalizedCategory) ); if (!rule) { const availableCategories = this.rules.map((r) => r.category).join(", "); return { content: [ { type: "text", text: `Design rule category "${category}" not found.\n\nAvailable categories: ${availableCategories}`, }, ], }; } return { content: [ { type: "text", text: rule.content, }, ], }; }
- src/index.ts:222-237 (registration)Tool registration definition returned by ListToolsRequestSchema handler, specifying the tool name, description, and input schema.{ name: "get_design_rules", description: "Get specific design rules for Modus Web Components (colors, icons, spacing, typography, etc.).", inputSchema: { type: "object", properties: { category: { type: "string", description: 'The design rule category (e.g., "colors", "icons", "spacing", "typography", "breakpoints", "radius_stroke")', }, }, required: ["category"], }, },
- src/index.ts:320-321 (handler)Dispatch case within the CallToolRequestSchema handler that routes calls to the specific getDesignRules method, extracting the category argument.case "get_design_rules": return await this.getDesignRules((args?.category as string) || "");
- src/index.ts:226-236 (schema)Input schema for the 'get_design_rules' tool, defining the required 'category' string parameter with description and examples.inputSchema: { type: "object", properties: { category: { type: "string", description: 'The design rule category (e.g., "colors", "icons", "spacing", "typography", "breakpoints", "radius_stroke")', }, }, required: ["category"], },