Skip to main content
Glama

Get Tickets

whmcs_get_tickets

Retrieve support tickets with optional filters for department, client, status, or subject to manage inquiries efficiently.

Instructions

Get support tickets with optional filtering

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitstartNoStarting offset
limitnumNoNumber of results
deptidNoFilter by department ID
clientidNoFilter by client ID
emailNoFilter by email
statusNoFilter by status
subjectNoFilter by subject

Implementation Reference

  • src/index.ts:414-435 (registration)
    Registration of the 'whmcs_get_tickets' MCP tool with input schema and handler that delegates to whmcsClient.getTickets()
    server.registerTool(
        'whmcs_get_tickets',
        {
            title: 'Get Tickets',
            description: 'Get support tickets with optional filtering',
            inputSchema: {
                limitstart: z.number().optional().describe('Starting offset'),
                limitnum: z.number().optional().describe('Number of results'),
                deptid: z.number().optional().describe('Filter by department ID'),
                clientid: z.number().optional().describe('Filter by client ID'),
                email: z.string().optional().describe('Filter by email'),
                status: z.string().optional().describe('Filter by status'),
                subject: z.string().optional().describe('Filter by subject'),
            },
        },
        async (params) => {
            const result = await whmcsClient.getTickets(params);
            return {
                content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
            };
        }
    );
  • Input schema definition for whmcs_get_tickets using Zod validation - defines optional parameters for filtering tickets (limitstart, limitnum, deptid, clientid, email, status, subject)
        inputSchema: {
            limitstart: z.number().optional().describe('Starting offset'),
            limitnum: z.number().optional().describe('Number of results'),
            deptid: z.number().optional().describe('Filter by department ID'),
            clientid: z.number().optional().describe('Filter by client ID'),
            email: z.string().optional().describe('Filter by email'),
            status: z.string().optional().describe('Filter by status'),
            subject: z.string().optional().describe('Filter by subject'),
        },
    },
  • The actual handler implementation - getTickets() method on WhmcsApiClient that calls the WHMCS API 'GetTickets' action with typed parameters and return shape
    /**
     * Get support tickets
     */
    async getTickets(params: {
        limitstart?: number;
        limitnum?: number;
        deptid?: number;
        clientid?: number;
        email?: string;
        status?: string;
        subject?: string;
        ignore_dept_assignments?: boolean;
    } = {}) {
        return this.call<WhmcsApiResponse & {
            totalresults: number;
            startnumber: number;
            numreturned: number;
            tickets: { ticket: Array<{
                id: number;
                tid: string;
                deptid: number;
                deptname: string;
                userid: number;
                name: string;
                email: string;
                cc: string;
                c: string;
                date: string;
                subject: string;
                status: string;
                priority: string;
                admin: string;
                attachment: string;
                lastreply: string;
                flag: number;
                service: string;
            }> };
        }>('GetTickets', params);
    }
  • Generic API call helper method used by getTickets() - handles authentication, POST request to WHMCS API, and error checking
    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;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided. The description does not disclose any behavioral traits such as authentication needs, rate limits, or pagination behavior. Minimal information beyond the basic function.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence, no wasted words. Efficiently communicates the tool's purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With 7 parameters, no output schema, and no annotations, the description is incomplete. It does not explain response format, pagination defaults, or behavior without filters.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with all parameters described. The description adds 'optional filtering' which is already implied by no required params. No additional meaning beyond schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool retrieves support tickets with optional filtering. It is distinct from siblings like whmcs_get_ticket (singular) and whmcs_add_ticket_note/reply.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this vs alternatives like whmcs_get_ticket. Does not mention filtering as optional or provide context for parameters.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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-tool'

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