check_compliance
Evaluate content against HIPAA, EU AI Act, NIST, and custom compliance policies to return passed/blocked status, violations, warnings, and logs.
Instructions
Check content against compliance policy sets. Evaluates against HIPAA (PHI detection), EU_AI_ACT (prohibited use cases), NIST (PII/secrets), and CUSTOM rules. Returns: passed/blocked status, list of violations (BLOCK), warnings (WARN), and log entries.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | The content to evaluate against compliance policies | |
| categories | No | Filter to specific policy categories. Leave empty to check against all active policies. |
Implementation Reference
- src/lib/client.ts:117-125 (handler)The checkCompliance function that executes the tool logic. It sends an HTTP POST request to the COMPLIANCE_SERVICE_URL/check endpoint with the content and optional categories, returning a ComplianceCheckResult.
export async function checkCompliance( content: string, categories?: string[] ): Promise<ComplianceCheckResult> { return post<ComplianceCheckResult>(`${COMPLIANCE_SERVICE_URL}/check`, { content, categories, }); } - src/lib/client.ts:81-88 (schema)The ComplianceCheckResult interface defines the return type for the check_compliance tool, including passed/blocked status, violations, warnings, and logs.
export interface ComplianceCheckResult { passed: boolean; blocked: boolean; evaluated_policies: number; violations: Array<{ policy_name: string; category: string; severity: string; matched_snippet: string; message: string }>; warnings: Array<{ policy_name: string; category: string; severity: string; matched_snippet: string; message: string }>; logs: Array<{ policy_name: string; category: string; matched_snippet: string }>; } - src/index.ts:102-126 (registration)Tool registration for 'check_compliance' in the MCP server's ListToolsRequestSchema handler. Defines name, description, and inputSchema with 'content' (required string) and 'categories' (optional array of enum values: HIPAA, EU_AI_ACT, NIST, CUSTOM).
{ name: 'check_compliance', description: 'Check content against compliance policy sets. Evaluates against HIPAA (PHI detection), EU_AI_ACT (prohibited use cases), NIST (PII/secrets), and CUSTOM rules. ' + 'Returns: passed/blocked status, list of violations (BLOCK), warnings (WARN), and log entries.', inputSchema: { type: 'object' as const, required: ['content'], properties: { content: { type: 'string', description: 'The content to evaluate against compliance policies', }, categories: { type: 'array', items: { type: 'string', enum: ['HIPAA', 'EU_AI_ACT', 'NIST', 'CUSTOM'], }, description: 'Filter to specific policy categories. Leave empty to check against all active policies.', }, }, }, }, - src/index.ts:187-203 (handler)The call handler case for 'check_compliance' in the CallToolRequestSchema handler. Parses input via Zod schema (content: string min 1, categories: optional string array), calls checkCompliance, and returns the result as JSON.
case 'check_compliance': { const schema = z.object({ content: z.string().min(1), categories: z.array(z.string()).optional(), }); const params = schema.parse(args); const result = await checkCompliance(params.content, params.categories); return { content: [ { type: 'text' as const, text: JSON.stringify(result, null, 2), }, ], }; } - src/lib/client.ts:22-46 (helper)The generic 'post' helper function used by checkCompliance to make HTTP POST requests with authentication headers.
async function post<T>(url: string, body: unknown): Promise<T> { const response = await fetch(url, { method: 'POST', headers: authHeaders(), body: JSON.stringify(body), }); if (!response.ok) { const text = await response.text(); throw new Error(`HTTP ${response.status}: ${text}`); } return response.json() as Promise<T>; } async function get<T>(url: string): Promise<T> { const response = await fetch(url, { headers: authHeaders() }); if (!response.ok) { const text = await response.text(); throw new Error(`HTTP ${response.status}: ${text}`); } return response.json() as Promise<T>; }