Skip to main content
Glama
cordlesssteve

Document Organizer MCP Server

discover_pdfs

Scan directories to find PDF files recursively, enabling systematic document organization and processing workflows.

Instructions

Recursively scan directory trees to locate all PDF files

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directory_pathYesPath to directory to scan for PDF files
recursiveNoSearch subdirectories recursively

Implementation Reference

  • Handler for the discover_pdfs tool: parses arguments, calls findPdfFiles utility, formats and returns JSON response with discovered PDF files list and statistics.
    case "document_organizer__discover_pdfs": {
      const { directory_path, recursive } = DiscoverPdfsArgsSchema.parse(args);
      const pdfFiles = await findPdfFiles(directory_path, recursive);
      
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify({
              found_pdfs: pdfFiles.length,
              pdf_files: pdfFiles,
              scanned_directory: directory_path,
              recursive_scan: recursive
            }, null, 2)
          }
        ]
      };
    }
  • Zod schema defining input parameters for the discover_pdfs tool: directory_path (required string) and recursive (optional boolean, defaults to true).
    const DiscoverPdfsArgsSchema = z.object({
      directory_path: z.string().describe("Path to directory to scan for PDF files"),
      recursive: z.boolean().optional().default(true).describe("Search subdirectories recursively")
    });
  • src/index.ts:1301-1305 (registration)
    Tool registration entry in the tools array, specifying name, description, and input schema reference.
      name: "document_organizer__discover_pdfs",
      description: "🔍 PDF FILE DISCOVERY - Recursively scan directory trees to locate all PDF files. Returns complete inventory with file paths, directory structure analysis, and scan statistics. Supports both recursive deep scanning and single-level directory inspection for comprehensive document discovery.",
      inputSchema: zodToJsonSchema(DiscoverPdfsArgsSchema) as ToolInput,
    },
    {
  • Core utility function that recursively scans the specified directory for PDF files using fs.readdir, collects absolute paths, handles errors gracefully.
    async function findPdfFiles(dirPath: string, recursive: boolean = true): Promise<string[]> {
      const pdfFiles: string[] = [];
      
      async function scanDirectory(currentPath: string) {
        try {
          const items = await fs.readdir(currentPath, { withFileTypes: true });
          
          for (const item of items) {
            const fullPath = path.join(currentPath, item.name);
            
            if (item.isFile() && path.extname(item.name).toLowerCase() === '.pdf') {
              pdfFiles.push(fullPath);
            } else if (item.isDirectory() && recursive) {
              await scanDirectory(fullPath);
            }
          }
        } catch (error) {
          console.error(`Error scanning directory ${currentPath}:`, error);
        }
      }
      
      await scanDirectory(dirPath);
      return pdfFiles;
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the recursive nature of scanning, which is useful context, but fails to address critical behavioral aspects such as performance implications for large directories, error handling for invalid paths, permission requirements, or what the output format looks like (e.g., list of paths, metadata).

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 front-loads the core functionality ('recursively scan directory trees') followed by the objective ('locate all PDF files'). There is zero wasted language, making it highly concise and well-structured for quick understanding.

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 complexity of a file system scanning tool with no annotations and no output schema, the description is incomplete. It lacks information on output format (e.g., list structure, error responses), performance considerations, and integration with sibling tools, leaving significant gaps for an AI agent to use it effectively in context.

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 fully documents both parameters ('directory_path' and 'recursive'). The description adds no additional parameter semantics beyond what's in the schema, such as path format examples or recursion depth limits, meeting the baseline for high schema coverage.

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 specific action ('recursively scan directory trees') and resource ('locate all PDF files'), providing a complete picture of what the tool does. It distinguishes itself from sibling tools like 'analyze_content' or 'convert_pdf' by focusing on discovery rather than analysis or conversion.

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 it's clear this tool finds PDFs, there's no mention of when to use it instead of sibling tools like 'check_conversions' or 'organize_structure', nor any prerequisites or context for its application.

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/cordlesssteve/document-organizer-mcp'

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