Skip to main content
Glama

search_components

Search for Modus Web Components by name or keyword to find matching components with brief descriptions.

Instructions

Search for Modus Web Components by name or keyword. Returns a list of matching components with brief descriptions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query (component name, keyword, or feature)

Implementation Reference

  • The actual implementation of the searchComponents method. It normalizes the query, iterates over loaded documentation files, searches component names and content for matches, extracts a brief description, and returns formatted results (or a 'not found' message).
    private async searchComponents(query: string): Promise<any> {
      const normalizedQuery = query.toLowerCase();
      const results: Array<{
        component: string;
        filename: string;
        relevance: string;
      }> = [];
    
      for (const doc of this.docs) {
        const content = doc.content.toLowerCase();
        const componentName = doc.component.toLowerCase();
    
        if (
          componentName.includes(normalizedQuery) ||
          content.includes(normalizedQuery)
        ) {
          // Extract the first paragraph or description
          const lines = doc.content.split("\n");
          let description = "";
    
          for (const line of lines) {
            if (
              line.trim() &&
              !line.startsWith("#") &&
              !line.startsWith("Tag:")
            ) {
              description = line.trim();
              break;
            }
          }
    
          results.push({
            component: doc.component,
            filename: doc.filename,
            relevance: description || "Modus Web Component",
          });
        }
      }
    
      if (results.length === 0) {
        return {
          content: [
            {
              type: "text",
              text: `No components found matching "${query}". Try searching for common UI elements like "button", "input", "modal", "card", etc.`,
            },
          ],
        };
      }
    
      const resultText = results
        .map((r) => `**${r.component}**\n${r.relevance}\n`)
        .join("\n");
    
      return {
        content: [
          {
            type: "text",
            text: `Found ${results.length} component(s) matching "${query}":\n\n${resultText}`,
          },
        ],
      };
    }
  • The inputSchema definition for the 'search_components' tool. It defines a 'query' string parameter that is required, with a description prompting the user to search by component name, keyword, or feature.
    inputSchema: {
      type: "object",
      properties: {
        query: {
          type: "string",
          description:
            "Search query (component name, keyword, or feature)",
        },
      },
      required: ["query"],
    },
  • src/index.ts:165-180 (registration)
    The tool is registered in the ListToolsRequestSchema handler as part of the tools array with name 'search_components', description, and inputSchema.
    {
      name: "search_components",
      description:
        "Search for Modus Web Components by name or keyword. Returns a list of matching components with brief descriptions.",
      inputSchema: {
        type: "object",
        properties: {
          query: {
            type: "string",
            description:
              "Search query (component name, keyword, or feature)",
          },
        },
        required: ["query"],
      },
    },
  • src/index.ts:304-305 (registration)
    The tool is dispatched in the CallToolRequestSchema handler via a switch statement: case 'search_components' calls this.searchComponents().
    case "search_components":
      return await this.searchComponents((args?.query as string) || "");
  • The loadDocs() helper that loads Markdown files from the docs directory and populates the `this.docs` array that searchComponents iterates over.
    private loadDocs(): void {
      if (!existsSync(this.docsPath)) {
        console.error(`Documentation directory not found at: ${this.docsPath}`);
        console.error("Please run: node download-docs.js");
        return;
      }
    
      const files = readdirSync(this.docsPath).filter((f) => f.endsWith(".md"));
    
      for (const file of files) {
        const content = readFileSync(join(this.docsPath, file), "utf-8");
        const component = file.replace("modus-wc-", "").replace(".md", "");
    
        this.docs.push({
          filename: file,
          component,
          content,
        });
      }
    
      console.error(`Loaded ${this.docs.length} component documentation files`);
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It only states it returns matching components with brief descriptions, omitting details like pagination, ordering, error handling, or read-only semantics.

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

Conciseness4/5

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

Very concise at two sentences, with the purpose front-loaded. Efficient but could benefit from slightly more context without becoming verbose.

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

Completeness2/5

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

Given 10 sibling tools and no output schema, the description is too minimal. It does not explain result format, scope, or how it differs from similar tools, leaving gaps for an agent to infer.

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 coverage is 100% and the parameter description already explains 'query' as a search string. The description's 'by name or keyword' adds minimal additional meaning, so baseline 3 is appropriate.

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

Purpose4/5

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

The description clearly states it searches for Modus Web Components by name or keyword and returns a list with brief descriptions. It uses a specific verb and resource, but does not explicitly differentiate from siblings like find_by_attribute or list_all_components.

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

Usage Guidelines2/5

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

No guidance on when to use this tool versus alternatives (e.g., list_all_components for browsing all, find_by_attribute for attribute-based search). The description lacks use cases or exclusions.

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