INNER CODE UNIT · Python
_derived_tools_available
caiovicentino/polymarket-mcp-server · src/polymarket_mcp/web/app.py:127
def _derived_tools_available(has_credentials: bool) -> int:
"""Derive the exposed tool count from the live tool registries (anti-drift).
Mirrors ``server.get_tools()``: discovery + analysis + realtime tools are
always available; trading + portfolio tools only with API credentials.
"""
from ..tools import realtime
total = (
len(market_discovery.get_tools())
+ len(market_analysis.get_tools())
+ len(realtime.get_tools())
)
if has_credentials:
from ..tools import portfolio_integration
from ..tools.trading import get_tool_definitions
total += len(get_tool_definitions()) + len(