Skip to main content
Glama
cordlesssteve

Document Organizer MCP Server

check_conversions

Analyze PDF files in a directory to identify which documents have been converted to Markdown format and detect any pending conversions.

Instructions

Analyze PDF collection to determine conversion status

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directory_pathYesPath to directory containing PDF files

Implementation Reference

  • Main handler logic for 'document_organizer__check_conversions' tool. Parses input, discovers PDFs if needed, checks for existing Markdown companions, computes statistics, and returns detailed JSON status report.
    case "document_organizer__check_conversions": {
      const { directory_path, pdf_files } = CheckConversionsArgsSchema.parse(args);
      const pdfsToCheck = pdf_files || await findPdfFiles(directory_path);
      
      const conversionStatus = [];
      for (const pdfPath of pdfsToCheck) {
        const hasMarkdown = await checkMdExists(pdfPath);
        conversionStatus.push({
          pdf_path: pdfPath,
          has_markdown: hasMarkdown,
          needs_conversion: !hasMarkdown
        });
      }
      
      return {
        content: [
          {
            type: "text", 
            text: JSON.stringify({
              total_pdfs: conversionStatus.length,
              already_converted: conversionStatus.filter(s => s.has_markdown).length,
              needs_conversion: conversionStatus.filter(s => s.needs_conversion).length,
              conversion_status: conversionStatus
            }, null, 2)
          }
        ]
      };
    }
  • Zod schema defining input parameters for the check_conversions tool: directory_path (required) and optional pdf_files array.
    const CheckConversionsArgsSchema = z.object({
      directory_path: z.string().describe("Path to directory containing PDF files"),
      pdf_files: z.array(z.string()).optional().describe("Specific PDF files to check (if not provided, discovers all)")
    });
  • src/index.ts:1306-1309 (registration)
    Tool registration in the tools array, including name, description, and inputSchema reference.
      name: "document_organizer__check_conversions", 
      description: "✅ CONVERSION STATUS AUDIT - Analyze PDF collection to determine which files already have companion Markdown files. Returns detailed conversion status matrix showing converted vs. unconverted documents, enabling targeted conversion workflows and avoiding duplicate processing.",
      inputSchema: zodToJsonSchema(CheckConversionsArgsSchema) as ToolInput,
    },
  • Helper function that checks if a Markdown file companion exists for a given PDF, trying multiple naming conventions.
    async function checkMdExists(pdfPath: string): Promise<boolean> {
      const dir = path.dirname(pdfPath);
      const basename = path.basename(pdfPath, '.pdf');
      
      // Check various possible MD naming patterns
      const possibleMdPaths = [
        path.join(dir, `${basename}.md`),
        path.join(dir, `${basename.replace(/\s+/g, '_')}.md`),
        path.join(dir, `${basename.replace(/[^a-zA-Z0-9]/g, '_')}.md`)
      ];
      
      for (const mdPath of possibleMdPaths) {
        try {
          await fs.access(mdPath);
          return true;
        } catch {
          // File doesn't exist, continue checking
        }
      }
      
      return false;
    }
  • Helper function to recursively find all PDF files in a directory, used when pdf_files not provided.
    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 full burden for behavioral disclosure. It mentions analysis but doesn't describe what the tool actually does (e.g., scans files, checks metadata, returns a report), whether it modifies files, requires specific permissions, or has any side effects. This leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words. It's appropriately sized for a simple tool, though it could be more front-loaded with key details to improve 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 lack of annotations and output schema, the description is incomplete. It doesn't explain what 'conversion status' entails, what the analysis outputs (e.g., a list, report, or status codes), or how it integrates with sibling tools, leaving the agent with insufficient 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%, so the schema already documents the 'directory_path' parameter fully. The description doesn't add any meaning beyond what the schema provides (e.g., it doesn't specify expected file formats, directory structure, or analysis scope), resulting in the baseline score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the action ('analyze PDF collection') and outcome ('determine conversion status'), which gives a general purpose. However, it doesn't specify what 'conversion status' means or how this differs from sibling tools like 'convert_missing' or 'discover_pdfs', making it somewhat vague.

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?

No guidance is provided on when to use this tool versus alternatives like 'discover_pdfs' or 'convert_missing'. The description implies it analyzes PDFs for conversion status, but doesn't clarify if this is for pre-conversion assessment, post-conversion verification, or another 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/cordlesssteve/document-organizer-mcp'

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