Skip to main content
Glama
cordlesssteve

Document Organizer MCP Server

organize_structure

Create hierarchical directory structures and move files to appropriate locations based on user-defined categories and file patterns for systematic document organization.

Instructions

Create hierarchical directory structure and move files to appropriate locations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoriesYesCategories with their associated file patterns/names
directory_pathYesPath to directory to organize

Implementation Reference

  • The main handler function for the 'document_organizer__organize_structure' tool. It parses input arguments, iterates over provided categories, creates category directories (with optional PDFs/MDs subfolders), and returns a JSON summary of the created structure. Note: It prepares the folder structure but does not actually move files based on patterns.
    case "document_organizer__organize_structure": {
      const { directory_path, categories, create_pdf_md_subfolders } = OrganizeStructureArgsSchema.parse(args);
      
      const results = [];
      
      for (const [categoryName, filePatterns] of Object.entries(categories)) {
        const categoryPath = path.join(directory_path, categoryName);
        
        // Create category directory
        await fs.mkdir(categoryPath, { recursive: true });
        
        if (create_pdf_md_subfolders) {
          const pdfDir = path.join(categoryPath, 'PDFs');
          const mdDir = path.join(categoryPath, 'MDs');
          await fs.mkdir(pdfDir, { recursive: true });
          await fs.mkdir(mdDir, { recursive: true });
        }
        
        results.push({
          category: categoryName,
          path: categoryPath,
          files_to_organize: filePatterns.length,
          subfolders_created: create_pdf_md_subfolders
        });
      }
      
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify({
              categories_created: results.length,
              organization_results: results
            }, null, 2)
          }
        ]
      };
    }
  • Zod schema defining the input parameters for the organize_structure tool: directory_path (string), categories (record of string arrays for file patterns), create_pdf_md_subfolders (boolean, default true).
    const OrganizeStructureArgsSchema = z.object({
      directory_path: z.string().describe("Path to directory to organize"),
      categories: z.record(z.array(z.string())).describe("Categories with their associated file patterns/names"),
      create_pdf_md_subfolders: z.boolean().optional().default(true).describe("Create PDFs and MDs subfolders in each category")
    });
  • src/index.ts:1321-1324 (registration)
    Tool registration object in the tools array, defining the name 'document_organizer__organize_structure', its description, and linking to the OrganizeStructureArgsSchema.
      name: "document_organizer__organize_structure",
      description: "🏗️ AUTOMATED FOLDER ORGANIZATION - Create hierarchical directory structure based on document categories and automatically move files to appropriate locations. Creates category-specific folders with optional PDF/MD subfolders, then relocates documents based on provided category mappings. Supports both flat and nested organization patterns for efficient document management.",
      inputSchema: zodToJsonSchema(OrganizeStructureArgsSchema) 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 performs file movement and directory creation, implying mutation operations, but doesn't address critical behaviors like permission requirements, error handling, whether changes are reversible, or side effects on existing files. This leaves significant gaps for a tool that modifies file systems.

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 with zero waste. It front-loads the core purpose and uses clear, direct language without redundancy or unnecessary elaboration.

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 complexity (file system mutations, nested object parameters) and lack of annotations or output schema, the description is insufficient. It doesn't explain what 'appropriate locations' means, how file patterns work, what happens to unmatched files, or what the tool returns. For a mutation tool with behavioral risks, this leaves too many unknowns.

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 ('categories' and 'directory_path'). The description adds no additional parameter semantics beyond what the schema provides, such as explaining the structure of 'categories' or providing examples. Baseline 3 is appropriate when 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 tool's purpose with specific verbs ('create hierarchical directory structure' and 'move files to appropriate locations') and identifies the resource (files/directories). It doesn't explicitly differentiate from sibling tools like 'analyze_content' or 'discover_pdfs', but the purpose is unambiguous for file organization tasks.

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, constraints, or compare it to sibling tools like 'full_workflow' or 'init_project_docs'. The agent must infer usage from the purpose 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