"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.mcpRunAiWritebackStructuredOutputSchema = exports.mcpRunAiWritebackArgsSchema = exports.MCP_TOOL_RUN_AI_WRITEBACK_DESCRIPTION = void 0;
const zod_1 = require("zod");
exports.MCP_TOOL_RUN_AI_WRITEBACK_DESCRIPTION = `Tool: run_ai_writeback

Purpose:
Make a change to the dbt project that backs the active Lightdash project by describing it in natural language, then open a pull request with the result. The target GitHub repository and dbt sub-folder are resolved server-side from the active project's dbt connection — you never specify them.

How it works:
- A sandbox is created, the project's GitHub repository is cloned, and the prompt is executed by the Claude Code CLI against the dbt project.
- If the agent changes any files, a branch is committed, pushed, and a pull request is opened. The PR URL is returned.
- If the agent makes no file changes, no PR is opened and prUrl is null.

Requirements:
- An active project must be set first via set_project (or the X-Lightdash-Project header).
- The project's dbt connection must be GitHub-backed, and the organization must have the GitHub App installed.
- The AI writeback feature must be enabled for the organization.

Important:
- This tool is NOT read-only and NOT idempotent — each call can open a new pull request. Use it only when the user explicitly wants to change their dbt project.
- The run is synchronous and can take a few minutes (cloning, running the agent, opening the PR).

Parameters:
- prompt: A clear, self-contained description of the change to make to the dbt project (e.g. "Add a 'total_revenue' metric to the orders model as the sum of amount").

Response shape (MCP CallToolResult):
- content: [{ type: "text", text: "<human-readable summary including the PR URL>" }]
- structuredContent: {
    output:   string,           // the agent's text output
    exitCode: number,           // the sandbox command's exit status
    prUrl:    string | null     // URL of the opened pull request, or null when no changes were made
  }
`;
exports.mcpRunAiWritebackArgsSchema = zod_1.z.object({
    prompt: zod_1.z
        .string()
        .min(1)
        .describe('A clear, self-contained description of the change to make to the dbt project that backs the active Lightdash project.'),
});
exports.mcpRunAiWritebackStructuredOutputSchema = zod_1.z.object({
    output: zod_1.z.string().describe('The text output produced by the agent.'),
    exitCode: zod_1.z.number().int().describe("The sandbox command's exit status."),
    prUrl: zod_1.z
        .string()
        .nullable()
        .describe('URL of the pull request opened from the agent changes, or null when the agent made no file changes.'),
});
//# sourceMappingURL=types.js.map