Skip to main content
Glama

whmcs_get_todo_items

Retrieve admin to-do items from WHMCS with options to filter by status and paginate results for efficient task management.

Instructions

Get admin to-do items

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitstartNoStarting offset
limitnumNoNumber of results
statusNoFilter by status

Implementation Reference

  • The handler function `getToDoItems` in WhmcsApiClient class that performs the actual WHMCS API call to 'GetToDoItems' action, handling parameters and response typing.
     * Get to-do items
     */
    async getToDoItems(params: {
        limitstart?: number;
        limitnum?: number;
        status?: 'Incomplete' | 'Complete' | 'Pending';
    } = {}) {
        return this.call<WhmcsApiResponse & {
            totalresults: number;
            startnumber: number;
            numreturned: number;
            items: { item: Array<{
                id: number;
                date: string;
                title: string;
                description: string;
                status: string;
                duedate: string;
                admin: number;
                adminname: string;
            }> };
        }>('GetToDoItems', params);
    }
  • src/index.ts:1124-1141 (registration)
    The MCP tool registration for 'whmcs_get_todo_items' including title, description, Zod input schema validation, and handler wrapper that delegates to WhmcsApiClient.
        'whmcs_get_todo_items',
        {
            title: 'Get To-Do Items',
            description: 'Get admin to-do items',
            inputSchema: {
                limitstart: z.number().optional().describe('Starting offset'),
                limitnum: z.number().optional().describe('Number of results'),
                status: z.enum(['Incomplete', 'Complete', 'Pending']).optional().describe('Filter by status'),
            },
        },
        async (params) => {
            const result = await whmcsClient.getToDoItems(params);
            return {
                content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
            };
        }
    );
  • Zod input schema for the whmcs_get_todo_items tool defining optional parameters for pagination and status filtering.
            limitstart: z.number().optional().describe('Starting offset'),
            limitnum: z.number().optional().describe('Number of results'),
            status: z.enum(['Incomplete', 'Complete', 'Pending']).optional().describe('Filter by status'),
        },
    },
  • Generic `call` method in WhmcsApiClient that powers all API interactions, used by getToDoItems to make the actual HTTP request to WHMCS API.
    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;
    }

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