INNER CODE UNIT · Python
wrap
tiliondev/fortress · mcp/server.py:52
async def wrap(*args, **kwargs):
try:
return await asyncio.wait_for(fn(*args, **kwargs), timeout=_TOOL_TIMEOUT)
except asyncio.TimeoutError:
return {"status": "error",
"error": f"tool timed out after {_TOOL_TIMEOUT:.0f}s "
f"(raise TILION_MCP_TOOL_TIMEOUT for slow crawls)"}
except Exception as exc: # noqa: BLE001 - deliberate catch-all at the tool boundary
return {"status": "error", "error": f"{type(exc).__name__}: {exc}"}
return wrap
def _ip_blocked(ip_str: str) -> bool:
import ipaddress
try:
ip = ipaddress.ip_address(ip_str)
except ValueError:
return False