Skip to main content
Glama

search_tools

Search available tools by category, keyword, or capability to find the right tool for tasks without loading all schemas.

Instructions

Search and discover available tools by category, keyword, or capability. Use this to find the right tool for a task without loading all tool schemas. Returns lightweight tool metadata by default; use includeSchema:true for full schemas.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryNoFilter tools by category
queryNoSearch query to match tool names, descriptions, and keywords
complexityNoFilter by tool complexity level
cemcpOnlyNoOnly return tools with CE-MCP directive support (more token-efficient)
includeSchemaNoInclude full input schemas in response (increases token count)
limitNoMaximum number of tools to return

Implementation Reference

  • Handler function that executes the 'search_tools' MCP tool. Parses args, calls the underlying searchTools helper from tool-catalog, formats the SearchToolsResult.
    export function executeSearchTools(args: SearchToolsArgs): SearchToolsResult {
      const {
        category,
        query,
        complexity,
        cemcpOnly = false,
        includeSchema = false,
        limit = 20,
      } = args;
    
      // Build search options, only including defined values
      const searchOptions: Parameters<typeof searchTools>[0] = {
        cemcpOnly,
        includeSchema,
        limit,
      };
    
      if (category !== undefined) {
        searchOptions.category = category;
      }
      if (query !== undefined) {
        searchOptions.query = query;
      }
      if (complexity !== undefined) {
        searchOptions.complexity = complexity;
      }
    
      const result = searchTools(searchOptions);
    
      const catalogSummary = getCatalogSummary();
    
      const response: SearchToolsResult = {
        success: true,
        tools: result.tools.map(tool => ({
          name: tool.name,
          description: tool.shortDescription,
          category: tool.category,
          complexity: tool.complexity,
          hasCEMCPDirective: tool.hasCEMCPDirective,
          tokenCost: tool.tokenCost,
          ...(includeSchema && tool.inputSchema ? { inputSchema: tool.inputSchema } : {}),
        })),
        summary: {
          totalFound: result.totalCount,
          totalInCatalog: catalogSummary.totalTools,
          byCategory: result.categories as Record<string, number>,
        },
      };
    
      if (query !== undefined) {
        response.query = query;
      }
    
      return response;
    }
  • Schema definition for the 'search_tools' tool returned by getSearchToolsDefinition(). This is the inputSchema exposed to MCP clients.
    export function getSearchToolsDefinition(): Tool {
      return {
        name: 'search_tools',
        description:
          'Search and discover available tools by category, keyword, or capability. Use this to find the right tool for a task without loading all tool schemas. Returns lightweight tool metadata by default; use includeSchema:true for full schemas.',
        inputSchema: {
          type: 'object',
          properties: {
            category: {
              type: 'string',
              enum: [
                'analysis',
                'adr',
                'content-security',
                'research',
                'deployment',
                'memory',
                'file-system',
                'rules',
                'workflow',
                'utility',
              ],
              description: 'Filter tools by category',
            },
            query: {
              type: 'string',
              description: 'Search query to match tool names, descriptions, and keywords',
            },
            complexity: {
              type: 'string',
              enum: ['simple', 'moderate', 'complex'],
              description: 'Filter by tool complexity level',
            },
            cemcpOnly: {
              type: 'boolean',
              description: 'Only return tools with CE-MCP directive support (more token-efficient)',
              default: false,
            },
            includeSchema: {
              type: 'boolean',
              description: 'Include full input schemas in response (increases token count)',
              default: false,
            },
            limit: {
              type: 'number',
              description: 'Maximum number of tools to return',
              default: 20,
            },
          },
        },
      };
    }
  • Registration via getToolListForMCP function, which dynamically includes 'search_tools' (via getSearchToolsDefinition()) in the MCP tool list for ListTools calls, in summary/lightweight/full modes.
    export function getToolListForMCP(options: { mode?: 'full' | 'lightweight' | 'summary' }): {
      tools: Tool[];
    } {
      const { mode = 'lightweight' } = options;
    
      if (mode === 'summary') {
        // Return only the search_tools meta-tool
        return {
          tools: [getSearchToolsDefinition()],
        };
      }
    
      if (mode === 'lightweight') {
        // Return lightweight list with search_tools
        const lightList = getLightweightToolList();
        const tools: Tool[] = [
          getSearchToolsDefinition(),
          ...lightList.map(item => ({
            name: item.name,
            description: `[${item.category}] ${item.description}${item.hasCEMCPDirective ? ' (CE-MCP)' : ''}`,
            inputSchema: {
              type: 'object' as const,
              properties: {},
              description: `Use search_tools with query:"${item.name}" to get full schema`,
            },
          })),
        ];
        return { tools };
      }
    
      // Full mode - return all tools with schemas from catalog
      const tools: Tool[] = [getSearchToolsDefinition()];
    
      for (const [, metadata] of TOOL_CATALOG) {
        tools.push(toMCPTool(metadata));
      }
    
      return { tools };
    }
  • Core helper function searchTools that performs the actual catalog search/filtering/scoring on TOOL_CATALOG Map. Called by the handler.
    export function searchTools(options: ToolSearchOptions = {}): ToolSearchResult {
      const { category, query, complexity, cemcpOnly, limit = 20, includeSchema = false } = options;
    
      let results: CatalogEntry[] = [];
    
      // Convert map to array and apply filters
      for (const [_name, metadata] of TOOL_CATALOG) {
        // Apply category filter
        if (category && metadata.category !== category) continue;
    
        // Apply complexity filter
        if (complexity && metadata.complexity !== complexity) continue;
    
        // Apply CE-MCP filter
        if (cemcpOnly && !metadata.hasCEMCPDirective) continue;
    
        // Create catalog entry
        const entry: CatalogEntry = {
          ...metadata,
          isHighTokenCost: metadata.tokenCost.max > 5000,
        };
    
        // Apply query filter with scoring
        if (query) {
          const lowerQuery = query.toLowerCase();
          let score = 0;
    
          // Name match (highest priority)
          if (metadata.name.toLowerCase().includes(lowerQuery)) {
            score += 100;
          }
    
          // Keyword match
          for (const keyword of metadata.keywords) {
            if (keyword.toLowerCase().includes(lowerQuery)) {
              score += 50;
            }
          }
    
          // Description match
          if (metadata.shortDescription.toLowerCase().includes(lowerQuery)) {
            score += 25;
          }
          if (metadata.fullDescription.toLowerCase().includes(lowerQuery)) {
            score += 10;
          }
    
          if (score === 0) continue;
          entry.searchScore = score;
        }
    
        // Remove schema if not requested (token savings)
        if (!includeSchema) {
          // Create a copy without inputSchema for lighter response
          const lightEntry = { ...entry };
          delete (lightEntry as Record<string, unknown>)['inputSchema'];
          results.push(lightEntry as CatalogEntry);
        } else {
          results.push(entry);
        }
      }
    
      // Sort by search score if query provided, otherwise by name
      if (query) {
        results.sort((a, b) => (b.searchScore || 0) - (a.searchScore || 0));
      } else {
        results.sort((a, b) => a.name.localeCompare(b.name));
      }
    
      // Calculate category counts
      const categories: Record<ToolCategory, number> = {
        analysis: 0,
        adr: 0,
        'content-security': 0,
        research: 0,
        deployment: 0,
        memory: 0,
        'file-system': 0,
        rules: 0,
        workflow: 0,
        utility: 0,
      };
    
      for (const entry of results) {
        categories[entry.category]++;
      }
    
      // Apply limit
      const totalCount = results.length;
      if (limit && results.length > limit) {
        results = results.slice(0, limit);
      }
    
      const result: ToolSearchResult = {
        tools: results,
        totalCount,
        categories,
      };
    
      if (query !== undefined) {
        result.query = query;
      }
    
      return result;
    }
