get_certification_history
Retrieve recent certification decisions for AI agent actions, including risk zones and timestamps, to monitor safety audit trails.
Instructions
Retrieve the recent certification history.
This tool returns a list of recent certifications, most recent first. The history includes decision, zone, timestamp, and other metadata. Up to 50 certifications are stored; older ones are discarded.
Args: limit: Maximum number of certifications to return (default 10, max 50)
Returns: Dictionary with keys: - certifications: List of recent certification summaries - total_count: Total certifications in history - timestamp: Current time (ISO 8601)
Each certification entry contains: - certificate_id: Unique certificate identifier - action_id: Action that was certified - agent_id: Agent that proposed the action - decision: Final decision ("Certified", "CertifiedWithWarning", etc.) - zone: Risk zone ("Safe", "Caution", "Danger") - timestamp: When the certification occurred - description: Optional action description
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No |
Implementation Reference
- src/qae_mcp_server/server.py:285-334 (handler)The get_certification_history tool implementation, which retrieves recent certifications from a deque and returns them as a JSON-compatible dictionary.
def get_certification_history(limit: int = 10) -> Dict[str, Any]: """ Retrieve the recent certification history. This tool returns a list of recent certifications, most recent first. The history includes decision, zone, timestamp, and other metadata. Up to 50 certifications are stored; older ones are discarded. Args: limit: Maximum number of certifications to return (default 10, max 50) Returns: Dictionary with keys: - certifications: List of recent certification summaries - total_count: Total certifications in history - timestamp: Current time (ISO 8601) Each certification entry contains: - certificate_id: Unique certificate identifier - action_id: Action that was certified - agent_id: Agent that proposed the action - decision: Final decision ("Certified", "CertifiedWithWarning", etc.) - zone: Risk zone ("Safe", "Caution", "Danger") - timestamp: When the certification occurred - description: Optional action description """ try: limit = min(max(limit, 1), 50) # Clamp to [1, 50] # Reverse to get most recent first recent = list(reversed(list(_certification_history)))[:limit] response = { "certifications": recent, "total_count": len(_certification_history), "limit": limit, "timestamp": datetime.now(timezone.utc).isoformat().replace("+00:00", "Z"), } logger.info(f"Retrieved {len(recent)} certifications from history") return response except Exception as e: logger.error(f"Error in get_certification_history: {e}") return { "error": f"Failed to retrieve history: {str(e)}", "timestamp": datetime.now(timezone.utc).isoformat().replace("+00:00", "Z"), }