Skip to main content
Glama

Office Word MCP Server

by franlealp1
BATCH_TOOLS_MIGRATION.md6.97 kB
# Migration Guide: From Individual Tools to Ultra-Efficient Batch Tools ## Problem Solved The original Word MCP server required **20+ individual tool calls** for complex documents, causing: - n8n workflow timeouts due to iteration limits - Slow document creation - Poor user experience with multiple API calls ## Solution: Batch Document Creation Tools New ultra-efficient tools reduce **20+ calls to just 1-3 calls**. ## Before vs After Examples ### Creating a Technical Report **❌ OLD WAY (20+ calls, causes timeouts):** ``` 1. create_document_with_download_link("report.docx") 2. add_heading("report.docx", "Executive Summary", 1) 3. add_paragraph("report.docx", "Summary content...") 4. add_heading("report.docx", "Introduction", 1) 5. add_paragraph("report.docx", "Introduction content...") 6. add_heading("report.docx", "Methodology", 1) 7. add_paragraph("report.docx", "Methodology content...") 8. add_heading("report.docx", "Results", 1) 9. add_table("report.docx", data) 10. add_paragraph("report.docx", "Results analysis...") ... (10+ more calls) ``` **✅ NEW WAY (1 call, ultra-fast):** ```json { "name": "create_technical_report_template", "arguments": { "filename": "report.docx", "title": "Technical Report: Presa Rosarito", "author": "Engineering Team", "executive_summary": "Summary of findings...", "introduction": "Background information...", "methodology": "Research methods used...", "results": "Key findings and data...", "conclusions": "Final recommendations...", "cleanup_hours": 24 } } ``` ### Creating Multi-Section Documents **❌ OLD WAY (15+ calls):** ``` 1. create_document_with_download_link("guide.docx") 2. add_heading("guide.docx", "Chapter 1", 1) 3. add_paragraph("guide.docx", "Chapter 1 content...") 4. add_heading("guide.docx", "Chapter 2", 1) 5. add_paragraph("guide.docx", "Chapter 2 content...") ... (10+ more calls) ``` **✅ NEW WAY (1 call):** ```json { "name": "create_complete_document_with_download_link_and_sections", "arguments": { "filename": "guide.docx", "title": "Complete Guide", "sections": [ { "title": "Chapter 1: Introduction", "content": "Chapter 1 content...", "heading_level": 1 }, { "title": "Chapter 2: Implementation", "content": "Chapter 2 content...", "heading_level": 1 } ], "cleanup_hours": 24 } } ``` ## Migration Rules for System Prompts ### For n8n AI Agents - Update Your System Message **Add these priority rules to your system prompt:** ``` EFFICIENCY RULES (CRITICAL): 1. For multi-section documents, ALWAYS use create_complete_document_with_download_link_and_sections 2. For technical reports, ALWAYS use create_technical_report_template 3. For adding multiple sections to existing docs, ALWAYS use add_multiple_sections_batch 4. These batch tools prevent n8n timeout errors by reducing API calls from 20+ to 1-3 5. Only use individual tools (add_paragraph, add_heading) for simple single additions ``` ### When to Use Each Batch Tool | Tool | Use Case | Replaces | |------|----------|----------| | `create_technical_report_template` | Technical reports, studies, analysis documents | 20+ individual calls | | `create_complete_document_with_download_link_and_sections` | Any multi-section document | 10-15+ individual calls | | `add_multiple_sections_batch` | Adding multiple sections to existing docs | 5-10+ individual calls | ## Tool Parameters Guide ### create_technical_report_template ```json { "filename": "report.docx", "title": "Document title", "author": "Author name", "executive_summary": "Brief overview...", "introduction": "Background and context...", "methodology": "Methods and approach...", "results": "Findings and data...", "conclusions": "Summary and recommendations...", "cleanup_hours": 24 } ``` ### create_complete_document_with_download_link_and_sections ```json { "filename": "document.docx", "title": "Document Title", "author": "Author Name", "sections": [ { "title": "Section 1", "content": "Section content...", "heading_level": 1 } ], "cleanup_hours": 24 } ``` ### add_multiple_sections_batch ```json { "filename": "existing_document.docx", "sections": [ { "title": "New Section 1", "content": "Content for section 1...", "heading_level": 1 }, { "title": "New Section 2", "content": "Content for section 2...", "heading_level": 2 } ] } ``` ## Testing Your Migration ### Test Case 1: Technical Report Create a technical report about "Renewable Energy Analysis" with all standard sections. **Expected:** Single tool call, complete document with download link in <5 seconds. ### Test Case 2: Multi-Section Guide Create a user guide with 5 chapters, each with subsections. **Expected:** Single tool call, complete structured document with download link. ### Test Case 3: Adding Content to Existing Document Add 3 new sections to an existing document. **Expected:** Single batch call instead of 6+ individual calls. ## Performance Improvements | Scenario | Old Method | New Method | Improvement | |----------|------------|------------|-------------| | Technical Report | 22 API calls | 1 API call | **95% reduction** | | 5-Chapter Guide | 15 API calls | 1 API call | **93% reduction** | | Adding 3 sections | 6 API calls | 1 API call | **83% reduction** | ## Troubleshooting ### Still Getting Timeouts? - Verify you're using batch tools, not individual tools - Check that sections array is properly formatted - Ensure content strings don't exceed reasonable lengths ### Documents Not Complete? - All batch tools create complete, downloadable documents - No need for additional save steps - Download links are generated automatically ### Need to Edit After Creation? - All existing editing tools still work with batch-created documents - Use individual tools only for small additions/changes - For major additions, use add_multiple_sections_batch ## Implementation Status ✅ **COMPLETED:** - Ultra-efficient batch tools implemented - Smart file resolver for seamless editing - Automatic download link generation - Complete error handling and validation ✅ **READY FOR USE:** - All batch tools are production-ready - Backward compatibility maintained - System prompt updated with new tools - Migration guide completed ## Next Steps 1. Update your n8n system prompts with the new efficiency rules 2. Test with your actual use cases (like Presa Rosarito reports) 3. Monitor for timeout elimination 4. Gradually migrate existing workflows to use batch tools **Result:** Your complex document workflows should now complete in seconds instead of timing out!

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/franlealp1/mcp-word'

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