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
| Name | Required | Description | Default |
|---|---|---|---|
| identifier | Yes | User ID or email address |
Implementation Reference
- src/lib/firebase/authClient.ts:8-30 (handler)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; } }
- src/index.ts:184-193 (schema)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);