// tools/estimate-ai-cost.ts — Handler for the estimate_ai_cost MCP tool.
// Estimates token counts and USD costs for implementing a spec with various AI models.
import { estimateAiCost } from '../engine/ai-cost-estimator/index.js';
/**
 * Handles the estimate_ai_cost tool.
 * Reads spec content, calculates token estimates, and returns a cost breakdown
 * for all configured AI models as a markdown table with a recommendation.
 */
export async function handleEstimateAiCost(args) {
    if (!args.specId || args.specId.trim() === '') {
        return {
            content: [
                {
                    type: 'text',
                    text: 'Error: specId is required. Provide a spec ID such as "SPEC-069".',
                },
            ],
            isError: true,
        };
    }
    const result = await estimateAiCost({
        specId: args.specId.trim(),
        projectPath: args.projectPath?.trim() ?? undefined,
    });
    return {
        content: [{ type: 'text', text: result.markdownTable }],
    };
}
//# sourceMappingURL=estimate-ai-cost.js.map