Skip to main content
Glama

update_ticket

Modify existing Zendesk tickets by updating status, priority, assignee, tags, or custom fields to manage support workflows and track issue resolution.

Instructions

Update fields on an existing Zendesk ticket (e.g., status, priority, assignee_id)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ticket_idYesThe ID of the ticket to update
subjectNo
statusNonew, open, pending, on-hold, solved, closed
priorityNolow, normal, high, urgent
typeNo
assignee_idNo
requester_idNo
tagsNo
custom_fieldsNo
due_atNoISO8601 datetime

Implementation Reference

  • The implementation of the `update_ticket` method in the Zendesk client, which handles the logic for updating ticket fields via the Zenpy library.
    def update_ticket(self, ticket_id: int, **fields: Any) -> Dict[str, Any]:
        """
        Update a Zendesk ticket with provided fields using Zenpy.
    
        Supported fields include common ticket attributes like:
        subject, status, priority, type, assignee_id, requester_id,
        tags (list[str]), custom_fields (list[dict]), due_at, etc.
        """
        try:
            # Load the ticket, mutate fields directly, and update
            ticket = self.client.tickets(id=ticket_id)
            for key, value in fields.items():
                if value is None:
                    continue
                setattr(ticket, key, value)
    
            # This call returns a TicketAudit (not a Ticket). Don't read attrs from it.
            self.client.tickets.update(ticket)
    
            # Fetch the fresh ticket to return consistent data
            refreshed = self.client.tickets(id=ticket_id)
    
            return {
                'id': refreshed.id,
                'subject': refreshed.subject,
                'description': refreshed.description,
                'status': refreshed.status,
                'priority': refreshed.priority,
                'type': getattr(refreshed, 'type', None),
                'created_at': str(refreshed.created_at),
                'updated_at': str(refreshed.updated_at),
                'requester_id': refreshed.requester_id,
                'assignee_id': refreshed.assignee_id,
                'organization_id': refreshed.organization_id,
                'tags': list(getattr(refreshed, 'tags', []) or []),
            }
        except Exception as e:
            raise Exception(f"Failed to update ticket {ticket_id}: {str(e)}")
  • Registration of the `update_ticket` tool with its input schema.
    types.Tool(
        name="update_ticket",
        description="Update fields on an existing Zendesk ticket (e.g., status, priority, assignee_id)",
        inputSchema={
            "type": "object",
            "properties": {
                "ticket_id": {"type": "integer", "description": "The ID of the ticket to update"},
                "subject": {"type": "string"},
                "status": {"type": "string", "description": "new, open, pending, on-hold, solved, closed"},
                "priority": {"type": "string", "description": "low, normal, high, urgent"},
                "type": {"type": "string"},
                "assignee_id": {"type": "integer"},
                "requester_id": {"type": "integer"},
                "tags": {"type": "array", "items": {"type": "string"}},
                "custom_fields": {"type": "array", "items": {"type": "object"}},
                "due_at": {"type": "string", "description": "ISO8601 datetime"}
            },
            "required": ["ticket_id"]
        }
    ),
  • Handler logic in `server.py` that processes the `update_ticket` tool call and invokes the Zendesk client.
    elif name == "update_ticket":
        if not arguments:
            raise ValueError("Missing arguments")
        ticket_id = arguments.get("ticket_id")
        if ticket_id is None:
            raise ValueError("ticket_id is required")
        update_fields = {k: v for k, v in arguments.items() if k != "ticket_id"}
        updated = zendesk_client.update_ticket(ticket_id=int(ticket_id), **update_fields)
        return [types.TextContent(
            type="text",
            text=json.dumps({"message": "Ticket updated successfully", "ticket": updated}, indent=2)
        )]

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