whoami
Identify your current role and account details within the Lightning Wallet MCP server, including operator or agent status, ID, name, and balance.
Instructions
Get current context - returns whether you are operating as an operator or agent, along with ID, name, and balance.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:1129-1153 (handler)The MCP tool handler for 'whoami' which processes the request, calls the underlying client, and formats the response.
case 'whoami': { WhoamiSchema.parse(args); const result = await session.requireClient().whoami(); const response: Record<string, unknown> = { success: true, type: result.type, id: result.id, name: result.name, balance_sats: result.balanceSats, }; if (result.type === 'operator') { response.agent_count = result.agentCount; } else { response.budget_limit_sats = result.budgetLimitSats; response.operator_id = result.operatorId; } return { content: [ { type: 'text', text: JSON.stringify(response, null, 2), }, ], }; } - src/lightning-faucet.ts:535-557 (handler)The client implementation that makes the actual API call to the 'whoami' endpoint.
async whoami(): Promise<{ type: 'operator' | 'agent'; id: number; name: string; balanceSats: number; agentCount?: number; // For operators budgetLimitSats?: number; // For agents operatorId?: number; // For agents rawResponse: WhoamiResponse; }> { const result = await this.request<WhoamiResponse>('whoami'); return { type: result.type || 'agent', id: result.id || 0, name: result.name || 'Unknown', balanceSats: result.balance_sats || 0, agentCount: result.agent_count, budgetLimitSats: result.budget_limit_sats, operatorId: result.operator_id, rawResponse: result, }; } - src/index.ts:471-478 (registration)The tool definition for 'whoami' registered in the MCP tool list.
name: 'whoami', description: 'Get current context - returns whether you are operating as an operator or agent, along with ID, name, and balance.', inputSchema: { type: 'object', properties: {}, required: [], }, }, - src/index.ts:157-157 (schema)The Zod input validation schema for the 'whoami' tool.
const WhoamiSchema = z.object({});