import { Tool } from '../types/tool';
import { loadToolsFromFile } from './toolLoader';

export async function loadTools(filePath: string): Promise<Tool[]> {
  try {
    return await loadToolsFromFile(filePath);
  } catch (error: unknown) {
    console.error(`Error loading tools:`, error);
    return [];
  }
}

export async function initializeTools(filePath: string): Promise<Record<string, Tool>> {
  const toolsList = await loadTools(filePath);
  const tools: Record<string, Tool> = {};
  
  toolsList.forEach(tool => {
    tools[tool.name] = tool;
  });

  return tools;
}

// The following interface is kept for reference and type checking
export interface StaticAnalysisResult {
  filename: string;
  issues: Array<{
    line: number;
    character: number;
    message: string;
    severity: 'error' | 'warning' | 'info';
  }>;
}