compliance_report
Generate EU AI Act compliance reports for AI agents, assessing risk levels, transparency declarations, audit summaries, and trust status.
Instructions
Get EU AI Act compliance report for an agent. Returns risk level, transparency declaration, audit summary, and trust status. Free.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agent_id | Yes | Agent ID (e.g., agt_E-PFtTAIQlfVleNm) |
Implementation Reference
- src/mcp-server.js:492-555 (handler)The 'compliance_report' tool is defined and implemented directly within src/mcp-server.js using the server.tool method. It retrieves agent data from the database, calculates reputation, parses transparency declarations, and returns a JSON response with compliance status.
server.tool( 'compliance_report', 'Get EU AI Act compliance report for an agent. Returns risk level, transparency declaration, audit summary, and trust status. Free.', { agent_id: z.string().describe('Agent ID (e.g., agt_E-PFtTAIQlfVleNm)'), }, async ({ agent_id }) => { try { const { getDb } = require('./database'); const { TRANSPARENCY_ALLOWED_KEYS } = require('./constants'); const db = getDb(); const agent = db.prepare( "SELECT id, name, wallet_address, category, status, registered_at, last_heartbeat, human_sponsor, ai_act_risk_level, transparency_declaration, wallet_verified FROM agents WHERE id = ?" ).get(agent_id); if (!agent) { return { content: [{ type: 'text', text: JSON.stringify({ success: false, error: 'Agent not found' }, null, 2) }] }; } const reputation = computeReputation(agent.id); const stamp = db.prepare( "SELECT tier, expires_at FROM stamps WHERE wallet_address = ? AND revoked = 0 AND expires_at > datetime('now') ORDER BY CASE tier WHEN 'gold' THEN 1 WHEN 'silver' THEN 2 WHEN 'bronze' THEN 3 ELSE 4 END LIMIT 1" ).get(agent.wallet_address); let transparencyFields = {}; if (agent.transparency_declaration) { try { const raw = JSON.parse(agent.transparency_declaration); for (const key of TRANSPARENCY_ALLOWED_KEYS) { if (raw[key] !== undefined && typeof raw[key] === 'string') { transparencyFields[key] = raw[key].slice(0, 500); } } } catch (e) { /* invalid JSON */ } } const result = { success: true, agent_id: agent.id, agent_name: agent.name, ai_act: { risk_level: agent.ai_act_risk_level || 'not_declared', transparency: { is_ai_agent: true, human_sponsor: agent.human_sponsor || null, category: agent.category, ...transparencyFields, }, }, trust_status: { score: reputation?.score || 0, tier: reputation?.tier_label || 'new', active_stamp: stamp ? { tier: stamp.tier, expires_at: stamp.expires_at } : null, }, verification: { wallet_verified: !!agent.wallet_verified, stamp_verified: !!stamp, compliance_url: `https://agentstamp.org/api/v1/compliance/report/${agent.id}`, }, }; return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };