import { READ_ONLY_ANNOTATIONS } from '../common/tool-utils.js'; import type { RegisterJsonToolFn } from '../common/tool-utils.js'; import { BUNDLE_RESULT_SCHEMA } from '../common/schemas.js'; interface MemoryService { audit(): Promise; } export interface RegisterAuditToolsOptions { registerJsonTool: RegisterJsonToolFn; memory: MemoryService; } export function registerAuditTools({ registerJsonTool, memory }: RegisterAuditToolsOptions): void { registerJsonTool( 'localnest_audit', { title: 'Audit', description: 'Run a comprehensive self-audit of LocalNest health. Returns memory coverage by project, ' + 'KG density metrics (entities, triples, orphans, duplicates, connected components), ' + 'unpopulated nests, broken bridges, stale memories, a 0-100 health score, and actionable suggestions. ' + 'Call once to get a full integrity dashboard.', inputSchema: {}, annotations: READ_ONLY_ANNOTATIONS, outputSchema: BUNDLE_RESULT_SCHEMA }, async () => memory.audit() ); }