File size: 2,065 Bytes
f8ba6bf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
"""
DungeonMaster AI - MCP Integration Package

Provides connection management, tool wrappers, and graceful degradation
for the TTRPG-Toolkit MCP server integration.

Usage:
    ```python
    from src.mcp_integration import (
        TTRPGToolkitClient,
        ConnectionManager,
        GameAwareTools,
        TOOL_CATEGORIES,
    )

    # Create and connect client
    manager = ConnectionManager()
    await manager.connect()

    # Get tools for agents
    all_tools = await manager.get_tools()
    rules_tools = await manager.get_tools(categories=["rules"])

    # Wrap with game awareness
    wrapper = GameAwareTools(game_state=state)
    enhanced_tools = wrapper.wrap_tools(all_tools)
    ```
"""

from .connection_manager import ConnectionManager
from .exceptions import (
    MCPCircuitBreakerOpenError,
    MCPConnectionError,
    MCPIntegrationError,
    MCPInvalidResponseError,
    MCPTimeoutError,
    MCPToolExecutionError,
    MCPToolNotFoundError,
    MCPUnavailableError,
)
from .fallbacks import FallbackHandler
from .models import (
    CircuitBreakerState,
    CombatantInfo,
    CombatStateResult,
    ConnectionState,
    DiceRollResult,
    FormattedResult,
    GameStateProtocol,
    HPChangeResult,
    MCPConnectionStatus,
    RollType,
)
from .tool_wrappers import GameAwareTools
from .toolkit_client import TOOL_CATEGORIES, TTRPGToolkitClient

__all__ = [
    # Exceptions
    "MCPIntegrationError",
    "MCPConnectionError",
    "MCPTimeoutError",
    "MCPToolNotFoundError",
    "MCPToolExecutionError",
    "MCPUnavailableError",
    "MCPCircuitBreakerOpenError",
    "MCPInvalidResponseError",
    # Models & Enums
    "ConnectionState",
    "CircuitBreakerState",
    "RollType",
    "GameStateProtocol",
    "FormattedResult",
    "DiceRollResult",
    "HPChangeResult",
    "CombatantInfo",
    "CombatStateResult",
    "MCPConnectionStatus",
    # Client & Connection
    "TTRPGToolkitClient",
    "TOOL_CATEGORIES",
    "ConnectionManager",
    # Tool Wrappers
    "GameAwareTools",
    # Fallbacks
    "FallbackHandler",
]