UNPKG

firebase-tools

Version:
35 lines (34 loc) 1.6 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.generate_operation = void 0; const zod_1 = require("zod"); const tool_1 = require("../../tool"); const util_1 = require("../../util"); const fdcExperience_1 = require("../../../gemini/fdcExperience"); const fileUtils_1 = require("../../../dataconnect/fileUtils"); exports.generate_operation = (0, tool_1.tool)({ name: "generate_operation", description: "Generates a single Firebase Data Connect query or mutation based on the currently deployed schema and the provided prompt.", inputSchema: zod_1.z.object({ prompt: zod_1.z .string() .describe("Write the prompt like you're talking to a person, describe the task you're trying to accomplish and give details that are specific to the users request"), service_id: zod_1.z .string() .optional() .describe("Optional: Uses the service ID from the firebase.json file if nothing provided. The service ID of the deployed Firebase resource."), }), annotations: { title: "Generate Data Connect Operation", readOnlyHint: true, }, _meta: { requiresProject: true, requiresAuth: true, requiresGemini: true, }, }, async ({ prompt, service_id }, { projectId, config }) => { const serviceInfo = await (0, fileUtils_1.pickService)(projectId, config, service_id || undefined); const schema = await (0, fdcExperience_1.generateOperation)(prompt, serviceInfo.serviceName, projectId); return (0, util_1.toContent)(schema); });