Skip to main content
Glama
eva-wanxin-git

Windows Automation MCP Server

search_files

Find files on Windows systems using wildcard patterns to locate documents, media, or data in specified directories.

Instructions

搜索文件(支持通配符)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directoryYes搜索目录
patternYes搜索模式(如 *.txt)

Implementation Reference

  • The handler function that executes the file search using Windows 'dir' command via child_process.execAsync to list files matching the pattern.
    async searchFiles(directory, pattern) {
      try {
        const { stdout } = await execAsync(
          `dir /s /b "${path.join(directory, pattern)}"`,
          { shell: 'cmd.exe' }
        );
        const files = stdout.trim().split('\n').filter(f => f);
        return { success: true, files, count: files.length };
      } catch (error) {
        return { success: false, error: error.message, files: [] };
      }
    }
  • Input schema definition for the 'search_files' tool, specifying required 'directory' and 'pattern' parameters.
    {
      name: 'search_files',
      description: '搜索文件(支持通配符)',
      inputSchema: {
        type: 'object',
        properties: {
          directory: { type: 'string', description: '搜索目录' },
          pattern: { type: 'string', description: '搜索模式(如 *.txt)' },
        },
        required: ['directory', 'pattern'],
      },
    },
  • The executeTool method dispatches 'search_files' calls to the searchFiles handler via switch case.
    async executeTool(name, args) {
      switch (name) {
        case 'read_file':
          return await this.readFile(args.path);
        case 'write_file':
          return await this.writeFile(args.path, args.content);
        case 'list_directory':
          return await this.listDirectory(args.path);
        case 'create_directory':
          return await this.createDirectory(args.path);
        case 'delete_file':
          return await this.deleteFile(args.path);
        case 'copy_file':
          return await this.copyFile(args.source, args.destination);
        case 'move_file':
          return await this.moveFile(args.source, args.destination);
        case 'search_files':
          return await this.searchFiles(args.directory, args.pattern);
        default:
          throw new Error(`未知工具: ${name}`);
      }
    }
  • The canHandle method checks if the tool module handles 'search_files' by including it in the tools array.
    canHandle(toolName) {
      const tools = ['read_file', 'write_file', 'list_directory', 'create_directory', 
                     'delete_file', 'copy_file', 'move_file', 'search_files'];
      return tools.includes(toolName);
    }
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. It mentions wildcard support, which adds some behavioral context beyond basic searching. However, it fails to disclose critical traits: whether it's read-only or has side effects, error handling, performance implications, or output format. For a search tool with zero annotation coverage, this is a significant gap.

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 extremely concise at '搜索文件(支持通配符)' (Search files (supports wildcards)). It's front-loaded with the core purpose and includes essential behavioral detail in parentheses. Every word earns its place with zero waste.

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 no annotations and no output schema, the description is incomplete for a search tool. It doesn't explain what the tool returns (e.g., file list, paths, metadata), error conditions, or limitations. The complexity is moderate (2 parameters), but the description lacks necessary context for effective use.

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 both parameters (directory, pattern) well-documented in the schema. The description adds minimal value beyond the schema by implying wildcard usage in the pattern parameter. Baseline is 3 since the schema does the heavy lifting, and the description doesn't provide additional syntax or format details.

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 as searching files with wildcard support. It specifies the verb ('搜索') and resource ('文件'), distinguishing it from siblings like list_directory (which lists without search) or read_file (which reads content). However, it doesn't explicitly differentiate from other potential search tools, though none exist in the sibling list.

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 prerequisites (e.g., needing an existing directory), exclusions, or comparisons to similar tools like list_directory for basic listing. Usage is implied by the action but lacks explicit context.

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/eva-wanxin-git/windows-automation-mcp'

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