Skip to main content
Glama
cordlesssteve

Document Organizer MCP Server

analyze_content

Analyze markdown files to automatically determine document categories based on content, enabling systematic organization and workflow management.

Instructions

Analyze markdown files to automatically determine document categories

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directory_pathYesPath to directory containing markdown files

Implementation Reference

  • Handler for the 'document_organizer__analyze_content' tool (matches 'analyze_content'). Parses input, recursively finds .md files if not specified, calls analyzeMarkdownContent on each, categorizes by content analysis, returns JSON with breakdown and details.
    case "document_organizer__analyze_content": {
      const { directory_path, md_files } = AnalyzeContentArgsSchema.parse(args);
      let markdownFiles = md_files;
      
      if (!markdownFiles) {
        // Find all markdown files
        markdownFiles = [];
        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') {
              markdownFiles!.push(fullPath);
            } else if (item.isDirectory()) {
              await findMdFiles(fullPath);
            }
          }
        }
        await findMdFiles(directory_path);
      }
      
      const analyses = [];
      for (const mdPath of markdownFiles) {
        const analysis = await analyzeMarkdownContent(mdPath);
        analyses.push({
          file_path: mdPath,
          ...analysis
        });
      }
      
      // Group by category
      const categorized = analyses.reduce((acc, analysis) => {
        if (!acc[analysis.category]) {
          acc[analysis.category] = [];
        }
        acc[analysis.category].push(analysis.file_path);
        return acc;
      }, {} as Record<string, string[]>);
      
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify({
              total_files: analyses.length,
              categorized_breakdown: categorized,
              detailed_analysis: analyses
            }, null, 2)
          }
        ]
      };
    }
  • Zod schema defining input parameters for the analyze_content tool: directory_path (required) and optional md_files array.
    const AnalyzeContentArgsSchema = z.object({
      directory_path: z.string().describe("Path to directory containing markdown files"),
      md_files: z.array(z.string()).optional().describe("Specific MD files to analyze (if not provided, analyzes all)")
    });
  • src/index.ts:1316-1319 (registration)
    Tool registration in the tools array, with name 'document_organizer__analyze_content', description, and inputSchema referencing AnalyzeContentArgsSchema.
      name: "document_organizer__analyze_content",
      description: "📊 INTELLIGENT DOCUMENT CATEGORIZATION - Analyze markdown files to automatically determine document categories using keyword-based content analysis. Scans document content and classifies into categories: Research, Planning, Documentation, Technical, Business, or General. Returns category assignments with confidence scores and detected keywords for organizational decision making.",
      inputSchema: zodToJsonSchema(AnalyzeContentArgsSchema) as ToolInput,
    },
  • Helper function analyzeMarkdownContent that performs keyword-based categorization on individual markdown files, returning category, confidence score, and matched keywords. Used by the tool handler.
    async function analyzeMarkdownContent(mdPath: string): Promise<{ category: string; confidence: number; keywords: string[] }> {
      try {
        const content = await fs.readFile(mdPath, 'utf-8');
        const firstPart = content.slice(0, 2000).toLowerCase();
        
        // Simple categorization based on content analysis
        const categories = {
          'Research': ['analysis', 'research', 'study', 'investigation', 'findings', 'methodology'],
          'Planning': ['plan', 'strategy', 'roadmap', 'timeline', 'goals', 'objectives', 'discussion'],
          'Documentation': ['documentation', 'guide', 'manual', 'instructions', 'tutorial', 'reference'],
          'Technical': ['technical', 'implementation', 'architecture', 'design', 'specification', 'api'],
          'Business': ['business', 'market', 'competitive', 'revenue', 'commercial', 'strategy']
        };
        
        let bestCategory = 'General';
        let bestScore = 0;
        const foundKeywords: string[] = [];
        
        for (const [category, keywords] of Object.entries(categories)) {
          let score = 0;
          for (const keyword of keywords) {
            if (firstPart.includes(keyword)) {
              score++;
              foundKeywords.push(keyword);
            }
          }
          
          if (score > bestScore) {
            bestScore = score;
            bestCategory = category;
          }
        }
        
        const confidence = Math.min(bestScore / 3, 1.0); // Normalize to 0-1
        
        return {
          category: bestCategory,
          confidence,
          keywords: foundKeywords
        };
      } catch (error) {
        return {
          category: 'General',
          confidence: 0,
          keywords: []
        };
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool analyzes files to determine categories but doesn't describe how it behaves—e.g., whether it modifies files, requires specific permissions, handles errors, or returns results. For a tool with zero annotation coverage, this is a significant gap in transparency.

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 directly states the tool's purpose without unnecessary words. It is front-loaded and appropriately sized, making it easy to understand quickly. Every part of the sentence contributes to clarifying the tool's function.

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 analyzing files and determining categories, the description is incomplete. No annotations are provided, and there's no output schema, so the tool's behavior and return values are undocumented. The description doesn't address how results are presented, error handling, or operational constraints, leaving significant gaps for an AI agent to use it effectively.

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 one parameter ('directory_path') fully documented in the schema. The description adds no additional parameter semantics beyond what the schema provides, such as format details or constraints. With high schema coverage, the baseline score of 3 is appropriate as the description doesn't compensate but doesn't detract either.

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: 'Analyze markdown files to automatically determine document categories.' It specifies the verb ('analyze'), resource ('markdown files'), and outcome ('determine document categories'). However, it doesn't explicitly differentiate from sibling tools like 'organize_structure' or 'full_workflow', which might have overlapping functionality.

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, exclusions, or compare it to sibling tools such as 'organize_structure' or 'full_workflow'. Usage is implied by the purpose but lacks explicit context for selection.

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