zendesk_assign_ticket
Assign a Zendesk ticket to an agent by their email address, or to yourself by specifying 'me'. Provide ticket ID and assignee email.
Instructions
Assign a Zendesk ticket to an agent by their email address. Pass 'me' as assignee_email to assign the ticket to yourself (the authenticated user).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ticket_id | Yes | ||
| assignee_email | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- Core handler function _assign_ticket_data that looks up user by email (or 'me'), sets assignee_id on the ticket, and updates it via the Zendesk API.
def _assign_ticket_data(ticket_id: int, assignee_email: str) -> str: try: client = get_client() if assignee_email.lower() == "me": user = client.users.me() else: search_results = list(client.search(query=f"type:user email:{assignee_email}")) if not search_results: return f"User not found: no Zendesk user with email: {assignee_email}" user = search_results[0] ticket = Ticket(id=ticket_id) ticket.assignee_id = user.id client.tickets.update(ticket) return f"Ticket #{ticket_id} assigned to {user.name} ({user.email})." except ConfigError as e: return str(e) except Exception as e: if "RecordNotFound" in str(e) or "404" in str(e): return f"Ticket #{ticket_id} not found or not accessible with current credentials." return f"Zendesk API error: {e}" - src/zendesk_mcp/tools/update_ticket.py:104-107 (registration)Tool registration via @mcp.tool() decorator that exposes zendesk_assign_ticket to the MCP protocol.
@mcp.tool() def zendesk_assign_ticket(ticket_id: int, assignee_email: str) -> str: """Assign a Zendesk ticket to an agent by their email address. Pass 'me' as assignee_email to assign the ticket to yourself (the authenticated user).""" return _assign_ticket_data(ticket_id, assignee_email) - src/zendesk_mcp/server.py:38-38 (registration)Top-level registration: register_update_ticket_tools(mcp) is called from main() in the server bootstrap.
register_update_ticket_tools(mcp) - Imports: zenpy Ticket object and get_client/ConfigError from the client module.
import json from zenpy.lib.api_objects import Ticket from zendesk_mcp.client import get_client, ConfigError