Skip to main content
Glama

zendesk_search_tickets

Search Zendesk tickets by keyword and status to retrieve ticket details including subject, status, requester, and dates.

Instructions

Search Zendesk tickets by keyword and/or status. keywords: free-text search (e.g. 'login failure LDAP'). status: new, open, pending, hold, solved, closed — leave empty for all statuses. Returns id, subject, status, requester, assignee, and dates.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keywordsNo
statusNo
limitNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The MCP tool handler function for 'zendesk_search_tickets'. It accepts keyword search, status filter, and limit, then delegates to _search_tickets_data().
    @mcp.tool()
    def zendesk_search_tickets(keywords: str = "", status: str = "", limit: int = 50) -> str:
        """Search Zendesk tickets by keyword and/or status. keywords: free-text search (e.g. 'login failure LDAP'). status: new, open, pending, hold, solved, closed — leave empty for all statuses. Returns id, subject, status, requester, assignee, and dates."""
        return _search_tickets_data(keywords or None, status or None, limit)
  • Core logic for searching tickets. Builds a Zendesk search query, iterates results, extracts ticket data (id, subject, status, priority, requester, assignee, timestamps, description), and returns JSON.
    def _search_tickets_data(keywords: str | None, status: str | None, limit: int) -> str:
        try:
            client = get_client()
            query = "type:ticket"
            if keywords:
                query += f" {keywords}"
            if status:
                query += f" status:{status}"
            results = client.search(query=query, sort_by="created_at", sort_order="desc")
            tickets = []
            for ticket in results:
                if len(tickets) >= limit:
                    break
                tickets.append({
                    "id": ticket.id,
                    "subject": ticket.subject,
                    "status": ticket.status,
                    "priority": ticket.priority,
                    "requester": {
                        "name": ticket.requester.name,
                        "email": ticket.requester.email,
                    },
                    "assignee": {
                        "name": ticket.assignee.name,
                        "email": ticket.assignee.email,
                    } if ticket.assignee else None,
                    "created_at": str(ticket.created_at),
                    "updated_at": str(ticket.updated_at),
                    "description": ticket.description[:300] if ticket.description else "",
                })
            return json.dumps(tickets, indent=2)
        except ConfigError as e:
            return str(e)
        except Exception as e:
            return f"Zendesk API error: {e}"
  • Registration: imports register_ticket_tools from ticket.py and calls it with the mcp server instance.
    from zendesk_mcp.tools.ticket import register_ticket_tools
    from zendesk_mcp.tools.comments import register_comments_tools
    from zendesk_mcp.tools.attachments import register_attachment_tools
    from zendesk_mcp.tools.gitlab_context import register_gitlab_context_tools
    from zendesk_mcp.tools.write_comments import register_write_comment_tools
    from zendesk_mcp.tools.update_ticket import register_update_ticket_tools
    from zendesk_mcp.tools.time_tracking import register_time_tracking_tools
    from zendesk_mcp.tools.git_zen import register_git_zen_tools
    
    register_ticket_tools(mcp)
  • The decorator @mcp.tool() that registers zendesk_search_tickets (and zendesk_get_ticket) as MCP tools.
    def register_ticket_tools(mcp) -> None:
        @mcp.tool()
        def zendesk_get_ticket(ticket_id: int) -> str:
  • Helper: get_client() initializes Zendesk API client (Zenpy) used by _search_tickets_data.
    def get_client(config_file: Path | None = None) -> Zenpy:
        cfg = load_config(config_file)
        subdomain = cfg.get("subdomain", "").strip()
        token = cfg.get("oauth_token", "").strip()
        if not subdomain or not token:
            raise ConfigError("Zendesk not configured. Run: zendesk-mcp setup")
        return Zenpy(subdomain=subdomain, oauth_token=token)
Behavior3/5

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

With no annotations, the description carries the full burden. It describes free-text search, status filtering, and default limit, and lists return fields. However, it lacks information on pagination, sorting, or rate limits, which are important for a search tool.

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 three sentences, front-loads the main action, and each sentence adds valuable information without fluff. It is appropriately sized for the tool's complexity.

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

Completeness3/5

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

Given 3 parameters, no annotations, and the presence of an output schema (though not detailed here), the description covers keywords and status well but omits the limit parameter and does not mention sorting or pagination. It is adequate but not fully complete.

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

Parameters4/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 adds meaning: 'keywords: free-text search (e.g. 'login failure LDAP')' and 'status: new, open, pending, hold, solved, closed — leave empty for all statuses.' However, the 'limit' parameter is not mentioned in the description.

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 'Search Zendesk tickets by keyword and/or status,' with examples for keywords and status values. It distinguishes from sibling tools like zendesk_get_ticket (single ticket) and zendesk_set_ticket_status (update).

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

Usage Guidelines3/5

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

The description explains how to use the tool (by keyword and/or status, with empty status meaning all statuses), but does not explicitly state when not to use it or mention alternative tools like zendesk_get_ticket for specific ticket retrieval.

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/michaelrice/zendesk-mcp'

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