Skip to main content
Glama

finder_search_files

Search for files by name in macOS Finder to locate documents, media, or applications using AppleScript automation.

Instructions

[Finder and file operations] Search for files by name

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch term
locationNoSearch location (default: home folder)~

Implementation Reference

  • Handler function for the 'search_files' script (registered as 'finder_search_files'). Generates AppleScript that searches for files whose name contains the query in the hardcoded '/Users/joshrutkowski/Downloads' folder and returns their POSIX paths.
    script: (args) => `
      set searchPath to "/Users/joshrutkowski/Downloads"
      tell application "Finder"
        try
          set theFolder to POSIX file searchPath as alias
          set theFiles to every file of folder theFolder whose name contains "${args.query}"
          set resultList to ""
          repeat with aFile in theFiles
            set resultList to resultList & (POSIX path of (aFile as alias)) & return
          end repeat
          if resultList is "" then
            return "No files found matching '${args.query}'"
          end if
          return resultList
        on error errMsg
          return "Failed to search files: " & errMsg
        end try
      end tell
    `,
  • JSON Schema defining the input parameters for the finder_search_files tool: required 'query' string and optional 'location' string (note: location is defined but not used in the handler).
    schema: {
      type: "object",
      properties: {
        query: {
          type: "string",
          description: "Search term",
        },
        location: {
          type: "string",
          description: "Search location (default: home folder)",
          default: "~",
        },
      },
      required: ["query"],
    },
  • In the ListTools handler, tools are dynamically registered by flattening category scripts and naming them as '{category}_{script}', creating 'finder_search_files' from finder.search_files.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: this.categories.flatMap((category) =>
        category.scripts.map((script) => ({
          name: `${category.name}_${script.name}`, // Changed from dot to underscore
          description: `[${category.description}] ${script.description}`,
          inputSchema: script.schema || {
            type: "object",
            properties: {},
          },
        })),
      ),
    }));
  • Generic tool execution handler locates the 'finder' category and 'search_files' script from tool name 'finder_search_files'.
    const category = this.categories.find((c) => c.name === categoryName);
    if (!category) {
      this.log("warning", "Category not found", { categoryName });
      throw new McpError(
        ErrorCode.MethodNotFound,
        `Category not found: ${categoryName}`,
      );
    }
    
    const script = category.scripts.find((s) => s.name === scriptName);
    if (!script) {
  • src/index.ts:27-27 (registration)
    Registers the finder category (containing search_files) with the MCP server framework.
    server.addCategory(finderCategory);
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 states the basic function but lacks critical details: it doesn't specify what happens if no files are found, whether the search is recursive, what file attributes are returned, or if there are any limitations (e.g., search depth, file types). For a search tool with zero annotation coverage, this leaves significant gaps.

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—a single, efficient sentence that directly states the tool's function. It's front-loaded with the core purpose and wastes no words. This is an excellent example of brevity without sacrificing clarity.

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 tool's moderate complexity (search operation with 2 parameters), no annotations, and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., file paths, metadata), error conditions, or behavioral nuances. For a search tool, this leaves the agent guessing about the output format and operational details.

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 schema already documents both parameters (query and location) with descriptions. The description adds no additional parameter semantics beyond what's in the schema. The baseline score of 3 reflects adequate coverage by the schema alone, with no extra value from 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 tool's purpose as searching for files by name, specifying both the verb ('Search') and resource ('files'). It distinguishes from some siblings like finder_get_selected_files (which retrieves selected files) but doesn't explicitly differentiate from notes_search or messages_search_messages, which are similar search operations in different domains.

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 when to prefer this over other search tools (like notes_search) or when to use it in conjunction with other file operations (like finder_get_selected_files). There's no context about prerequisites or typical use cases.

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/joshrutkowski/applescript-mcp'

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