Skip to main content
Glama
cordlesssteve

Document Organizer MCP Server

full_workflow

Organize documents automatically by converting PDFs to Markdown, categorizing content, and managing workflows in a specified directory.

Instructions

Execute end-to-end document organization pipeline

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directory_pathYesPath to directory to organize completely

Implementation Reference

  • Main execution handler for the 'document_organizer__full_workflow' tool. Orchestrates the complete document processing pipeline: PDF discovery, conversion status check, selective PDF-to-Markdown conversion of missing files, optional content analysis for categorization, and comprehensive workflow reporting.
    case "document_organizer__full_workflow": {
      const { directory_path, analyze_content } = FullWorkflowArgsSchema.parse(args);
      
      const workflow = [];
      
      // Step 1: Discover PDFs
      const pdfFiles = await findPdfFiles(directory_path);
      workflow.push({ step: "discover", found_pdfs: pdfFiles.length });
      
      // Step 2: Check conversions
      const conversionStatus = [];
      for (const pdfPath of pdfFiles) {
        const hasMarkdown = await checkMdExists(pdfPath);
        conversionStatus.push({
          pdf_path: pdfPath,
          has_markdown: hasMarkdown,
          needs_conversion: !hasMarkdown
        });
      }
      workflow.push({ 
        step: "check_conversions", 
        needs_conversion: conversionStatus.filter(s => s.needs_conversion).length 
      });
      
      // Step 3: Convert missing
      const conversions = [];
      for (const status of conversionStatus) {
        if (status.needs_conversion) {
          const result = await convertPdfToMd(status.pdf_path);
          conversions.push({ pdf_path: status.pdf_path, ...result });
        }
      }
      workflow.push({ 
        step: "convert_missing", 
        conversions_attempted: conversions.length,
        successful: conversions.filter(c => c.success).length
      });
      
      // Step 4: Analyze content (if requested)
      let categorization = {};
      if (analyze_content) {
        // Find all markdown files after conversion
        const allMdFiles: string[] = [];
        async function findMdFiles(dir: string) {
          const items = await fs.readdir(dir, { withFileTypes: true });
          for (const item of items) {
            const fullPath = path.join(dir, item.name);
            if (item.isFile() && path.extname(item.name).toLowerCase() === '.md') {
              allMdFiles.push(fullPath);
            } else if (item.isDirectory()) {
              await findMdFiles(fullPath);
            }
          }
        }
        await findMdFiles(directory_path);
        
        const analyses = [];
        for (const mdPath of allMdFiles) {
          const analysis = await analyzeMarkdownContent(mdPath);
          analyses.push({ file_path: mdPath, ...analysis });
        }
        
        categorization = analyses.reduce((acc, analysis) => {
          if (!acc[analysis.category]) {
            acc[analysis.category] = [];
          }
          acc[analysis.category].push(analysis.file_path);
          return acc;
        }, {} as Record<string, string[]>);
        
        workflow.push({ 
          step: "analyze_content", 
          files_analyzed: analyses.length,
          categories_identified: Object.keys(categorization).length
        });
      }
      
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify({
              workflow_completed: true,
              steps: workflow,
              final_categorization: categorization,
              summary: {
                pdfs_found: pdfFiles.length,
                conversions_needed: conversions.length,
                successful_conversions: conversions.filter(c => c.success).length,
                categories_suggested: Object.keys(categorization).length
              }
            }, null, 2)
          }
        ]
      };
    }
  • Zod schema defining input parameters for the full_workflow tool: directory_path (required string) and analyze_content (optional boolean, default true).
    const FullWorkflowArgsSchema = z.object({
      directory_path: z.string().describe("Path to directory to organize completely"),
      analyze_content: z.boolean().optional().default(true).describe("Analyze content for categorization")
    });
  • src/index.ts:1326-1330 (registration)
    Tool registration entry in the tools array, including name, description, and inputSchema reference to FullWorkflowArgsSchema. Registered with the MCP server via setRequestHandler for ListToolsRequestSchema.
      name: "document_organizer__full_workflow",
      description: "🔄 COMPLETE DOCUMENT AUTOMATION - Execute end-to-end document organization pipeline: (1) Discover all PDFs recursively, (2) Check conversion status, (3) Convert missing PDFs to Markdown, (4) Analyze content for categorization, (5) Create organized folder structure. Returns detailed workflow progress with success/failure counts, processing statistics, and final organization summary. One-command solution for complete document management.",
      inputSchema: zodToJsonSchema(FullWorkflowArgsSchema) as ToolInput,
    },
    {
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 states the tool executes a pipeline but doesn't reveal what that entails—whether it's read-only or destructive, if it requires specific permissions, what side effects occur, or how it handles errors. This leaves significant gaps for a tool named 'full_workflow'.

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 action ('Execute end-to-end document organization pipeline') with zero wasted words. It's appropriately sized for a tool with one parameter and clear scope.

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 implied by 'full_workflow' and the lack of annotations and output schema, the description is incomplete. It doesn't explain what the pipeline does, what it returns, or how it differs from siblings, leaving the agent with insufficient context for safe and 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 the parameter 'directory_path' documented as 'Path to directory to organize completely'. The description adds no additional meaning beyond this, such as format examples or constraints, so it meets the baseline of 3 where the schema does the heavy lifting.

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 verb 'execute' and the resource 'end-to-end document organization pipeline', providing a specific purpose. However, it doesn't explicitly distinguish this comprehensive pipeline from sibling tools like 'organize_structure' or 'init_project_docs', which might handle more specific aspects of document organization.

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 offers no guidance on when to use this tool versus alternatives like 'organize_structure' or 'init_project_docs'. It implies usage for complete directory organization but lacks explicit when/when-not instructions or prerequisites, leaving the agent to infer context from tool names 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/cordlesssteve/document-organizer-mcp'

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