Skip to main content
Glama
Amana03

Universal MCP Server

by Amana03

search_files

Find files containing specific text within the Universal MCP Server to locate relevant documents or code snippets quickly.

Instructions

Search for files containing specific text

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesThe text to search for

Implementation Reference

  • Handler case for executing the 'search_files' MCP tool, extracts query from args, logs, calls storage.search, and returns formatted JSON results.
    case 'search_files': {
      const { query } = args as { query: string };
      
      logger.info('Tool request received', { 
        operation: 'tool:search',
        toolName: 'search_files',
        query,
        requestId 
      });
    
      const results = await storage.search(query, requestId);
    
      return {
        content: [{
          type: 'text',
          text: JSON.stringify({
            success: true,
            query,
            resultsCount: results.length,
            results: results.map(r => ({ key: r.key, preview: r.content.slice(0, 100) + '...' }))
          }, null, 2)
        }]
      };
    }
  • Handler case for executing the 'search_files' MCP tool (duplicate in multi-mode server), delegates to storage.search.
    case 'search_files': {
      const { query } = args as { query: string };
      
      logger.info('Tool request received', { 
        operation: 'tool:search',
        toolName: 'search_files',
        query,
        requestId 
      });
    
      const results = await storage.search(query, requestId);
    
      return {
        content: [{
          type: 'text',
          text: JSON.stringify({
            success: true,
            query,
            resultsCount: results.length,
            results: results.map(r => ({ key: r.key, preview: r.content.slice(0, 100) + '...' }))
          }, null, 2)
        }]
      };
    }
  • Schema definition for the 'search_files' tool returned in ListTools response, including inputSchema with required 'query' string.
    {
      name: 'search_files',
      description: 'Search for files containing specific text',
      inputSchema: {
        type: 'object',
        properties: {
          query: {
            type: 'string',
            description: 'The text to search for',
          },
        },
        required: ['query'],
      },
    },
  • Core implementation of file search in FileStorage class: lists all files, reads contents, checks for query match (case-insensitive), returns matching key-content pairs.
    async search(query: string, requestId: string): Promise<Array<{ key: string; content: string }>> {
      try {
        logger.debug('Searching files', { operation: 'search', query, requestId });
        
        const keys = await this.list(undefined, requestId);
        const results: Array<{ key: string; content: string }> = [];
    
        for (const key of keys) {
          const content = await this.read(key, requestId);
          if (content && content.toLowerCase().includes(query.toLowerCase())) {
            results.push({ key, content });
          }
        }
    
        logger.info('Search completed', { 
          operation: 'search', 
          query, 
          resultsCount: results.length,
          requestId 
        });
    
        return results;
      } catch (error) {
        logger.error('Failed to search files', error as Error, { operation: 'search', query, requestId });
        throw error;
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. The description only states what the tool does ('Search for files'), but doesn't disclose any behavioral traits like whether this is a read-only operation, what permissions are required, how results are returned (pagination, format), rate limits, or error conditions. For a search tool with zero annotation coverage, this is inadequate.

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 with zero wasted words. It's appropriately sized and front-loaded, 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.

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. While the purpose is clear, it doesn't provide enough context about behavioral aspects (permissions, result format, limitations) that would help an agent use the tool effectively. For a search operation with no structured metadata, the description should do more to compensate.

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 single parameter 'query' fully documented in the schema. The description adds no additional meaning about parameters beyond what the schema provides ('The text to search for'). According to the rules, when schema coverage is high (>80%), the baseline is 3 even with no param info in the description.

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 files') and target resource ('files containing specific text'), providing a specific verb+resource combination. However, it doesn't distinguish this tool from its sibling tools (delete_file, write_file), which are clearly different operations, so it doesn't reach the highest score for sibling differentiation.

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. While the purpose is clear, there's no mention of when-not-to-use scenarios or how this differs from other search operations that might exist in the broader context. The agent must infer usage from the tool name 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/Amana03/universal-mcp-server'

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