Skip to main content
Glama

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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),
          },
        ],
      };
    }
  • 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: [],
      },
    },
  • The Zod input validation schema for the 'whoami' tool.
    const WhoamiSchema = z.object({});

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/lightningfaucet/lightning-wallet-mcp'

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