Skip to main content
Glama
gemini-dk

Firebase MCP Server

by gemini-dk

auth_get_user

Retrieve user details by ID or email from Firebase Authentication to verify identity and access account information.

Instructions

Get a user by ID or email from Firebase Authentication

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
identifierYesUser ID or email address

Implementation Reference

  • The core handler function for the 'auth_get_user' tool. It retrieves a user record from Firebase Authentication by either UID or email address and returns it as a formatted MCP content response.
    export async function getUserByIdOrEmail(identifier: string) {
      try {
        let userRecord;
        if (identifier.includes('@')) {
          // メールアドレスで検索
          userRecord = await admin.auth().getUserByEmail(identifier);
        } else {
          // ユーザIDで検索
          userRecord = await admin.auth().getUser(identifier);
        }
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(userRecord, null, 2)
            }
          ]
        };
      } catch (error) {
        console.error('Error fetching user:', error);
        throw error;
      }
    }
  • Input schema definition for the 'auth_get_user' tool, specifying the required 'identifier' parameter as a string.
    inputSchema: {
      type: "object",
      properties: {
        identifier: {
          type: "string",
          description: "User ID or email address"
        }
      },
      required: ["identifier"]
    }
  • src/index.ts:181-194 (registration)
    Tool registration in the ListTools response, defining name, description, and input schema for 'auth_get_user'.
    {
      name: "auth_get_user",
      description: "Get a user by ID or email from Firebase Authentication",
      inputSchema: {
        type: "object",
        properties: {
          identifier: {
            type: "string",
            description: "User ID or email address"
          }
        },
        required: ["identifier"]
      }
    },
  • src/index.ts:250-251 (registration)
    Switch case in CallToolRequestHandler that dispatches 'auth_get_user' calls to the handler function.
    case 'auth_get_user':
      return getUserByIdOrEmail(args.identifier as string);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/gemini-dk/mcp-server-firebase'

If you have feedback or need assistance with the MCP directory API, please join our Discord server