Skip to main content
Glama

search_design_rules

Search design system guidelines by keyword to find specific rules for colors, spacing, typography, and component specifications.

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 core handler function that implements the logic for the 'search_design_rules' tool. It searches through the loaded design rules (this.rules) for matches to the query, extracts relevant descriptions, and formats the results.
    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}`, }, ], }; }
  • The input schema defining the expected parameters for the search_design_rules tool: a required 'query' string.
    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)
    Registration of the 'search_design_rules' tool in the ListToolsRequestSchema handler, including name, description, and input 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-324 (registration)
    Dispatcher case in the CallToolRequestSchema handler that routes calls to the searchDesignRules method.
    case "search_design_rules": return await this.searchDesignRules((args?.query as string) || "");

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