firebase-tools
Version:
Command-Line Interface for Firebase
39 lines (38 loc) • 1.53 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.get_user = void 0;
const zod_1 = require("zod");
const tool_js_1 = require("../../tool.js");
const util_js_1 = require("../../util.js");
const auth_js_1 = require("../../../gcp/auth.js");
exports.get_user = (0, tool_js_1.tool)({
name: "get_user",
description: "Retrieves a user based on an email address, phone number, or UID.",
inputSchema: zod_1.z.object({
email: zod_1.z
.string()
.optional()
.describe("The user's email address. At least one of email, phone_number, or uid must be provided."),
phone_number: zod_1.z
.string()
.optional()
.describe("The user's phone number. At least one of email, phone_number, or uid must be provided."),
uid: zod_1.z
.string()
.optional()
.describe("The user's UID. At least one of email, phone_number, or uid must be provided."),
}),
annotations: {
title: "Get Firebase Auth User",
readOnlyHint: true,
},
_meta: {
requiresAuth: true,
requiresProject: true,
},
}, async ({ email, phone_number, uid }, { projectId }) => {
if (email === undefined && phone_number === undefined && uid === undefined) {
return (0, util_js_1.mcpError)(`No user identifier supplied in auth_get_user tool`);
}
return (0, util_js_1.toContent)(await (0, auth_js_1.findUser)(projectId, email, phone_number, uid));
});
;