zendesk_assign_ticket
Assign a Zendesk ticket to an agent by email address. Use 'me' to assign to the authenticated user.
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
- src/zendesk_mcp/tools/update_ticket.py:53-56 (registration)The tool 'zendesk_assign_ticket' is registered as an MCP tool via the @mcp.tool() decorator inside register_update_ticket_tools().
@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) - The actual handler function '_assign_ticket_data' that executes the assignment logic: looks up the user by email (or 'me'), sets ticket.assignee_id, and calls client.tickets.update().
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/server.py:18-27 (registration)The import and call to register_update_ticket_tools in the server's main() function that wires up the tool registration.
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) register_comments_tools(mcp) register_attachment_tools(mcp) register_gitlab_context_tools(mcp) register_write_comment_tools(mcp) register_update_ticket_tools(mcp) - src/zendesk_mcp/client.py:10-16 (helper)The get_client() helper used by the handler to create a Zenpy client.
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) - The function signature defines the schema: ticket_id (int) and assignee_email (str) as required parameters.
def zendesk_assign_ticket(ticket_id: int, assignee_email: str) -> str: