search_regulations
Search EU regulations like GDPR and AI Act to find relevant articles with highlighted matches for compliance queries.
Instructions
Search across all EU regulations for articles matching a query. Returns relevant articles with snippets highlighting matches. Token-efficient: returns 32-token snippets per match (safe for context).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query (e.g., "incident reporting", "personal data breach") | |
| regulations | No | Optional: filter to specific regulations (e.g., ["GDPR", "NIS2"]) | |
| limit | No | Maximum results to return (default: 10) |
Implementation Reference
- src/tools/search.ts:270-297 (handler)The handler function 'searchRegulations' that processes the 'search_regulations' tool requests, delegating to either 'searchSqlite' or 'searchPostgres' based on the database type.
export async function searchRegulations( db: DatabaseAdapter, input: SearchInput ): Promise<SearchResult[]> { let { query, regulations, limit = 10 } = input; if (!Number.isFinite(limit) || limit < 0) { limit = 10; } limit = Math.min(Math.floor(limit), 1000); if (!query || query.trim().length === 0) { return []; } try { if (db.type === 'sqlite') { return await searchSqlite(db, query, regulations, limit); } else { return await searchPostgres(db, query, regulations, limit); } } catch (error) { if (error instanceof Error && (error.message.includes('tsquery') || error.message.includes('MATCH'))) { return []; } throw error; } } - src/tools/search.ts:3-7 (schema)Input interface for the 'search_regulations' tool.
export interface SearchInput { query: string; regulations?: string[]; limit?: number; } - src/tools/registry.ts:70-93 (registration)Registration of the 'search_regulations' tool in the tool registry. Note: The snippet shows the registration structure in src/tools/registry.ts.
name: 'search_regulations', description: 'Search across all EU regulations for articles matching a query. Returns relevant articles with snippets highlighting matches. Token-efficient: returns 32-token snippets per match (safe for context).', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query (e.g., "incident reporting", "personal data breach")', }, regulations: { type: 'array', items: { type: 'string' }, description: 'Optional: filter to specific regulations (e.g., ["GDPR", "NIS2"])', }, limit: { type: 'number', description: 'Maximum results to return (default: 10)', }, }, required: ['query'], }, handler: async (db, args) => { const input = args as unknown as SearchInput; return await searchRegulations(db, input);