Skip to main content
Glama

search_design_rules

Search design rules by keyword to find guidelines for colors, spacing, icons, and other design system elements.

Instructions

Search across all design rules by keyword or term.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query for design rules (e.g., "primary color", "icon size", "spacing scale")

Implementation Reference

  • The handler function that performs keyword search across all loaded design rules, extracts relevant matches, and formats results with category names and descriptions.
    private async searchDesignRules(query: string): Promise<any> { const normalizedQuery = query.toLowerCase(); const results: Array<{ category: string; filename: string; relevance: string; }> = []; for (const rule of this.rules) { const content = rule.content.toLowerCase(); const categoryName = rule.category.toLowerCase(); if ( categoryName.includes(normalizedQuery) || content.includes(normalizedQuery) ) { // Extract the first meaningful line as description const lines = rule.content.split("\n"); let description = ""; for (const line of lines) { if (line.trim() && !line.startsWith("#") && !line.startsWith("---")) { description = line.trim(); break; } } results.push({ category: rule.category, filename: rule.filename, relevance: description || "Design rule documentation", }); } } if (results.length === 0) { return { content: [ { type: "text", text: `No design rules found matching "${query}". Try searching for terms like "color", "icon", "spacing", "typography", etc.`, }, ], }; } const resultText = results .map((r) => `**${r.category}**\n${r.relevance}\n`) .join("\n"); return { content: [ { type: "text", text: `Found ${results.length} design rule(s) matching "${query}":\n\n${resultText}`, }, ], }; }
  • Defines the input schema for the search_design_rules tool, requiring a 'query' string parameter.
    inputSchema: { type: "object", properties: { query: { type: "string", description: 'Search query for design rules (e.g., "primary color", "icon size", "spacing scale")', }, }, required: ["query"], },
  • src/index.ts:238-252 (registration)
    Registers the search_design_rules tool in the list returned by ListToolsRequestHandler, including name, description, and schema.
    { name: "search_design_rules", description: "Search across all design rules by keyword or term.", inputSchema: { type: "object", properties: { query: { type: "string", description: 'Search query for design rules (e.g., "primary color", "icon size", "spacing scale")', }, }, required: ["query"], }, },
  • src/index.ts:323-325 (registration)
    Switch case in the central CallToolRequestHandler that dispatches search_design_rules calls to the handler method.
    case "search_design_rules": return await this.searchDesignRules((args?.query as string) || "");
  • Loads design rule markdown files into memory (this.rules array), which is used by the search_design_rules handler.
    private loadRules(): void { if (!existsSync(this.rulesPath)) { console.error(`Rules directory not found at: ${this.rulesPath}`); console.error("Please run: node download-docs.js"); return; } const files = readdirSync(this.rulesPath).filter((f) => f.endsWith(".md")); for (const file of files) { const content = readFileSync(join(this.rulesPath, file), "utf-8"); const category = file.replace(".md", "").replace("modus_", ""); this.rules.push({ filename: file, category, content, }); } console.error(`Loaded ${this.rules.length} design rules files`); }

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/julianoczkowski/mcp-modus'

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