Ryan Malloy 76c7a0b2d0 Add decorators for field defaults and error handling, fix Excel performance
- Create @resolve_field_defaults decorator to handle Pydantic FieldInfo
  objects when tools are called directly (outside MCP framework)
- Create @handle_office_errors decorator for consistent error wrapping
- Apply decorators to Excel and Word mixins, removing ~100 lines of
  boilerplate code
- Fix Excel formula extraction performance: load workbooks once before
  loop instead of per-cell (100x faster with calculated values)
- Update test suite to use correct mock patch paths (patch where names
  are looked up, not where defined)
- Add torture_test.py for real document validation
2026-01-10 23:51:30 -07:00

53 lines
987 B
Python

"""Utility modules for MCP Office Tools."""
from .validation import (
OfficeFileError,
validate_office_file,
validate_office_path,
get_supported_extensions,
get_format_info,
detect_file_format,
is_url,
download_office_file
)
from .file_detection import (
detect_format,
classify_document_type
)
from .caching import (
OfficeFileCache,
get_cache,
resolve_office_file_path
)
from .decorators import (
resolve_field_defaults,
handle_office_errors
)
__all__ = [
# Validation
"OfficeFileError",
"validate_office_file",
"validate_office_path",
"get_supported_extensions",
"get_format_info",
"detect_file_format",
"is_url",
"download_office_file",
# File detection
"detect_format",
"classify_document_type",
# Caching
"OfficeFileCache",
"get_cache",
"resolve_office_file_path",
# Decorators
"resolve_field_defaults",
"handle_office_errors"
]