UNPKG

firebase-tools

Version:
34 lines (33 loc) 1.61 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.generate_operation = void 0; const zod_1 = require("zod"); const tool_js_1 = require("../../tool.js"); const util_js_1 = require("../../util.js"); const fdcExperience_js_1 = require("../../../gemini/fdcExperience.js"); const fileUtils_js_1 = require("../../../dataconnect/fileUtils.js"); exports.generate_operation = (0, tool_js_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, }, }, async ({ prompt, service_id }, { projectId, config }) => { const serviceInfo = await (0, fileUtils_js_1.pickService)(projectId, config, service_id || undefined); const schema = await (0, fdcExperience_js_1.generateOperation)(prompt, serviceInfo.serviceName, projectId); return (0, util_js_1.toContent)(schema); });