|
|
""" |
|
|
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__ = [ |
|
|
|
|
|
"MCPIntegrationError", |
|
|
"MCPConnectionError", |
|
|
"MCPTimeoutError", |
|
|
"MCPToolNotFoundError", |
|
|
"MCPToolExecutionError", |
|
|
"MCPUnavailableError", |
|
|
"MCPCircuitBreakerOpenError", |
|
|
"MCPInvalidResponseError", |
|
|
|
|
|
"ConnectionState", |
|
|
"CircuitBreakerState", |
|
|
"RollType", |
|
|
"GameStateProtocol", |
|
|
"FormattedResult", |
|
|
"DiceRollResult", |
|
|
"HPChangeResult", |
|
|
"CombatantInfo", |
|
|
"CombatStateResult", |
|
|
"MCPConnectionStatus", |
|
|
|
|
|
"TTRPGToolkitClient", |
|
|
"TOOL_CATEGORIES", |
|
|
"ConnectionManager", |
|
|
|
|
|
"GameAwareTools", |
|
|
|
|
|
"FallbackHandler", |
|
|
] |
|
|
|