check_applicability
Determine which EU regulations apply to your organization based on sector, size, and location. Get tailored compliance guidance with adjustable detail levels.
Instructions
Determine which EU regulations apply to an organization based on sector and characteristics. Supports tiered detail levels for optimal response length.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sector | Yes | Organization sector | |
| subsector | No | Optional: more specific subsector (e.g., "bank", "insurance" for financial) | |
| member_state | No | Optional: EU member state (ISO country code) | |
| size | No | Optional: organization size | |
| detail_level | No | Optional: level of detail (summary=executive overview only, requirements=include key requirements, full=complete details with basis articles). Default: full |
Implementation Reference
- src/tools/applicability.ts:53-172 (handler)The main handler function for the `check_applicability` tool, which queries the database for regulations applicable to a given sector, subsector, and entity size, then optionally computes a summary.
export async function checkApplicability( db: DatabaseAdapter, input: ApplicabilityInput ): Promise<ApplicabilityResult> { const VALID_SECTORS: Sector[] = ['financial', 'healthcare', 'energy', 'transport', 'digital_infrastructure', 'public_administration', 'manufacturing', 'other']; const { sector, subsector, detail_level = 'full' } = input; if (!VALID_SECTORS.includes(sector)) { throw new Error(`Invalid sector "${sector}". Must be one of: ${VALID_SECTORS.join(', ')}`); } // Query for matching rules - check both sector match and subsector match // Note: We handle deduplication in JavaScript, so no need for DISTINCT ON let sql = ` SELECT regulation, confidence, basis_article as basis, notes, CASE confidence WHEN 'definite' THEN 1 WHEN 'likely' THEN 2 WHEN 'possible' THEN 3 END as conf_order FROM applicability_rules WHERE applies = true AND ( (sector = $1 AND (subsector IS NULL OR subsector = $2)) OR (sector = $3 AND subsector IS NULL) ) ORDER BY regulation, conf_order `; const result = await db.query(sql, [sector, subsector || '', sector]); const rows = result.rows as Array<{ regulation: string; confidence: 'definite' | 'likely' | 'possible'; basis: string | null; notes: string | null; }>; // Deduplicate by regulation, keeping highest confidence const regulationMap = new Map<string, ApplicableRegulation>(); for (const row of rows) { if (!regulationMap.has(row.regulation)) { regulationMap.set(row.regulation, { regulation: row.regulation, confidence: row.confidence, basis: row.basis, notes: row.notes, }); } } const applicable_regulations = Array.from(regulationMap.values()); // If summary detail level requested, add summary section let summary; if (detail_level === 'summary') { // Get regulation metadata for summary const regIds = applicable_regulations.map(r => r.regulation); const placeholders = regIds.map((_, i) => `$${i + 1}`).join(', '); const regDataResult = await db.query( `SELECT id, full_name, effective_date FROM regulations WHERE id IN (${placeholders})`, regIds ); const regData = regDataResult.rows as Array<{ id: string; full_name: string; effective_date: string | null; }>; const regMetadata = new Map(regData.map(r => [r.id, r])); // Priority deadlines for key regulations const priorityDeadlines: Record<string, string> = { 'DORA': 'Jan 17, 2025 (ACTIVE)', 'NIS2': 'Oct 17, 2024 (Swedish implementation)', 'AI_ACT': 'Aug 2, 2026 (high-risk systems)', 'EIDAS2': 'Late 2027 (wallet acceptance)', 'CSRD': 'Phased 2025-2028', 'CSDDD': 'Implementation roadmap needed', }; const regulations_summary: RegulationSummary[] = applicable_regulations.map(reg => { const metadata = regMetadata.get(reg.regulation); return { id: reg.regulation, full_name: metadata?.full_name || reg.regulation, confidence: reg.confidence, basis: reg.basis, notes: reg.notes, priority_deadline: priorityDeadlines[reg.regulation], }; }); const by_confidence = { definite: applicable_regulations.filter(r => r.confidence === 'definite').length, likely: applicable_regulations.filter(r => r.confidence === 'likely').length, possible: applicable_regulations.filter(r => r.confidence === 'possible').length, }; summary = { total_count: applicable_regulations.length, by_confidence, regulations_summary, next_steps: "For detailed requirements, use detail_level='requirements'. For full article-level detail, use detail_level='full'.", }; } return { entity: input, applicable_regulations, summary, }; } - src/tools/applicability.ts:13-19 (schema)Input schema for the check_applicability tool.
export interface ApplicabilityInput { sector: Sector; subsector?: string; member_state?: string; size?: 'sme' | 'large'; detail_level?: 'summary' | 'requirements' | 'full'; } - src/tools/registry.ts:227-262 (registration)Registration of the 'check_applicability' tool in the tool registry.
{ name: 'check_applicability', description: 'Determine which EU regulations apply to an organization based on sector and characteristics. Supports tiered detail levels for optimal response length.', inputSchema: { type: 'object', properties: { sector: { type: 'string', enum: ['financial', 'healthcare', 'energy', 'transport', 'digital_infrastructure', 'public_administration', 'manufacturing', 'other'], description: 'Organization sector', }, subsector: { type: 'string', description: 'Optional: more specific subsector (e.g., "bank", "insurance" for financial)', }, member_state: { type: 'string', description: 'Optional: EU member state (ISO country code)', }, size: { type: 'string', enum: ['sme', 'large'], description: 'Optional: organization size', }, detail_level: { type: 'string', enum: ['summary', 'requirements', 'full'], description: 'Optional: level of detail (summary=executive overview only, requirements=include key requirements, full=complete details with basis articles). Default: full', }, }, required: ['sector'], }, handler: async (db, args) => { const input = args as unknown as ApplicabilityInput; return await checkApplicability(db, input); },