firebase-tools
Version:
Command-Line Interface for Firebase
44 lines (43 loc) • 2.12 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.get_sample_crash = void 0;
const zod_1 = require("zod");
const tool_1 = require("../../tool");
const util_1 = require("../../util");
const getSampleCrash_1 = require("../../../crashlytics/getSampleCrash");
exports.get_sample_crash = (0, tool_1.tool)({
name: "get_sample_crash_for_issue",
description: "Gets the sample crash for an issue.",
inputSchema: zod_1.z.object({
app_id: zod_1.z
.string()
.describe("AppId for which the issues list should be fetched. For an Android application, read the mobilesdk_app_id value specified in the google-services.json file for the current package name. For an iOS Application, read the GOOGLE_APP_ID from GoogleService-Info.plist. If neither is available, use the `firebase_list_apps` tool to find an app_id to pass to this tool."),
issue_id: zod_1.z
.string()
.describe("The issue Id for which the sample crash needs to be fetched. This is the value of the field `id` in the list of issues. Defaults to the first id in the list of issues."),
variant_id: zod_1.z
.string()
.optional()
.describe("The issue variant Id used as a filter to get sample issues."),
sample_count: zod_1.z
.number()
.describe("Number of samples that needs to be fetched. Maximum value is 3. Defaults to 1.")
.default(1),
}),
annotations: {
title: "Gets a sample of a crash for a specific issue.",
readOnlyHint: true,
},
_meta: {
requiresAuth: true,
requiresProject: false,
},
}, async ({ app_id, issue_id, variant_id, sample_count }) => {
if (!app_id)
return (0, util_1.mcpError)(`Must specify 'app_id' parameter.`);
if (!issue_id)
return (0, util_1.mcpError)(`Must specify 'issue_id' parameter.`);
if (sample_count > 3)
sample_count = 3;
return (0, util_1.toContent)(await (0, getSampleCrash_1.getSampleCrash)(app_id, issue_id, sample_count, variant_id));
});