Files
leocrm/app/plugins/builtins/mcp_server/contracts.py
T

58 lines
1.5 KiB
Python
Raw Normal View History

"""Public contract for the mcp_server plugin.
Exposes tool definitions and schemas for other plugins.
"""
from __future__ import annotations
from app.plugins.builtins.contracts import get_contract_registry
from app.plugins.builtins.mcp_server.tool_definitions import (
TOOL_DEFINITIONS,
TOOL_HANDLERS,
get_all_tool_names,
get_tool_definition,
)
from app.plugins.builtins.mcp_server.schemas import (
McpToolDefinition,
McpToolExecuteRequest,
McpToolExecuteResponse,
McpToolListResponse,
McpToolParameter,
McpServerConfig,
)
class McpServerContract:
"""Public API surface for the mcp_server plugin."""
contract_name = "mcp_server"
# ─── tool_definitions ───
ToolDefinitions = TOOL_DEFINITIONS
ToolHandlers = TOOL_HANDLERS
get_tool_definition = staticmethod(get_tool_definition)
get_all_tool_names = staticmethod(get_all_tool_names)
# ─── schemas ───
McpToolDefinition = McpToolDefinition
McpToolExecuteRequest = McpToolExecuteRequest
McpToolExecuteResponse = McpToolExecuteResponse
McpToolListResponse = McpToolListResponse
McpToolParameter = McpToolParameter
McpServerConfig = McpServerConfig
# ─── self-registration ───
_contract = McpServerContract()
get_contract_registry().register("mcp_server", _contract)
__all__ = [
"McpServerContract",
"ToolDefinitions",
"McpToolDefinition",
"McpToolParameter",
"McpServerConfig",
]