Skip to main content
Glama
koundinya

Zendesk MCP Server

by koundinya

zendesk_get_ticket

Retrieve a specific Zendesk ticket by its ID using the Zendesk MCP Server, enabling efficient access to ticket details for streamlined support management.

Instructions

Get a Zendesk ticket by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ticket_idYesThe ID of the ticket to retrieve

Implementation Reference

  • The handler function for the zendesk_get_ticket tool. It parses the ticket_id, fetches the ticket using the getTicket helper with the global Zendesk client, and returns the result as JSON text or an error message.
    async ({ ticket_id }) => {
      try {
        const result = await getTicket(client, parseInt(ticket_id, 10));
    
        return {
          content: [{
            type: "text",
            text: JSON.stringify(result, null, 2)
          }]
        };
      } catch (error: any) {
        return {
          content: [{
            type: "text",
            text: `Error: ${error.message || 'Unknown error occurred'}`
          }],
          isError: true
        };
      }
    }
  • Input schema using Zod for the zendesk_get_ticket tool, defining ticket_id as a string.
    {
      ticket_id: z.string().describe("The ID of the ticket to retrieve"),
    },
  • Registration of the zendesk_get_ticket tool using server.tool, including name, description, input schema, and handler function.
    server.tool(
      "zendesk_get_ticket",
      "Get a Zendesk ticket by ID",
      {
        ticket_id: z.string().describe("The ID of the ticket to retrieve"),
      },
      async ({ ticket_id }) => {
        try {
          const result = await getTicket(client, parseInt(ticket_id, 10));
    
          return {
            content: [{
              type: "text",
              text: JSON.stringify(result, null, 2)
            }]
          };
        } catch (error: any) {
          return {
            content: [{
              type: "text",
              text: `Error: ${error.message || 'Unknown error occurred'}`
            }],
            isError: true
          };
        }
      }
    );
  • Helper function getTicket that wraps the Zendesk client's tickets.show callback API into a Promise to fetch a ticket by ID.
    export async function getTicket(client: any, ticketId: number): Promise<any> {
      return new Promise((resolve, reject) => {
        client.tickets.show(ticketId, (error: Error | undefined, req: any, result: any) => {
          if (error) {
            reject(error);
          } else {
            resolve(result);
          }
        });
      });
    }

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

Related Tools

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/koundinya/zd-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server