list_rules
Lists all available UI component rules with IDs, names, and categories for compliance checking and validation.
Instructions
List all available rules with their IDs, names, and categories
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/index.ts:478-504 (handler)The handler function that implements the core logic of the 'list_rules' tool. It fetches all rules, groups them by category, adds severity emojis, and formats them into a markdown list.function handleListRules(): ToolResult { const rules = getAllRules(); const byCategory: Record<string, Rule[]> = {}; for (const rule of rules) { if (!byCategory[rule.category]) { byCategory[rule.category] = []; } byCategory[rule.category].push(rule); } let text = '# Available Rules\n\n'; for (const [category, categoryRules] of Object.entries(byCategory)) { text += `## ${category.charAt(0).toUpperCase() + category.slice(1)}\n\n`; for (const rule of categoryRules) { const severityEmoji = rule.severity === 'error' ? '🔴' : rule.severity === 'warning' ? '🟡' : '🔵'; text += `- ${severityEmoji} \`${rule.id}\` - ${rule.name} (weight: ${rule.weight})\n`; } text += '\n'; } return { content: [{ type: 'text', text }], }; }
- src/tools/index.ts:159-166 (schema)The tool definition including name, description, and empty input schema (no parameters required). This serves as the schema registration for the MCP tool.{ name: 'list_rules', description: 'List all available rules with their IDs, names, and categories', inputSchema: { type: 'object', properties: {}, }, },
- src/tools/index.ts:247-248 (registration)The dispatch registration in the executeTool switch statement that maps the tool name to its handler.case 'list_rules': return handleListRules();