"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const zod_1 = require("zod");
const mcpMablTool_1 = require("./mcpMablTool");
const testUtils_1 = require("../utils/testUtils");
const common_1 = require("../utils/common");
const getMablTestDetails = (0, mcpMablTool_1.defineTool)({
    schema: {
        name: 'get_mabl_test_details',
        title: 'Get the details of a mabl test',
        description: 'Get the details of a mabl test based on a testId. Example: Get the details of mabl test 123',
        inputSchema: zod_1.z.object({
            testId: zod_1.z.string().describe('The id of the mabl test to get'),
        }),
        type: 'readOnly',
        outputSchema: testUtils_1.testOutputSchema,
    },
    handle: async (params, context) => {
        const { mablApiClient } = context.getCurrentContext();
        const test = await mablApiClient.getJourney(params.testId);
        const result = (0, testUtils_1.normalizeTest)(test);
        return {
            content: [
                {
                    type: 'text',
                    text: (0, common_1.jsonPrettyPrint)(result),
                },
            ],
            structuredContent: result,
        };
    },
});
exports.default = [getMablTestDetails];
