"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.register = register;
const zod_1 = require("zod");
const defaults_1 = require("../../../lib/defaults");
function register(server, mgr) {
    server.registerTool('skills_recall', {
        description: 'Recall relevant skills for a given task context. Like search_skills but with lower ' +
            'minScore default (0.3) for higher recall. Use at the start of a task to find applicable recipes.',
        inputSchema: {
            context: zod_1.z.string().max(defaults_1.MAX_SEARCH_QUERY_LEN).describe('Description of the current task or context to match skills against'),
            topK: zod_1.z.number().min(1).max(500).optional().describe('How many top similar skills to use as seeds (default 5)'),
            minScore: zod_1.z.number().min(0).max(1).optional().describe('Minimum relevance score 0–1 (default 0.3)'),
            searchMode: zod_1.z.enum(['hybrid', 'vector', 'keyword']).optional().describe('Search mode: hybrid (default, BM25 + vector), vector (embedding only), keyword (BM25 only)'),
        },
    }, async ({ context, topK, minScore, searchMode }) => {
        const results = await mgr.searchSkills(context, { topK, minScore: minScore ?? 0.3, searchMode });
        const clean = (k, v) => (k !== '' && Array.isArray(v) && v.length === 0 ? undefined : v);
        return { content: [{ type: 'text', text: JSON.stringify(results, clean, 2) }] };
    });
}
