"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.register = register;
const zod_1 = require("zod");
function register(server, mgr) {
    server.registerTool('tasks_get', {
        description: 'Get full details of a task by ID, including subtasks, blockers, related tasks, and cross-graph links. ' +
            'Returns: id, title, description, status, priority, tags, dueDate, estimate, ' +
            'completedAt, createdAt, updatedAt, subtasks[], blockedBy[], blocks[], related[], crossLinks[].',
        inputSchema: {
            taskId: zod_1.z.string().min(1).max(500).describe('Task ID to retrieve (slug, e.g. "fix-auth-redirect-loop")'),
        },
    }, async ({ taskId }) => {
        const task = mgr.getTask(taskId);
        if (!task) {
            return { content: [{ type: 'text', text: 'Task not found' }], isError: true };
        }
        const { version: _version, ...rest } = task;
        const clean = (_k, v) => (v === null || (Array.isArray(v) && v.length === 0) ? undefined : v);
        return { content: [{ type: 'text', text: JSON.stringify(rest, clean, 2) }] };
    });
}
