Skip to main content
Glama

whmcs_get_admin_users

Retrieve a list of WHMCS administrator accounts to manage user permissions and access control within your hosting platform.

Instructions

Get list of admin users

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.ts:998-1011 (registration)
    Registration of the MCP tool 'whmcs_get_admin_users'. Defines title, description, empty input schema, and handler that delegates to whmcsClient.getAdminUsers() and formats response as JSON text.
    server.registerTool( 'whmcs_get_admin_users', { title: 'Get Admin Users', description: 'Get list of admin users', inputSchema: {}, }, async () => { const result = await whmcsClient.getAdminUsers(); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } );
  • Core handler implementation in WhmcsApiClient.getAdminUsers(). Makes authenticated API call to WHMCS 'GetAdminUsers' action, returning typed response with admin user details.
    * Get admin users */ async getAdminUsers() { return this.call<WhmcsApiResponse & { admin_users: Array<{ id: number; uuid: string; roleId: number; username: string; twoFactorAuthModule: string; firstname: string; lastname: string; email: string; signature: string; notes: string; template: string; language: string; isDisabled: boolean; loginAttempts: number; supportDepartmentIds: string; receivesTicketNotifications: string; homeWidgets: string; hiddenMenus: string; fullName: string; gravatarHash: string; }>; }>('GetAdminUsers'); }
  • Input schema for the tool: empty object, indicating no input parameters required.
    inputSchema: {},
  • Generic 'call' helper method used by getAdminUsers() to perform the actual HTTP POST to WHMCS API with authentication and parameter handling.
    async call<T extends WhmcsApiResponse>(action: string, params: Record<string, unknown> = {}): Promise<T> { const url = `${this.config.apiUrl.replace(/\/$/, '')}/includes/api.php`; const postData: Record<string, string> = { identifier: this.config.apiIdentifier, secret: this.config.apiSecret, action: action, responsetype: 'json', ...this.flattenParams(params) }; if (this.config.accessKey) { postData.accesskey = this.config.accessKey; } const response = await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, body: new URLSearchParams(postData).toString(), }); if (!response.ok) { throw new Error(`WHMCS API request failed: ${response.status} ${response.statusText}`); } const data = await response.json() as T; if (data.result === 'error') { throw new Error(`WHMCS API error: ${data.message || 'Unknown error'}`); } return data; } /** * Flatten nested params for URL encoding */ private flattenParams(params: Record<string, unknown>, prefix = ''): Record<string, string> { const result: Record<string, string> = {}; for (const [key, value] of Object.entries(params)) { const newKey = prefix ? `${prefix}[${key}]` : key; if (value === null || value === undefined) { continue; } else if (typeof value === 'object' && !Array.isArray(value)) { Object.assign(result, this.flattenParams(value as Record<string, unknown>, newKey)); } else if (Array.isArray(value)) { value.forEach((item, index) => { if (typeof item === 'object') { Object.assign(result, this.flattenParams(item as Record<string, unknown>, `${newKey}[${index}]`)); } else { result[`${newKey}[${index}]`] = String(item); } }); } else { result[newKey] = String(value); } } return result; }

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/scarecr0w12/whmcs-mcp-server'

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