Skip to main content
Glama
totodev999

shadcn-ui MCP Server

by totodev999

search_components

Find shadcn/ui components by keyword to access documentation and examples for building interfaces.

Instructions

Search for shadcn/ui components by keyword

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query to find relevant components

Implementation Reference

  • The main handler function for the search_components tool. It validates the query, ensures the components list is loaded, performs the search using a helper method, and returns the results.
    private async handleSearchComponents(args: any) {
      const query = this.validateSearchQuery(args);
    
      try {
        // Ensure components list is loaded
        await this.ensureComponentsListLoaded();
    
        // Filter components matching the search query
        const results = this.searchComponentsByQuery(query);
    
        return this.createSuccessResponse(results);
      } catch (error) {
        this.handleAxiosError(error, 'Search failed');
      }
    }
  • src/index.ts:148-161 (registration)
    Registration of the search_components tool in the ListTools handler, defining name, description, and input schema.
    {
      name: 'search_components',
      description: 'Search for shadcn/ui components by keyword',
      inputSchema: {
        type: 'object',
        properties: {
          query: {
            type: 'string',
            description: 'Search query to find relevant components',
          },
        },
        required: ['query'],
      },
    },
  • JSON schema defining the input parameters for the search_components tool (query string required).
    inputSchema: {
      type: 'object',
      properties: {
        query: {
          type: 'string',
          description: 'Search query to find relevant components',
        },
      },
      required: ['query'],
    },
  • Helper function implementing the core search logic by filtering cached components where name or description matches the query.
    private searchComponentsByQuery(query: string): ComponentInfo[] {
      if (!this.componentsListCache) {
        return [];
      }
    
      return this.componentsListCache.filter((component) => {
        return (
          component.name.includes(query) ||
          component.description.toLowerCase().includes(query)
        );
      });
    }
  • Helper function for input validation specific to the search_components tool query parameter.
    private validateSearchQuery(args: any): string {
      if (!args?.query || typeof args.query !== 'string') {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Search query is required and must be a string'
        );
      }
      return args.query.toLowerCase();
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It only states the search action without details on permissions, rate limits, response format, or whether it's read-only or destructive. This leaves significant gaps for a tool that likely interacts with external resources.

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, efficient sentence that directly states the tool's purpose without any wasted words. It is appropriately sized and front-loaded, making it easy to understand at a glance.

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 the lack of annotations and output schema, the description is incomplete. It doesn't address behavioral aspects like safety or response format, and while the parameter is covered by the schema, the overall context for a search tool interacting with UI components is underspecified.

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?

The schema description coverage is 100%, with the 'query' parameter fully documented in the schema. The description adds no additional meaning beyond implying keyword-based search, which is already covered by the schema's description. This meets the baseline for high schema coverage.

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 the action ('Search for') and resource ('shadcn/ui components') with a specific method ('by keyword'), making the purpose evident. However, it doesn't explicitly differentiate from sibling tools like 'list_shadcn_components' or 'get_component_details', which could involve similar resources but different operations.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'list_shadcn_components' for unfiltered listing or 'get_component_details' for specific component info, leaving usage context implied at best.

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/totodev999/shadcn-ui-mcp-server_clone'

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