Get Servers
whmcs_get_serversRetrieve a list of configured servers from WHMCS, with optional status fetching.
Instructions
Get list of configured servers
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fetchStatus | No | Fetch server status |
Implementation Reference
- src/index.ts:890-905 (registration)The tool 'whmcs_get_servers' is registered using server.registerTool() with input schema accepting an optional 'fetchStatus' boolean parameter.
server.registerTool( 'whmcs_get_servers', { title: 'Get Servers', description: 'Get list of configured servers', inputSchema: { fetchStatus: z.boolean().optional().describe('Fetch server status'), }, }, async (params) => { const result = await whmcsClient.getServers(params); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } ); - src/index.ts:899-905 (handler)The handler function for 'whmcs_get_servers' calls whmcsClient.getServers(params) and returns the result as JSON text.
async (params) => { const result = await whmcsClient.getServers(params); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } ); - src/index.ts:892-898 (schema)Input schema defining the 'fetchStatus' optional boolean parameter for the whmcs_get_servers tool.
{ title: 'Get Servers', description: 'Get list of configured servers', inputSchema: { fetchStatus: z.boolean().optional().describe('Fetch server status'), }, }, - src/whmcs-client.ts:1059-1088 (helper)The getServers() method in WhmcsApiClient class that calls the WHMCS API 'GetServers' action and defines the response type with server list including id, name, hostname, ipaddress, assignedips, active, disabled, type, maxaccounts, statusaddress, and nameserver fields.
/** * Get servers */ async getServers(params: { fetchStatus?: boolean; } = {}) { return this.call<WhmcsApiResponse & { totalresults: number; servers: { server: Array<{ id: number; name: string; hostname: string; ipaddress: string; assignedips: string; active: boolean; disabled: boolean; type: string; maxaccounts: number; statusaddress: string; ns1: string; ns1ip: string; ns2: string; ns2ip: string; ns3: string; ns3ip: string; ns4: string; ns4ip: string; }> }; }>('GetServers', params); }