mcp-office-tools/test_pagination.py
Ryan Malloy 31948d6ffc
Some checks are pending
Test Dashboard / test-and-dashboard (push) Waiting to run
Rename package to mcwaddams
Named for Milton Waddams, who was relocated to the basement with
boxes of legacy documents. He handles the .doc and .xls files from
1997 that nobody else wants to touch.

- Rename package from mcp-office-tools to mcwaddams
- Update author to Ryan Malloy
- Update all imports and references
- Add Office Space themed README narrative
- All 53 tests passing
2026-01-11 11:35:35 -07:00

64 lines
2.3 KiB
Python

#!/usr/bin/env python3
"""Test pagination system for MCP Office Tools convert_to_markdown."""
import inspect
import sys
def test_pagination():
"""Test the pagination system integration."""
print("🔧 Testing MCP Office Tools Pagination Integration")
print("=" * 60)
try:
# Import the server components
from mcwaddams.server import app
from mcwaddams.mixins.word import WordMixin
from mcwaddams.pagination import DocumentPaginationManager, paginate_document_conversion
print("✅ Successfully imported all pagination components:")
print(" • DocumentPaginationManager")
print(" • paginate_document_conversion")
print(" • WordMixin with pagination")
# Check if WordMixin has the convert_to_markdown method
word_mixin = WordMixin()
convert_method = getattr(word_mixin, 'convert_to_markdown', None)
if convert_method:
print("✅ Found convert_to_markdown method")
# Check method signature for pagination parameters
sig = inspect.signature(convert_method)
pagination_params = []
for param_name, param in sig.parameters.items():
if param_name in ['limit', 'cursor_id', 'session_id', 'return_all']:
pagination_params.append(param_name)
print(f"✅ Pagination parameters found: {', '.join(pagination_params)}")
else:
print("❌ convert_to_markdown method not found")
return False
print("\n🎯 Pagination System Integration Complete!")
print("📊 Features:")
print(" • Automatic large document detection (>25k tokens)")
print(" • Cursor-based navigation through document sections")
print(" • Session-isolated pagination state")
print(" • Configurable page sizes and limits")
print(" • Bypass option for small documents")
print(" • Token estimation and response size management")
return True
except ImportError as e:
print(f"❌ Import error: {e}")
return False
except Exception as e:
print(f"❌ Unexpected error: {e}")
return False
if __name__ == "__main__":
success = test_pagination()
sys.exit(0 if success else 1)