"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.register = register;
const zod_1 = require("zod");
function register(server, mgr) {
    server.registerTool('skills_get', {
        description: 'Get full details of a skill by ID, including steps, triggers, inputHints, filePatterns, ' +
            'usage stats, and cross-graph links. ' +
            'Returns: id, title, description, steps, triggers, inputHints, filePatterns, tags, ' +
            'source, confidence, usageCount, lastUsedAt, createdAt, updatedAt, crossLinks[].',
        inputSchema: {
            skillId: zod_1.z.string().min(1).max(500).describe('Skill ID to retrieve'),
        },
    }, async ({ skillId }) => {
        const skill = mgr.getSkill(skillId);
        if (!skill) {
            return { content: [{ type: 'text', text: 'Skill not found' }], isError: true };
        }
        const { version: _version, ...rest } = skill;
        const clean = (_k, v) => (v === null || (Array.isArray(v) && v.length === 0) ? undefined : v);
        return { content: [{ type: 'text', text: JSON.stringify(rest, clean, 2) }] };
    });
}
