classify_ai_risk
Classify AI systems under the EU AI Act by assessing risk levels from prohibited to minimal. Ideal for compliance audits and gap analysis.
Instructions
Classify an AI system's risk level under the EU AI Act.
Takes a description of an AI system and returns its risk classification: prohibited, high-risk, limited-risk, or minimal-risk — per Article 5 (prohibited practices), Article 6 + Annex III (high-risk), Articles 50/52 (limited risk: transparency obligations), or minimal risk.
Includes all 8 Annex III high-risk areas and all Article 5 prohibited practices.
Args: description: A description of the AI system, its purpose, data used, and deployment context. caller: Identifier for rate limiting. tier: "free" (10 calls/day) or "pro" (unlimited, $29/mo).
Behavior: This tool is read-only and stateless — it produces analysis output without modifying any external systems, databases, or files. Safe to call repeatedly with identical inputs (idempotent). Free tier: 10/day rate limit. Pro tier: unlimited. No authentication required for basic usage.
When to use: Use this tool when you need to assess, audit, or verify compliance requirements. Ideal for gap analysis, readiness checks, and generating compliance documentation.
When NOT to use: Do not use as a substitute for qualified legal counsel. This tool provides technical compliance guidance, not legal advice.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | Yes | ||
| caller | No | anonymous | |
| api_key | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- server.py:667-800 (handler)The main handler function for the classify_ai_risk MCP tool. It takes an AI system description and returns risk classification (prohibited, high-risk, limited-risk, minimal-risk) by checking against Article 5 prohibited practices, Annex III high-risk areas, limited risk transparency triggers, and defaulting to minimal risk.
@mcp.tool() def classify_ai_risk( description: str, caller: str = "anonymous", api_key: str = "") -> str: """Classify an AI system's risk level under the EU AI Act. Takes a description of an AI system and returns its risk classification: prohibited, high-risk, limited-risk, or minimal-risk — per Article 5 (prohibited practices), Article 6 + Annex III (high-risk), Articles 50/52 (limited risk: transparency obligations), or minimal risk. Includes all 8 Annex III high-risk areas and all Article 5 prohibited practices. Args: description: A description of the AI system, its purpose, data used, and deployment context. caller: Identifier for rate limiting. tier: "free" (10 calls/day) or "pro" (unlimited, $29/mo). Behavior: This tool is read-only and stateless — it produces analysis output without modifying any external systems, databases, or files. Safe to call repeatedly with identical inputs (idempotent). Free tier: 10/day rate limit. Pro tier: unlimited. No authentication required for basic usage. When to use: Use this tool when you need to assess, audit, or verify compliance requirements. Ideal for gap analysis, readiness checks, and generating compliance documentation. When NOT to use: Do not use as a substitute for qualified legal counsel. This tool provides technical compliance guidance, not legal advice. """ allowed, msg, tier = check_access(api_key) if not allowed: return {"error": msg, "upgrade_url": "https://meok.ai/pricing"} limit_err = _check_rate_limit(caller, tier) if limit_err: return {"error": "rate_limited", "message": limit_err} result = { "classification": "minimal", "confidence": "low", "prohibited_matches": [], "high_risk_matches": [], "limited_risk_triggers": [], "analysis": "", "regulation": "Regulation (EU) 2024/1689", "meok_labs": "https://meok.ai", } # Check prohibited practices (Article 5) for practice in PROHIBITED_PRACTICES: matches = _match_keywords(description, practice["keywords"]) if matches: result["prohibited_matches"].append({ "practice_id": practice["id"], "article": practice["article"], "description": practice["description"], "matched_keywords": matches, }) if result["prohibited_matches"]: result["classification"] = "prohibited" result["confidence"] = "high" if len(result["prohibited_matches"]) >= 2 else "medium" result["analysis"] = ( f"WARNING: This AI system matches {len(result['prohibited_matches'])} prohibited practice(s) " f"under Article 5. Prohibited AI systems may not be placed on the market, put into service, " f"or used in the EU. Penalties: up to EUR 35 million or 7% of global annual turnover " f"(Article 99(3)). Enforcement date: 2 February 2025." ) return result # Check high-risk (Annex III) for area in ANNEX_III_HIGH_RISK: matches = _match_keywords(description, area["keywords"]) if matches: result["high_risk_matches"].append({ "area": area["area"], "title": area["title"], "article_ref": area["article_ref"], "description": area["description"], "subcategories": area["subcategories"], "matched_keywords": matches, }) if result["high_risk_matches"]: result["classification"] = "high-risk" result["confidence"] = "high" if len(result["high_risk_matches"]) >= 2 else "medium" areas_str = ", ".join(f"Area {m['area']} ({m['title']})" for m in result["high_risk_matches"]) result["analysis"] = ( f"This AI system is classified as HIGH-RISK under Annex III, matching: {areas_str}. " f"High-risk systems must comply with Articles 9-15 (risk management, data governance, " f"technical documentation, logging, transparency, human oversight, accuracy/robustness/cybersecurity). " f"A conformity assessment is required before placing on the market. " f"Full enforcement: 2 August 2026." ) return result # Check limited risk (transparency obligations — Article 50) limited_keywords = [ "chatbot", "chat bot", "conversational ai", "virtual assistant", "deepfake", "synthetic media", "generated image", "generated video", "generated text", "emotion recognition", "biometric categori", "generative ai", "foundation model", "large language model", "llm", ] limited_matches = _match_keywords(description, limited_keywords) if limited_matches: result["classification"] = "limited-risk" result["confidence"] = "medium" result["limited_risk_triggers"] = limited_matches result["analysis"] = ( f"This AI system falls under LIMITED-RISK with transparency obligations (Article 50). " f"Matched triggers: {', '.join(limited_matches)}. " f"Requirements: (1) Persons interacting with AI must be informed they are interacting with AI, " f"(2) AI-generated/manipulated content must be marked as such, " f"(3) Deployers of emotion recognition/biometric categorisation must inform persons. " f"GPAI model providers have additional obligations under Articles 51-56." ) return result # Minimal risk result["classification"] = "minimal" result["confidence"] = "low" result["analysis"] = ( "Based on the provided description, this AI system appears to be MINIMAL RISK. " "No specific regulatory obligations under the EU AI Act, though voluntary codes of " "conduct are encouraged (Article 95). Providers may voluntarily apply high-risk " "requirements. Note: classification confidence is low — provide more detail about " "the system's purpose, data usage, and deployment context for a more accurate assessment." ) return result - server.py:667-668 (registration)Registration of classify_ai_risk as an MCP tool via the @mcp.tool() decorator on FastMCP instance.
@mcp.tool() def classify_ai_risk( - server.py:668-701 (schema)Input schema and parameter definitions for classify_ai_risk: description (str), caller (str), api_key (str). The docstring also describes the output schema which is a dict with classification, confidence, prohibited_matches, high_risk_matches, limited_risk_triggers, analysis, regulation, and meok_labs keys.
def classify_ai_risk( description: str, caller: str = "anonymous", api_key: str = "") -> str: """Classify an AI system's risk level under the EU AI Act. Takes a description of an AI system and returns its risk classification: prohibited, high-risk, limited-risk, or minimal-risk — per Article 5 (prohibited practices), Article 6 + Annex III (high-risk), Articles 50/52 (limited risk: transparency obligations), or minimal risk. Includes all 8 Annex III high-risk areas and all Article 5 prohibited practices. Args: description: A description of the AI system, its purpose, data used, and deployment context. caller: Identifier for rate limiting. tier: "free" (10 calls/day) or "pro" (unlimited, $29/mo). Behavior: This tool is read-only and stateless — it produces analysis output without modifying any external systems, databases, or files. Safe to call repeatedly with identical inputs (idempotent). Free tier: 10/day rate limit. Pro tier: unlimited. No authentication required for basic usage. When to use: Use this tool when you need to assess, audit, or verify compliance requirements. Ideal for gap analysis, readiness checks, and generating compliance documentation. When NOT to use: Do not use as a substitute for qualified legal counsel. This tool provides technical compliance guidance, not legal advice. """ - server.py:435-438 (helper)Helper function _match_keywords used by classify_ai_risk to match description text against keyword lists (case-insensitive).
def _match_keywords(text: str, keywords: list[str]) -> list[str]: """Return matched keywords found in text (case-insensitive).""" text_lower = text.lower() return [kw for kw in keywords if kw.lower() in text_lower] - server.py:84-133 (helper)Knowledge base data: PROHIBITED_PRACTICES (Article 5) and ANNEX_III_HIGH_RISK used by classify_ai_risk for keyword matching.
PROHIBITED_PRACTICES = [ { "id": "ART5-1a", "article": "Article 5(1)(a)", "description": "Subliminal, manipulative, or deceptive techniques that distort behaviour and cause significant harm", "keywords": ["subliminal", "manipulat", "deceiv", "distort behavio", "dark pattern", "coercive design"], }, { "id": "ART5-1b", "article": "Article 5(1)(b)", "description": "Exploitation of vulnerabilities due to age, disability, or social/economic situation", "keywords": ["vulnerab", "elderly", "child", "disabilit", "exploit", "economic situation"], }, { "id": "ART5-1c", "article": "Article 5(1)(c)", "description": "Social scoring by public authorities leading to detrimental treatment", "keywords": ["social scor", "citizen scor", "social credit", "public authority score"], }, { "id": "ART5-1d", "article": "Article 5(1)(d)", "description": "Risk assessment of natural persons for criminal offences based solely on profiling or personality traits (except as supplement to human assessment)", "keywords": ["criminal predict", "recidivism", "crime profil", "predictive polic"], }, { "id": "ART5-1e", "article": "Article 5(1)(e)", "description": "Untargeted scraping of facial images from internet or CCTV for facial recognition databases", "keywords": ["facial scrap", "untargeted scraping", "facial recognition database", "mass surveillance face"], }, { "id": "ART5-1f", "article": "Article 5(1)(f)", "description": "Emotion recognition in workplaces and educational institutions (except for medical/safety reasons)", "keywords": ["emotion recognition work", "emotion recognition school", "emotion detection employ", "affect recognition edu"], }, { "id": "ART5-1g", "article": "Article 5(1)(g)", "description": "Biometric categorisation inferring sensitive attributes (race, political opinions, trade union membership, religious beliefs, sex life, sexual orientation)", "keywords": ["biometric categori", "race classif", "religion classif", "political opinion classif", "infer sensitive"], }, { "id": "ART5-1h", "article": "Article 5(1)(h)", "description": "Real-time remote biometric identification in publicly accessible spaces for law enforcement (with narrow exceptions)", "keywords": ["real-time biometric", "live facial recognition", "remote biometric identif", "real-time surveillance"], }, ]