Skip to main content
Glama

search_tickets

Search Zendesk tickets using query syntax with filters for status, priority, assignee, requester, tags, custom fields, and date ranges to find specific support requests.

Instructions

Search Zendesk tickets using query syntax. Supports text search, filters, custom fields, and date ranges.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNoText to search in subject/description
statusNoFilter by status: new, open, pending, hold, solved, closed
priorityNoFilter by priority: low, normal, high, urgent
assigneeNoFilter by assignee email
requesterNoFilter by requester email
tagsNoFilter by tags
custom_field_idNoCustom field ID to search
custom_field_valueNoValue to match in custom field
created_afterNoISO date - tickets created after this date
created_beforeNoISO date - tickets created before this date
sort_byNoField to sort by (created_at, updated_at, priority, status)updated_at
sort_orderNoSort order (asc or desc)desc
limitNoMax results (up to 100)

Implementation Reference

  • Actual implementation of search_tickets logic that performs the Zendesk API request and processes results.
    def search_tickets(
        self,
        query: str | None = None,
        status: str | None = None,
        priority: str | None = None,
        assignee: str | None = None,
        requester: str | None = None,
        tags: List[str] | None = None,
        custom_field_id: int | None = None,
        custom_field_value: str | None = None,
        created_after: str | None = None,
        created_before: str | None = None,
        sort_by: str = "updated_at",
        sort_order: str = "desc",
        limit: int = 25,
    ) -> Dict[str, Any]:
        """
        Search Zendesk tickets using query syntax.
    
        Args:
            query: Text to search in subject/description
            status: Filter by status (new, open, pending, hold, solved, closed)
            priority: Filter by priority (low, normal, high, urgent)
            assignee: Filter by assignee email
            requester: Filter by requester email
            tags: Filter by tags
            custom_field_id: Custom field ID to search
            custom_field_value: Value to match in custom field
            created_after: ISO date - tickets created after
            created_before: ISO date - tickets created before
            sort_by: Field to sort by (created_at, updated_at, priority, status)
            sort_order: Sort order (asc or desc)
            limit: Max results (up to 100)
    
        Returns:
            Dict containing tickets and search metadata
        """
        try:
            # Cap limit at 100
            limit = min(limit, 100)
    
            # Build query parts
            query_parts = []
    
            # Always search for tickets (not users, organizations, etc.)
            query_parts.append("type:ticket")
    
            # Text search (searches subject and description)
            if query:
                query_parts.append(query)
    
            # Standard filters
            if status:
                query_parts.append(f"status:{status}")
            if priority:
                query_parts.append(f"priority:{priority}")
            if assignee:
                query_parts.append(f"assignee:{assignee}")
            if requester:
                query_parts.append(f"requester:{requester}")
    
            # Tags
            if tags:
                for tag in tags:
                    query_parts.append(f"tags:{tag}")
    
            # Custom field search
            if custom_field_id and custom_field_value:
                query_parts.append(f"custom_field_{custom_field_id}:{custom_field_value}")
    
            # Date filters
            if created_after:
                query_parts.append(f"created>{created_after}")
            if created_before:
                query_parts.append(f"created<{created_before}")
    
            # Build the full query string
            full_query = " ".join(query_parts)
    
            # Determine sort parameter for API
            sort_param = sort_by
            if sort_order == "desc":
                sort_param = f"-{sort_by}" if not sort_by.startswith("-") else sort_by
    
            # URL encode the query and build URL
            params = {
                "query": full_query,
                "sort_by": sort_param,
                "per_page": str(limit),
            }
            query_string = urllib.parse.urlencode(params)
            url = f"{self.base_url}/search.json?{query_string}"
    
            # Create request with auth header
            req = urllib.request.Request(url)
            req.add_header("Authorization", self.auth_header)
            req.add_header("Content-Type", "application/json")
    
            # Make the API request
            with urllib.request.urlopen(req) as response:
                data = json.loads(response.read().decode())
    
            results = data.get("results", [])
    
            # Process tickets to return only essential fields
            ticket_list = []
            for ticket in results:
                ticket_list.append({
                    "id": ticket.get("id"),
                    "subject": ticket.get("subject"),
                    "status": ticket.get("status"),
                    "priority": ticket.get("priority"),
                    "description": ticket.get("description"),
                    "created_at": ticket.get("created_at"),
                    "updated_at": ticket.get("updated_at"),
                    "requester_id": ticket.get("requester_id"),
                    "assignee_id": ticket.get("assignee_id"),
                    "tags": ticket.get("tags", []),
                })
    
            return {
                "tickets": ticket_list,
                "query": full_query,
                "count": len(ticket_list),
                "total_count": data.get("count", len(ticket_list)),
                "sort_by": sort_by,
                "sort_order": sort_order,
            }
  • Tool definition and registration of search_tickets in the MCP server.
    types.Tool(
        name="search_tickets",
        description="Search Zendesk tickets using query syntax. Supports text search, filters, custom fields, and date ranges.",
        inputSchema={
            "type": "object",
            "properties": {
                "query": {
                    "type": "string",
                    "description": "Text to search in subject/description"
                },
                "status": {
                    "type": "string",
                    "description": "Filter by status: new, open, pending, hold, solved, closed"
                },
                "priority": {
                    "type": "string",
                    "description": "Filter by priority: low, normal, high, urgent"
                },
                "assignee": {
                    "type": "string",
                    "description": "Filter by assignee email"
                },
                "requester": {
                    "type": "string",
                    "description": "Filter by requester email"
                },
                "tags": {
                    "type": "array",
                    "items": {"type": "string"},
                    "description": "Filter by tags"
                },
                "custom_field_id": {
                    "type": "integer",
                    "description": "Custom field ID to search"
                },
                "custom_field_value": {
                    "type": "string",
                    "description": "Value to match in custom field"
                },
                "created_after": {
                    "type": "string",
                    "description": "ISO date - tickets created after this date"
                },
                "created_before": {
                    "type": "string",
                    "description": "ISO date - tickets created before this date"
                },
                "sort_by": {
                    "type": "string",
                    "description": "Field to sort by (created_at, updated_at, priority, status)",
                    "default": "updated_at"
                },
                "sort_order": {
                    "type": "string",
                    "description": "Sort order (asc or desc)",
                    "default": "desc"
                },
                "limit": {
                    "type": "integer",
                    "description": "Max results (up to 100)",
                    "default": 25
                }
            },
            "required": []
        }
    )
  • MCP handler branch for search_tickets that calls the zendesk_client method.
    elif name == "search_tickets":
        results = zendesk_client.search_tickets(
            query=arguments.get("query") if arguments else None,
            status=arguments.get("status") if arguments else None,
            priority=arguments.get("priority") if arguments else None,
            assignee=arguments.get("assignee") if arguments else None,
            requester=arguments.get("requester") if arguments else None,
            tags=arguments.get("tags") if arguments else None,
            custom_field_id=arguments.get("custom_field_id") if arguments else None,
            custom_field_value=arguments.get("custom_field_value") if arguments else None,
            created_after=arguments.get("created_after") if arguments else None,
            created_before=arguments.get("created_before") if arguments else None,
            sort_by=arguments.get("sort_by", "updated_at") if arguments else "updated_at",
            sort_order=arguments.get("sort_order", "desc") if arguments else "desc",
            limit=arguments.get("limit", 25) if arguments else 25,
        )
        return [types.TextContent(
            type="text",
            text=json.dumps(results, indent=2)
        )]
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions support for query syntax, filters, and date ranges, but lacks critical details such as authentication requirements, rate limits, pagination behavior, error handling, or what the output looks like (e.g., list of tickets). This is inadequate for a search tool with 13 parameters.

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 and lists key capabilities without waste. Every word contributes to understanding the tool's scope, making it appropriately concise 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 (13 parameters, no annotations, no output schema), the description is incomplete. It lacks behavioral details (e.g., how results are returned, limits, errors), usage context relative to siblings, and output information. For a search tool with rich parameters, this leaves significant gaps for an AI agent.

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 description coverage is 100%, so the schema fully documents all 13 parameters with descriptions, defaults, and enums. The description adds minimal value by summarizing supported features (text search, filters, custom fields, date ranges), but does not provide additional syntax, examples, or constraints beyond the schema. Baseline 3 is appropriate as the schema does the heavy lifting.

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 tool's purpose: 'Search Zendesk tickets using query syntax.' It specifies the resource (Zendesk tickets) and action (search), but does not explicitly differentiate from sibling tools like 'get_tickets', which might also retrieve tickets but potentially without search capabilities.

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?

The description provides no guidance on when to use this tool versus alternatives like 'get_tickets' or 'get_ticket'. It mentions supported features (text search, filters, etc.) but does not specify use cases, prerequisites, or exclusions, leaving the agent to infer usage.

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

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