// tools/register-llm-provider-tools.ts — Registers LLM provider MCP tools.
// SPEC-083
import { z } from 'zod';
import { handleConfigureLLMProviders } from './configure-llm-providers-handler.js';
import { handleLLMProviderStatus } from './llm-provider-status-handler.js';
import { safeLicensed } from './safe-handler.js';
import { ConfigureLLMProvidersActionEnum, LoadBalancingStrategyEnum, LLMCapabilityEnum, QualityTierEnum, } from './schemas/llm-provider-schemas.js';
export function registerLLMProviderTools(server) {
    // configure_llm_providers
    server.registerTool('configure_llm_providers', {
        description: 'Configure LLM providers for multi-provider support. ' +
            'Add/remove providers, set failover priority, and choose load balancing strategy. ' +
            'Supports: Anthropic, OpenAI, Google/Gemini, Mistral, Ollama, DeepSeek, and custom providers.',
        inputSchema: {
            action: ConfigureLLMProvidersActionEnum.describe('Action to perform: add | remove | update | set_priority | set_strategy'),
            providerId: z
                .string()
                .optional()
                .describe('Provider ID to remove (required for "remove" action).'),
            provider: z
                .object({
                id: z.string().describe('Unique provider identifier.'),
                name: z.string().describe('Human-readable provider name.'),
                models: z
                    .array(z.object({
                    id: z.string().describe('Model identifier.'),
                    name: z.string().describe('Model display name.'),
                    tier: QualityTierEnum,
                    pricingPerMToken: z.object({
                        input: z.number().describe('Price per 1M input tokens in USD.'),
                        output: z.number().describe('Price per 1M output tokens in USD.'),
                    }),
                    contextWindow: z.number().describe('Maximum context window in tokens.'),
                    maxOutputTokens: z.number().describe('Maximum output tokens.'),
                }))
                    .describe('Available models for this provider.'),
                apiKeyEnv: z.string().describe('Environment variable name for the API key.'),
                baseUrl: z.string().describe('Base URL for the provider API.'),
                capabilities: z.array(LLMCapabilityEnum).describe('Provider capabilities.'),
                keyPattern: z.string().describe('Regex pattern to validate API key format.'),
                rateLimits: z
                    .object({
                    requestsPerMinute: z.number().describe('Max requests per minute.'),
                    tokensPerMinute: z.number().describe('Max tokens per minute.'),
                })
                    .describe('Rate limits for this provider.'),
            })
                .optional()
                .describe('Provider definition (required for "add" and "update" actions).'),
            failoverOrder: z
                .array(z.string())
                .optional()
                .describe('Ordered list of provider IDs for failover priority.'),
            strategy: LoadBalancingStrategyEnum.optional().describe('Load balancing strategy to use.'),
        },
        annotations: { title: 'Configure LLM Providers' },
    }, safeLicensed('configure_llm_providers', (args) => Promise.resolve(handleConfigureLLMProviders(args))));
    // llm_provider_status
    server.registerTool('llm_provider_status', {
        description: 'Show status of all configured LLM providers including health, available models, ' +
            'cost tracking, and recommendations. Displays a summary table with provider health, ' +
            'API key status, model count, and accumulated costs.',
        inputSchema: {
            projectPath: z
                .string()
                .optional()
                .describe('Optional project path to show project-specific cost tracking.'),
            detailed: z.boolean().optional().describe('Show detailed model information per provider.'),
        },
        annotations: { title: 'LLM Provider Status', readOnlyHint: true },
    }, safeLicensed('llm_provider_status', (args) => Promise.resolve(handleLLMProviderStatus(args))));
}
//# sourceMappingURL=register-llm-provider-tools.js.map