zendesk_post_comment
Post a public reply on a Zendesk ticket visible to the requester. Use for customer-facing responses.
Instructions
Post a public reply on a Zendesk ticket. The reply is visible to the requester. Use for customer-facing responses.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ticket_id | Yes | ||
| body | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- Handler function for the 'zendesk_post_comment' tool. Calls the shared helper _post_comment_data with public=True.
def zendesk_post_comment(ticket_id: int, body: str) -> str: """Post a public reply on a Zendesk ticket. The reply is visible to the requester. Use for customer-facing responses.""" return _post_comment_data(ticket_id, body, public=True) - Helper function that performs the actual Zendesk API call to post a comment or internal note on a ticket.
def _post_comment_data(ticket_id: int, body: str, public: bool) -> str: try: client = get_client() ticket = Ticket(id=ticket_id) ticket.comment = Comment(body=body, public=public) client.tickets.update(ticket) label = "Public comment" if public else "Internal note" return f"{label} posted successfully on ticket #{ticket_id}." 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/write_comments.py:22-27 (registration)Registration of the tool via the @mcp.tool() decorator inside register_write_comment_tools().
def register_write_comment_tools(mcp) -> None: @mcp.tool() def zendesk_post_comment(ticket_id: int, body: str) -> str: """Post a public reply on a Zendesk ticket. The reply is visible to the requester. Use for customer-facing responses.""" return _post_comment_data(ticket_id, body, public=True) - src/zendesk_mcp/server.py:26-26 (registration)Top-level call in main() that registers the write_comment tools including zendesk_post_comment on the MCP server.
register_write_comment_tools(mcp)