get_mitigations
Retrieve security mitigations from Devici's threat management system with paginated results for efficient access to protection measures.
Instructions
Get mitigations from Devici with pagination
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| page | No |
Implementation Reference
- src/devici_mcp_server/server.py:171-176 (handler)The MCP tool handler for get_mitigations. It is decorated with @mcp.tool() for registration and executes the tool logic by calling the API client to fetch mitigations.@mcp.tool() async def get_mitigations(limit: int = 20, page: int = 0) -> str: """Get mitigations from Devici with pagination""" async with create_client_from_env() as client: result = await client.get_mitigations(limit=limit, page=page) return str(result)
- Supporting API client method that handles the actual HTTP request to retrieve mitigations from the Devici API.async def get_mitigations(self, limit: int = 20, page: int = 0) -> Dict[str, Any]: """Get all mitigations.""" params = {"limit": limit, "page": page} return await self._make_request("GET", "/mitigations/", params=params)
- src/devici_mcp_server/server.py:15-15 (registration)Initialization of the FastMCP server instance where all @mcp.tool() decorated functions are registered as MCP tools.mcp = FastMCP("devici-mcp-server")
- Factory function used by the handler to create an authenticated API client from environment variables.def create_client_from_env() -> DeviciAPIClient: """Create API client from environment variables.""" config = DeviciConfig( api_base_url=os.getenv("DEVICI_API_BASE_URL", "https://api.devici.com/api/v1"), client_id=os.getenv("DEVICI_CLIENT_ID", ""), client_secret=os.getenv("DEVICI_CLIENT_SECRET", ""), debug=os.getenv("DEBUG", "false").lower() == "true" ) if not config.client_id or not config.client_secret: raise ValueError("DEVICI_CLIENT_ID and DEVICI_CLIENT_SECRET must be set") return DeviciAPIClient(config)