Skip to main content
Glama

search_brand

Search all design system content: guidelines, component specs, colors, typography, and brand documentation. Narrow results by marketing, product, or shared context.

Instructions

Full-text search across all design system content: guidelines, component specs, color names, typography definitions, and brand documentation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query
contextNoDesign context to search withinall
limitNoMaximum number of results to return

Implementation Reference

  • The main handler function for the search_brand tool. It calls searchIndex() to perform full-text search across the design system index, then formats results as text output.
    export function handler(index: DesignSystemIndex, args: SearchBrandArgs) {
      const results = searchIndex(args.query, index.searchIndex, args.limit ?? 10, args.context);
    
      if (results.length === 0) {
        return [{ type: 'text' as const, text: `No results found for "${args.query}".` }];
      }
    
      const output = results.map((r) => ({
        type: r.type,
        name: r.name,
        context: r.context,
        score: r.score,
        snippet: r.snippet,
        source: r.source,
      }));
    
      return [{ type: 'text' as const, text: JSON.stringify(output, null, 2) }];
    }
  • The searchIndex() helper function that performs the actual full-text search. It scores entries based on term matching, generates snippets, and returns sorted results.
    export function searchIndex(
      query: string,
      entries: SearchIndexEntry[],
      limit: number = 10,
      context?: string,
    ): Array<SearchIndexEntry & { score: number; snippet: string }> {
      const queryLower = query.toLowerCase();
      const queryTerms = queryLower.split(/\s+/).filter(Boolean);
    
      const results: Array<SearchIndexEntry & { score: number; snippet: string }> = [];
    
      for (const entry of entries) {
        if (context && context !== 'all' && entry.context !== context) continue;
    
        const contentLower = entry.content.toLowerCase();
        let score = 0;
    
        for (const term of queryTerms) {
          const idx = contentLower.indexOf(term);
          if (idx !== -1) {
            score += 1;
            // Bonus for name match
            if (entry.name.toLowerCase().includes(term)) score += 2;
          }
        }
    
        if (score > 0) {
          const snippetIdx = contentLower.indexOf(queryTerms[0]);
          const snippetStart = Math.max(0, snippetIdx - 40);
          const snippetEnd = Math.min(entry.content.length, snippetIdx + 120);
          const snippet = (snippetStart > 0 ? '...' : '') + entry.content.slice(snippetStart, snippetEnd).trim() + (snippetEnd < entry.content.length ? '...' : '');
    
          results.push({ ...entry, score, snippet });
        }
      }
    
      results.sort((a, b) => b.score - a.score);
      return results.slice(0, limit);
    }
  • The INPUT_SCHEMA for search_brand, defining the JSON Schema for query (required string), context (optional enum: marketing/product/shared/all), and limit (optional number, default 10).
    export const INPUT_SCHEMA = {
      type: 'object' as const,
      properties: {
        query: { type: 'string', description: 'Search query' },
        context: { type: 'string', enum: ['marketing', 'product', 'shared', 'all'], default: 'all', description: 'Design context to search within' },
        limit: { type: 'number', default: 10, description: 'Maximum number of results to return' },
      },
      required: ['query'],
    };
  • The TypeScript SearchBrandArgs interface defining types for query (string), context (optional union), and limit (optional number).
    /** Arguments for the `search_brand` MCP tool */
    export interface SearchBrandArgs {
      /** Free-text search query across all design-system content */
      query: string;
    
      /** Restrict search to a specific design context */
      context?: 'marketing' | 'product' | 'shared' | 'all';
    
      /** Maximum number of results to return (default: 10) */
      limit?: number;
    }
  • Registration of the searchBrand module in the ALL_TOOLS array (line 46), plus the case-switch dispatching to searchBrand.handler() (lines 96-97) in CallToolRequestSchema handler.
    const ALL_TOOLS = [
      brandOverview,
      colors,
      typography,
      logos,
      components,
      guidelines,
      tokens,
      textures,
      css,
      searchBrand,
      contextDiff,
      validateUsage,
    ] as const;
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 mentions 'full-text search' without detailing any behavioral traits such as pagination, error handling, rate limits, or what happens when no results are found.

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, focused sentence that front-loads the purpose and lists key content categories. Every word adds value, and there is no superfluous information.

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 has multiple parameters and no output schema, the description is somewhat complete in defining the search scope, but it lacks details about output format, ordering, or limits on search behavior, which weakens completeness.

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%, so parameters are already well-documented. The description adds context about the search scope (design system content) but does not provide additional semantics beyond the schema.

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 'Full-text search across all design system content' and enumerates specific content types (guidelines, component specs, color names, etc.), making the tool's purpose explicit and distinguishing it from the many get_* sibling tools.

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 the tool is for broad search across all design system content, in contrast to sibling tools like get_colors which retrieve specific items, but it does not explicitly state when to use this versus alternatives or when not to use it.

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/ejwhite7/brandkit-mcp'

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