Skip to main content
Glama

get_ticket_comments

Retrieve all comments for a Zendesk ticket by its ID to view discussion history and support interactions.

Instructions

Retrieve all comments for a Zendesk ticket by its ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ticket_idYesThe ID of the ticket to get comments for

Implementation Reference

  • The actual implementation of fetching ticket comments using the Zenpy client.
    def get_ticket_comments(self, ticket_id: int) -> List[Dict[str, Any]]:
        """
        Get all comments for a specific ticket.
        """
        try:
            comments = self.client.tickets.comments(ticket=ticket_id)
            return [{
                'id': comment.id,
                'author_id': comment.author_id,
                'body': comment.body,
                'html_body': comment.html_body,
                'public': comment.public,
                'created_at': str(comment.created_at)
            } for comment in comments]
        except Exception as e:
            raise Exception(f"Failed to get comments for ticket {ticket_id}: {str(e)}")
  • Tool handler in server.py that routes the "get_ticket_comments" request to the ZendeskClient.
    elif name == "get_ticket_comments":
        if not arguments:
            raise ValueError("Missing arguments")
        comments = zendesk_client.get_ticket_comments(
            arguments["ticket_id"])
        return [types.TextContent(
            type="text",
            text=json.dumps(comments)
        )]
  • Registration of the "get_ticket_comments" tool, defining its schema and description.
        name="get_ticket_comments",
        description="Retrieve all comments for a Zendesk ticket by its ID",
        inputSchema={
            "type": "object",
            "properties": {
                "ticket_id": {
                    "type": "integer",
                    "description": "The ID of the ticket to get comments for"
                }
            },
            "required": ["ticket_id"]
        }
    ),

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