Skip to main content
Glama
jakedx6
by jakedx6

analyze_document_content

Analyze document content for readability, completeness, structure, and AI optimization to identify areas for improvement and provide actionable suggestions.

Instructions

Perform advanced analysis on document content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
document_idYesID of the document to analyze
analysis_typesNoTypes of analysis to perform
include_suggestionsNoWhether to include improvement suggestions

Implementation Reference

  • Main handler function for the analyze_document_content tool. Fetches document by ID, performs specified analyses (readability, completeness, etc.), generates suggestions if requested, computes overall score, and returns results.
    export const analyzeDocumentContent = requireAuth(async (args: any) => { const { document_id, analysis_types, include_suggestions } = AnalyzeDocumentContentSchema.parse(args) logger.info('Analyzing document content', { document_id, analysis_types }) const document = await supabaseService.getDocument(document_id) if (!document) { throw new Error('Document not found') } const analysis: any = { document_id, title: document.title, analyzed_at: new Date().toISOString(), results: {} } // Perform requested analyses for (const analysisType of analysis_types) { switch (analysisType) { case 'readability': analysis.results.readability = analyzeReadability(document.content) break case 'completeness': analysis.results.completeness = analyzeCompleteness(document) break case 'ai_optimization': analysis.results.ai_optimization = analyzeAIOptimization(document) break case 'link_analysis': analysis.results.link_analysis = analyzeLinkStructure(document.content) break case 'structure_analysis': analysis.results.structure_analysis = analyzeDocumentStructure(document.content) break } } // Generate improvement suggestions if (include_suggestions) { analysis.suggestions = generateImprovementSuggestions(analysis.results, document) } // Calculate overall score analysis.overall_score = calculateOverallDocumentScore(analysis.results) return analysis })
  • Zod schema for input validation of the analyze_document_content tool, defining document_id (required), analysis_types (array of enums, default), and include_suggestions (boolean, default true).
    const AnalyzeDocumentContentSchema = z.object({ document_id: z.string().min(1), analysis_types: z.array(z.enum(['readability', 'completeness', 'ai_optimization', 'link_analysis', 'structure_analysis'])).default(['readability', 'completeness']), include_suggestions: z.boolean().default(true) })
  • MCPTool registration defining the analyze_document_content tool with name, description, and input schema matching the Zod schema.
    export const analyzeDocumentContentTool: MCPTool = { name: 'analyze_document_content', description: 'Perform advanced analysis on document content', inputSchema: { type: 'object', properties: { document_id: { type: 'string', description: 'ID of the document to analyze' }, analysis_types: { type: 'array', items: { type: 'string', enum: ['readability', 'completeness', 'ai_optimization', 'link_analysis', 'structure_analysis'] }, default: ['readability', 'completeness'], description: 'Types of analysis to perform' }, include_suggestions: { type: 'boolean', default: true, description: 'Whether to include improvement suggestions' } }, required: ['document_id'] } }
  • Registration of the analyzeDocumentContent handler in the documentHandlers object, mapping 'analyze_document_content' to the handler function.
    export const documentHandlers = { list_documents: listDocuments, create_document: createDocument, get_document: getDocument, update_document: updateDocument, search_documents: searchDocuments, get_document_context: getDocumentContext, add_document_collaborator: addDocumentCollaborator, analyze_document_content: analyzeDocumentContent, get_document_collaboration: getDocumentCollaboration, generate_document_template: generateDocumentTemplate, bulk_document_operations: bulkDocumentOperations }
  • Export of all document tools including analyzeDocumentContentTool in the documentTools object.
    export const documentTools = { listDocumentsTool, createDocumentTool, getDocumentTool, updateDocumentTool, searchDocumentsTool, getDocumentContextTool, addDocumentCollaboratorTool, analyzeDocumentContentTool, getDocumentCollaborationTool, generateDocumentTemplateTool, bulkDocumentOperationsTool }

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/jakedx6/helios9-MCP-Server'

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