Skip to main content
Glama
effytech

Freshdesk MCP server

by effytech

get_tickets

Retrieve and manage support tickets from Freshdesk with pagination support, enabling efficient handling of large datasets for streamlined customer service operations.

Instructions

Get tickets from Freshdesk with pagination support.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNo
per_pageNo

Implementation Reference

  • The core handler function for the 'get_tickets' MCP tool, decorated with @mcp.tool() for registration. It fetches tickets from the Freshdesk API endpoint /api/v2/tickets, supports pagination via page and per_page parameters, validates inputs, parses the Link header for pagination info using the helper parse_link_header, and returns tickets with pagination metadata or error messages.
    @mcp.tool()
    async def get_tickets(page: Optional[int] = 1, per_page: Optional[int] = 30) -> Dict[str, Any]:
        """Get tickets from Freshdesk with pagination support."""
        # Validate input parameters
        if page < 1:
            return {"error": "Page number must be greater than 0"}
    
        if per_page < 1 or per_page > 100:
            return {"error": "Page size must be between 1 and 100"}
    
        url = f"https://{FRESHDESK_DOMAIN}/api/v2/tickets"
    
        params = {
            "page": page,
            "per_page": per_page
        }
    
        headers = {
            "Authorization": f"Basic {base64.b64encode(f'{FRESHDESK_API_KEY}:X'.encode()).decode()}",
            "Content-Type": "application/json"
        }
    
        async with httpx.AsyncClient() as client:
            try:
                response = await client.get(url, headers=headers, params=params)
                response.raise_for_status()
    
                # Parse pagination from Link header
                link_header = response.headers.get('Link', '')
                pagination_info = parse_link_header(link_header)
    
                tickets = response.json()
    
                return {
                    "tickets": tickets,
                    "pagination": {
                        "current_page": page,
                        "next_page": pagination_info.get("next"),
                        "prev_page": pagination_info.get("prev"),
                        "per_page": per_page
                    }
                }
    
            except httpx.HTTPStatusError as e:
                return {"error": f"Failed to fetch tickets: {str(e)}"}
            except Exception as e:
                return {"error": f"An unexpected error occurred: {str(e)}"}
  • Supporting utility function that parses the Freshdesk API's Link header to extract 'next' and 'prev' pagination page numbers. Called within the get_tickets handler to provide pagination metadata in the response.
    def parse_link_header(link_header: str) -> Dict[str, Optional[int]]:
        """Parse the Link header to extract pagination information.
    
        Args:
            link_header: The Link header string from the response
    
        Returns:
            Dictionary containing next and prev page numbers
        """
        pagination = {
            "next": None,
            "prev": None
        }
    
        if not link_header:
            return pagination
    
        # Split multiple links if present
        links = link_header.split(',')
    
        for link in links:
            # Extract URL and rel
            match = re.search(r'<(.+?)>;\s*rel="(.+?)"', link)
            if match:
                url, rel = match.groups()
                # Extract page number from URL
                page_match = re.search(r'page=(\d+)', url)
                if page_match:
                    page_num = int(page_match.group(1))
                    pagination[rel] = page_num
    
        return pagination
  • The @mcp.tool() decorator registers the get_tickets function as an MCP tool.
    @mcp.tool()
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions 'pagination support', which is a useful behavioral trait, but doesn't disclose other critical aspects like authentication needs, rate limits, error handling, or what data is returned (e.g., ticket fields). For a read operation with no annotation coverage, this leaves significant gaps.

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?

The description is a single, efficient sentence that front-loads the core purpose ('Get tickets from Freshdesk') and adds a key behavioral note ('with pagination support'). There is no wasted verbiage, making it appropriately sized and well-structured.

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?

Given the complexity (a read operation with pagination), lack of annotations, and no output schema, the description is incomplete. It doesn't cover parameter details, return values, error cases, or usage context, leaving the agent with insufficient information to invoke the tool effectively.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. It doesn't explain the parameters 'page' or 'per_page' at all—no details on their purpose, default values, or constraints. The mention of 'pagination support' only hints at their existence without adding meaningful semantics.

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

Purpose4/5

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

The description clearly states the verb ('Get') and resource ('tickets from Freshdesk'), making the purpose specific and understandable. It distinguishes from siblings like 'get_ticket' (singular) and 'search_tickets' by focusing on paginated retrieval of multiple tickets, though it doesn't explicitly name these alternatives.

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 is provided on when to use this tool versus alternatives like 'search_tickets' or 'get_ticket'. The description mentions pagination support, which implies usage for bulk retrieval, but doesn't specify contexts, prerequisites, or exclusions.

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

Related 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/effytech/freshdesk_mcp'

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