INNER CODE UNIT · Python
_log
tiliondev/fortress · mcp/server.py:136
async def _log(ctx, msg: str) -> None:
"""Best-effort server→client log. Never breaks a tool if the client has no
logging capability (or there's no active session, e.g. in tests)."""
if ctx is not None:
try:
await ctx.info(msg)
except Exception:
pass
async def _check_params_urls(params: dict | None) -> None:
"""Defense-in-depth: SSRF-check any URL-looking values a flow might navigate to."""
for v in (params or {}).values():
if isinstance(v, str) and v[:8].lower().startswith(("http://", "https:/")):
await _check_url(v)
@asynccontextmanager