Skip to main content
Glama

search_design_rules

Search design rules by keyword to retrieve specific design guidelines for components, colors, spacing, and icons within the Modus design system.

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 searchDesignRules method (lines 581-639) is the handler that executes the 'search_design_rules' tool logic. It normalizes the query, iterates over all loaded rules, checks if the query matches category name or content, extracts a description, and returns formatted results (or a 'not found' message).
    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 tool registration schema for 'search_design_rules' (lines 238-252) defines the tool's name, description, and input schema with a required 'query' string property.
    {
      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:238-252 (registration)
    The tool is registered in the ListToolsRequestSchema handler (line 238-252) as part of the tools array, and its case branch in the CallToolRequestSchema handler (lines 323-324) dispatches to searchDesignRules.
    {
      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)
    The switch-case branch (lines 323-324) in the CallToolRequestSchema handler dispatches the 'search_design_rules' tool call to the searchDesignRules method with the query argument.
    case "search_design_rules":
      return await this.searchDesignRules((args?.query as string) || "");
  • The loadRules method (lines 112-133) loads the design rule markdown files from the rules directory into this.rules, which searchDesignRules iterates over to find matches.
    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`);
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must disclose behavioral traits. It only states 'search across all design rules' but lacks details on pagination, search algorithm (exact vs fuzzy), case sensitivity, or result limits. This leaves significant behavior unspecified.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence that directly states the tool's purpose with no extraneous words. Every word is necessary and earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simplicity of the tool (1 parameter, no output schema, no annotations), the description is minimally adequate but lacks detail on what the search results look like or any behavioral specifics. It covers the basic purpose but not enough for an agent to fully understand behavior.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% for the single required parameter 'query'. The description repeats the concept of keyword search but adds minimal additional meaning beyond the schema's example values. Baseline 3 is appropriate as schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action (search) and resource (design rules). It distinguishes itself from sibling tools like 'get_design_rules' which retrieves specific rules, and 'search_components' which searches components.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies use when keyword search is needed, but it does not provide guidance on when not to use it or mention alternatives. No explicit when-to-use or when-not-to-use context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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