mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-04-01 15:52:28 -07:00
feat(api): MCP, OpenAPI & Dynamic Introspection
New Features: - API endpoints now support comprehensive input validation with detailed error responses via Pydantic models. - OpenAPI specification endpoint (/openapi.json) and interactive Swagger UI documentation (/docs) now available for API discovery. - Enhanced MCP session lifecycle management with create, retrieve, and delete operations. - Network diagnostic tools: traceroute, nslookup, NMAP scanning, and network topology viewing exposed via API. - Device search, filtering by status (including 'offline'), and bulk operations (copy, delete, update). - Wake-on-LAN functionality for remote device management. - Added dynamic tool disablement and status reporting. Bug Fixes: - Fixed get_tools_status in registry to correctly return boolean values instead of None for enabled tools. - Improved error handling for invalid API inputs with standardized validation responses. - Fixed OPTIONS request handling for cross-origin requests. Refactoring: - Significant refactoring of api_server_start.py to use decorator-based validation (@validate_request).
This commit is contained in:
@@ -39,6 +39,7 @@ def get_device_condition_by_status(device_status):
|
||||
"favorites": "WHERE devIsArchived=0 AND devFavorite=1",
|
||||
"new": "WHERE devIsArchived=0 AND devIsNew=1",
|
||||
"down": "WHERE devIsArchived=0 AND devAlertDown != 0 AND devPresentLastScan=0",
|
||||
"offline": "WHERE devIsArchived=0 AND devPresentLastScan=0",
|
||||
"archived": "WHERE devIsArchived=1",
|
||||
}
|
||||
return conditions.get(device_status, "WHERE 1=0")
|
||||
@@ -162,9 +163,8 @@ def print_table_schema(db, table):
|
||||
return
|
||||
|
||||
mylog("debug", f"[Schema] Structure for table: {table}")
|
||||
header = (
|
||||
f"{'cid':<4} {'name':<20} {'type':<10} {'notnull':<8} {'default':<10} {'pk':<2}"
|
||||
)
|
||||
header = "{:<4} {:<20} {:<10} {:<8} {:<10} {:<2}".format(
|
||||
"cid", "name", "type", "notnull", "default", "pk")
|
||||
mylog("debug", header)
|
||||
mylog("debug", "-" * len(header))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user