Skip to main content
Glama

search_specification

Find specific terms or concepts within the components.build specification to locate relevant sections and contextual information for UI component development.

Instructions

Search the components.build specification for a specific term or concept. Returns matching sections and context.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesThe term or concept to search for (e.g., "aria", "keyboard", "CVA", "asChild")

Implementation Reference

  • The handler function that executes the search_specification tool. It extracts the query parameter, calls the searchSpecification helper, formats the results into markdown, and returns a ToolResult.
    function handleSearchSpecification(args: Record<string, unknown>): ToolResult {
      const query = args.query as string;
    
      if (!query) {
        return {
          content: [{ type: 'text', text: 'Please provide a search query.' }],
          isError: true,
        };
      }
    
      const results = searchSpecification(query);
    
      if (results.length === 0) {
        return {
          content: [
            {
              type: 'text',
              text: `No results found for "${query}". Try a different search term.`,
            },
          ],
        };
      }
    
      let text = `# Search Results for "${query}"\n\n`;
      text += `Found matches in ${results.length} section(s):\n\n`;
    
      for (const result of results) {
        text += `## ${result.section}\n\n`;
        for (const match of result.matches) {
          text += `> ${match}\n\n`;
        }
      }
    
      text += `\n---\n\nUse \`get_specification\` with the section name to get the full content.`;
    
      return {
        content: [{ type: 'text', text }],
      };
    }
  • The tool definition including name, description, and input schema for validation.
    {
      name: 'search_specification',
      description: 'Search the components.build specification for a specific term or concept. Returns matching sections and context.',
      inputSchema: {
        type: 'object',
        properties: {
          query: {
            type: 'string',
            description: 'The term or concept to search for (e.g., "aria", "keyboard", "CVA", "asChild")',
          },
        },
        required: ['query'],
      },
    },
  • Registration of the tool handler in the executeTool switch statement.
    case 'search_specification':
      return handleSearchSpecification(args);
  • The core helper function that performs the actual search across all specification sections, returning matching lines grouped by section.
    export function searchSpecification(term: string): Array<{ section: string; matches: string[] }> {
      const results: Array<{ section: string; matches: string[] }> = [];
      const lowerTerm = term.toLowerCase();
    
      for (const [sectionName, content] of Object.entries(SPECIFICATION.sections)) {
        const lines = content.split('\n');
        const matches: string[] = [];
    
        for (const line of lines) {
          if (line.toLowerCase().includes(lowerTerm)) {
            matches.push(line.trim());
          }
        }
    
        if (matches.length > 0) {
          results.push({ section: sectionName, matches: matches.slice(0, 5) }); // Limit to 5 matches per section
        }
      }
    
      return results;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool 'Returns matching sections and context,' which hints at output behavior, but lacks details on permissions, rate limits, error handling, or whether it's read-only. For a search tool with zero annotation coverage, this leaves significant gaps in understanding its operational traits.

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 highly concise and front-loaded, consisting of two clear sentences: one stating the purpose and one stating the return behavior. Every word earns its place, with no redundant or vague language, making it easy for an agent to parse quickly.

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 tool's low complexity (single parameter, no output schema, no annotations), the description is adequate but incomplete. It covers the basic purpose and return hint, but lacks output details (e.g., format of 'matching sections and context'), usage context, or behavioral constraints, which could hinder an agent's ability to use it effectively without trial and error.

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%, with the input schema fully documenting the single 'query' parameter. The description adds minimal value beyond the schema by implying the query is for 'a specific term or concept,' but doesn't provide additional syntax, format, or usage examples. This meets the baseline score of 3 when schema coverage is high.

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 tool's purpose: 'Search the components.build specification for a specific term or concept.' It specifies the verb ('search'), resource ('components.build specification'), and action ('for a specific term or concept'). However, it doesn't explicitly differentiate from sibling tools like 'get_specification' or 'list_specification_sections', which might also retrieve specification content.

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 'get_specification' (which might fetch the entire specification) or 'list_specification_sections' (which might list sections without searching), leaving the agent to infer usage based on the 'search' keyword alone.

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/getlokiui/components-build-mcp'

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