/**
 * MCP Helper Functions
 */
import { z } from 'zod';
/**
 * Register an MCP tool with strict parameter validation.
 *
 * Uses z.object().strict() so that unknown/extra parameters are rejected
 * with a clear error instead of being silently stripped.
 * See: https://github.com/anthropics/proletariat/issues/366
 */
export function strictTool(server, name, description, shape, handler) {
    const strictSchema = z.object(shape).strict();
    server.registerTool(name, {
        description,
        inputSchema: strictSchema,
    }, handler);
}
export function formatTicket(t) {
    return {
        id: t.id,
        title: t.title,
        priority: t.priority,
        category: t.category,
        statusName: t.statusName,
        statusCategory: t.statusCategory,
        projectId: t.projectId,
        assignee: t.assignee,
        owner: t.owner,
        branch: t.branch,
        epicId: t.epicId,
        position: t.position,
    };
}
export function formatTicketCompact(t) {
    return {
        id: t.id,
        title: t.title,
        priority: t.priority,
        category: t.category,
        assignee: t.assignee,
        statusName: t.statusName,
    };
}
export function formatTicketFull(t) {
    return {
        ...formatTicket(t),
        description: t.description,
        subtasks: t.subtasks,
        labels: t.labels,
        metadata: t.metadata,
        blockedBy: t.blockedBy,
        acceptanceCriteria: t.acceptanceCriteria,
        specId: t.specId,
        createdAt: t.createdAt.toISOString(),
        updatedAt: t.updatedAt.toISOString(),
    };
}
export function successResponse(data) {
    return {
        content: [{
                type: 'text',
                text: JSON.stringify({ success: true, ...data }, null, 2),
            }],
    };
}
export function errorResponse(error) {
    return {
        content: [{
                type: 'text',
                text: JSON.stringify({
                    success: false,
                    error: error instanceof Error ? error.message : 'Unknown error',
                }),
            }],
        isError: true,
    };
}
export function textResponse(text) {
    return {
        content: [{ type: 'text', text }],
    };
}
//# sourceMappingURL=helpers.js.map