whmcs_get_servers
Retrieve a list of configured servers from WHMCS, with an option to fetch their current status for management purposes.
Instructions
Get list of configured servers
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fetchStatus | No | Fetch server status |
Implementation Reference
- src/whmcs-client.ts:1046-1075 (handler)Core handler implementation: the getServers() method in WhmcsApiClient that calls the WHMCS 'GetServers' API action to retrieve the list of configured servers./** * 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); }
- src/index.ts:871-886 (registration)MCP tool registration for 'whmcs_get_servers', including title, description, input schema validation, and thin handler wrapper that invokes whmcsClient.getServers().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:876-878 (schema)Zod input schema definition for the whmcs_get_servers tool parameters.inputSchema: { fetchStatus: z.boolean().optional().describe('Fetch server status'), },
- src/index.ts:1741-1769 (helper)Registers a read-only resource 'whmcs://servers' that fetches and provides server data using the same getServers method.server.registerResource( 'whmcs-servers', 'whmcs://servers', { title: 'Configured Servers', description: 'List of servers configured in WHMCS for service provisioning', mimeType: 'application/json', }, async (uri) => { try { const servers = await whmcsClient.getServers({}); return { contents: [{ uri: uri.href, mimeType: 'application/json', text: JSON.stringify(servers, null, 2), }], }; } catch (error) { return { contents: [{ uri: uri.href, mimeType: 'application/json', text: JSON.stringify({ error: 'Failed to fetch servers' }), }], }; } } );