# =============================================================================
# FRONTMATTER
# =============================================================================
# Title:        MCP - Model Context Protocol Package
# Description:  Framework for integrating with external tools and models
# Role:         Enables agent interactions with tools and external services
# Usage:        Used by agents to perform actions beyond conversation
# Author:       Muxi Framework Team
#
# The MCP (Model Context Protocol) package provides the infrastructure for
# agents to interact with external tools, services, and models. It includes:
#
# 1. Connection Management
#    - Establishes and maintains connections to MCP servers
#    - Handles authentication and credential management
#    - Provides reconnection logic for resilient operation
#
# 2. Message Formatting
#    - Standardizes message structure between agents and tools
#    - Handles tool call parsing and formatting
#    - Manages request/response cycle for tool invocations
#
# 3. Tool Integration
#    - Provides unified interface for tool discovery and usage
#    - Supports synchronous and asynchronous tool execution
#    - Handles error conditions and timeouts gracefully
#
# The MCP protocol enables agents to perform a wide range of actions beyond
# simple text generation, such as retrieving information, manipulating data,
# or interacting with external APIs and services.
#
# Example usage:
#
#   # Create MCP service
#   service = MCPService.get_instance()
#
#   # Connect to an MCP server
#   service.register_server("my_tools", "http://localhost:8080")
#
#   # Invoke a tool
#   result = await service.invoke_tool(
#       server_id="my_tools",
#       tool_name="search_database",
#       parameters={"query": "customer records"}
#   )
#
# The MCP package forms the backbone of the Muxi framework's tool integration
# capabilities, enabling AI agents to interact with the external world in a
# controlled and secure manner.
# =============================================================================

from ...datatypes.mcp import MCPToolCall
from ...datatypes.response import MuxiResponse

# Re-export key classes
from .handler import MCPHandler
from .parser import ToolCall, ToolParser
from .reconnect_handler import ReconnectingMCPHandler
from .service import MCPService
from .transports import MCPConnectionError, MCPRequestError, MCPTimeoutError

__all__ = [
    "MCPHandler",
    "MCPConnectionError",
    "MCPRequestError",
    "MCPTimeoutError",
    "ReconnectingMCPHandler",
    "MCPService",
    "MuxiResponse",
    "MCPToolCall",
    "ToolParser",
    "ToolCall",
]
