get_threat_models
Retrieve threat models from Devici with pagination controls to manage security analysis data efficiently.
Instructions
Get threat models from Devici with pagination
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| page | No |
Implementation Reference
- src/devici_mcp_server/server.py:81-86 (handler)MCP tool handler and registration for 'get_threat_models'. Creates API client context and delegates to client.get_threat_models, returning stringified result.@mcp.tool() async def get_threat_models(limit: int = 20, page: int = 0) -> str: """Get threat models from Devici with pagination""" async with create_client_from_env() as client: result = await client.get_threat_models(limit=limit, page=page) return str(result)
- Core API client method implementing the HTTP request to fetch threat models from '/threat-models/' endpoint with pagination parameters.async def get_threat_models(self, limit: int = 20, page: int = 0) -> Dict[str, Any]: """Get all threat models.""" params = {"limit": limit, "page": page} return await self._make_request("GET", "/threat-models/", params=params)
- Factory function to create the DeviciAPIClient from environment variables, used in the tool handler.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)