Behavior4/5

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

With no annotations provided, the description carries the full burden and does well by disclosing key behavioral traits: it 'returns lightweight tool metadata by default' and warns that 'includeSchema:true' increases token count. However, it doesn't mention rate limits, authentication needs, or pagination behavior, leaving some gaps for a search tool.

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 perfectly front-loaded and concise: two sentences with zero waste. The first sentence states the purpose and usage, the second explains the key behavioral detail about response modes. Every word earns its place without redundancy.

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

Completeness4/5

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

Given the tool's moderate complexity (6 parameters, no output schema, no annotations), the description is largely complete—it covers purpose, usage, and key behavior. However, it lacks details on output format (e.g., what 'lightweight tool metadata' includes) and error handling, which would help an agent interpret results more effectively.

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 the baseline is 3. The description adds minimal parameter semantics beyond the schema—it only mentions 'includeSchema:true for full schemas' and implies search by 'category, keyword, or capability,' which aligns with schema properties but doesn't provide additional context like search syntax or result ordering.

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 tool's purpose with specific verbs ('search and discover') and resource ('available tools'), and distinguishes it from siblings by explaining it helps 'find the right tool for a task without loading all tool schemas.' This explicitly differentiates it from other tools that perform specific operations rather than tool discovery.

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

Usage Guidelines5/5

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

The description provides explicit usage guidance: 'Use this to find the right tool for a task without loading all tool schemas' tells when to use it, and 'use includeSchema:true for full schemas' offers an alternative mode. It clearly positions this as a discovery tool versus the sibling tools that perform specific actions like analysis or file operations.

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/tosin2013/mcp-adr-analysis-server'

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