block_ip
Block malicious IP addresses to prevent unauthorized access and security threats. Specify duration to control temporary or permanent blocking.
Instructions
Block a source IP address. Adds the IP to the sensor's block list for the specified duration.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ip_address | Yes | IP address to block. | |
| duration | No | Block duration (e.g., '1h', '24h', 'permanent'). Defaults to '24h'. |
Implementation Reference
- The main handler function for block_ip tool. Takes arguments dict, validates ip_address is present, and returns a TextContent response directing users to the SecurityUse dashboard for IP blocking management.
async def handle_block_ip(arguments: dict[str, Any]) -> list[TextContent]: """Block IP - requires dashboard integration.""" ip_address = arguments.get("ip_address") if not ip_address: return [TextContent(type="text", text="Error: `ip_address` is required")] return [ TextContent( type="text", text=( f"## Block IP: {ip_address}\n\n" "IP blocking is managed through the SecurityUse dashboard.\n\n" "Visit https://securityuse.dev to manage your block list." ), ) ] - Tool registration schema for block_ip. Defines the tool name, description, and inputSchema with properties: ip_address (required string) and duration (optional string with default '24h').
name="block_ip", description=( "Block a source IP address. " "Adds the IP to the sensor's block list for the specified duration." ), inputSchema={ "type": "object", "properties": { "ip_address": { "type": "string", "description": "IP address to block.", }, "duration": { "type": "string", "description": ( "Block duration (e.g., '1h', '24h', 'permanent'). Defaults to '24h'." ), }, }, "required": ["ip_address"], }, ), - src/security_use_mcp/server.py:529-529 (registration)Handler mapping that registers 'block_ip' tool name to the handle_block_ip function in the handlers dictionary.
"block_ip": handle_block_ip, - src/security_use_mcp/server.py:15-19 (registration)Import statement that imports handle_block_ip from the .handlers module, making it available for tool registration.
from .handlers import ( handle_acknowledge_alert, handle_analyze_request, handle_block_ip, handle_check_compliance, - src/security_use_mcp/handlers/__init__.py:9-19 (registration)Re-exports handle_block_ip from sensor_handler module and includes it in __all__ for public API exposure.
from .sensor_handler import ( handle_acknowledge_alert, handle_analyze_request, handle_block_ip, handle_configure_sensor, handle_detect_vulnerable_endpoints, handle_get_alert_details, handle_get_blocked_ips, handle_get_security_alerts, handle_get_sensor_config, )