get_threat_model
Retrieve a specific threat model by its ID to analyze security risks and vulnerabilities within the Devici API ecosystem.
Instructions
Get a specific threat model by ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| threat_model_id | Yes |
Implementation Reference
- src/devici_mcp_server/server.py:97-102 (handler)The MCP tool handler for 'get_threat_model'. This function is decorated with @mcp.tool(), executes the tool logic by calling the API client to fetch a specific threat model by ID and returns the result as a string.@mcp.tool() async def get_threat_model(threat_model_id: str) -> str: """Get a specific threat model by ID""" async with create_client_from_env() as client: result = await client.get_threat_model(threat_model_id) return str(result)
- Supporting API client method called by the tool handler to make the HTTP GET request to the Devici API endpoint /threat-models/{threat_model_id}.async def get_threat_model(self, threat_model_id: str) -> Dict[str, Any]: """Get specific threat model by ID.""" return await self._make_request("GET", f"/threat-models/{threat_model_id}")
- Factory function used by the tool handler to create an authenticated DeviciAPIClient instance 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)