Coverage for src/qdrant_loader_mcp_server/mcp/formatters/__init__.py: 100%
43 statements
« prev ^ index » next coverage.py v7.15.0, created at 2026-07-20 10:15 +0000
« prev ^ index » next coverage.py v7.15.0, created at 2026-07-20 10:15 +0000
1"""
2MCP Formatters Package - Modular Response Formatting.
4This package provides comprehensive MCP response formatting through modular components:
5- basic: Basic search result and attachment formatting
6- intelligence: Analysis and intelligence result formatting
7- lightweight: Efficient lightweight result construction
8- structured: Complex structured data formatting
9- utils: Shared utilities and helper functions
10"""
12# Re-export the main MCPFormatters class for backward compatibility
13from .basic import BasicResultFormatters
14from .intelligence import IntelligenceResultFormatters
15from .lightweight import LightweightResultFormatters
16from .structured import StructuredResultFormatters
17from .utils import FormatterUtils
20# Compatibility wrapper to maintain existing API
21class MCPFormatters:
22 """
23 Unified formatter class maintaining backward compatibility.
25 Delegates to specialized formatter modules while preserving
26 the original static method interface.
27 """
29 # Basic formatting methods
30 format_search_result = staticmethod(BasicResultFormatters.format_search_result)
31 format_attachment_search_result = staticmethod(
32 BasicResultFormatters.format_attachment_search_result
33 )
34 format_hierarchical_results = staticmethod(
35 BasicResultFormatters.format_hierarchical_results
36 )
38 # Intelligence formatting methods
39 format_relationship_analysis = staticmethod(
40 IntelligenceResultFormatters.format_relationship_analysis
41 )
42 format_similar_documents = staticmethod(
43 IntelligenceResultFormatters.format_similar_documents
44 )
45 format_conflict_analysis = staticmethod(
46 IntelligenceResultFormatters.format_conflict_analysis
47 )
48 format_complementary_content = staticmethod(
49 IntelligenceResultFormatters.format_complementary_content
50 )
51 format_document_clusters = staticmethod(
52 IntelligenceResultFormatters.format_document_clusters
53 )
54 format_graph = staticmethod(IntelligenceResultFormatters.format_graph)
56 # Lightweight result methods
57 create_lightweight_similar_documents_results = staticmethod(
58 LightweightResultFormatters.create_lightweight_similar_documents_results
59 )
60 create_lightweight_conflict_results = staticmethod(
61 LightweightResultFormatters.create_lightweight_conflict_results
62 )
63 create_lightweight_cluster_results = staticmethod(
64 LightweightResultFormatters.create_lightweight_cluster_results
65 )
66 create_lightweight_hierarchy_results = staticmethod(
67 LightweightResultFormatters.create_lightweight_hierarchy_results
68 )
69 create_lightweight_complementary_results = staticmethod(
70 LightweightResultFormatters.create_lightweight_complementary_results
71 )
72 create_lightweight_attachment_results = staticmethod(
73 LightweightResultFormatters.create_lightweight_attachment_results
74 )
76 # Structured result methods
77 create_structured_search_results = staticmethod(
78 StructuredResultFormatters.create_structured_search_results
79 )
80 create_structured_hierarchy_results = staticmethod(
81 StructuredResultFormatters.create_structured_hierarchy_results
82 )
83 create_structured_attachment_results = staticmethod(
84 StructuredResultFormatters.create_structured_attachment_results
85 )
87 # Utility methods
88 _extract_minimal_doc_fields = staticmethod(
89 FormatterUtils.extract_minimal_doc_fields
90 )
91 _extract_conflicting_statements = staticmethod(
92 FormatterUtils.extract_conflicting_statements
93 )
94 _generate_clean_group_name = staticmethod(FormatterUtils.generate_clean_group_name)
95 _get_group_key = staticmethod(FormatterUtils.get_group_key)
96 _count_siblings = staticmethod(FormatterUtils.count_siblings)
97 _extract_synthetic_depth = staticmethod(FormatterUtils.extract_synthetic_depth)
98 _extract_synthetic_parent_id = staticmethod(
99 FormatterUtils.extract_synthetic_parent_id
100 )
101 _extract_synthetic_parent_title = staticmethod(
102 FormatterUtils.extract_synthetic_parent_title
103 )
104 _extract_synthetic_breadcrumb = staticmethod(
105 FormatterUtils.extract_synthetic_breadcrumb
106 )
107 _extract_has_children = staticmethod(FormatterUtils.extract_has_children)
108 _extract_children_count = staticmethod(FormatterUtils.extract_children_count)
109 _extract_safe_filename = staticmethod(FormatterUtils.extract_safe_filename)
110 _extract_file_type_minimal = staticmethod(FormatterUtils.extract_file_type_minimal)
111 _organize_attachments_by_type = staticmethod(
112 FormatterUtils.organize_attachments_by_type
113 )
114 _get_attachment_group_key = staticmethod(FormatterUtils.get_attachment_group_key)
115 _generate_friendly_group_name = staticmethod(
116 FormatterUtils.generate_friendly_group_name
117 )
118 _generate_conflict_resolution_suggestion = staticmethod(
119 FormatterUtils.generate_conflict_resolution_suggestion
120 )
121 _extract_affected_sections = staticmethod(FormatterUtils.extract_affected_sections)
124__all__ = [
125 "MCPFormatters",
126 "BasicResultFormatters",
127 "IntelligenceResultFormatters",
128 "LightweightResultFormatters",
129 "StructuredResultFormatters",
130 "FormatterUtils",
131]