get_ticket
Retrieve specific Zendesk ticket details by providing the ticket ID, enabling efficient ticket management and data access through the Zendesk API MCP Server.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Ticket ID |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"id": {
"description": "Ticket ID",
"type": "number"
}
},
"required": [
"id"
],
"type": "object"
}
Implementation Reference
- src/tools/tickets.js:48-67 (handler)The handler function for the 'get_ticket' tool. It takes a ticket ID, fetches the ticket using zendeskClient.getTicket(id), and returns the JSON-formatted result or an error message.handler: async ({ id }) => { try { const result = await zendeskClient.getTicket(id); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error getting ticket: ${error.message}` }, ], isError: true, }; } },
- src/tools/tickets.js:45-47 (schema)Zod schema defining the input for the get_ticket tool: a required ticket ID as a number.schema: { id: z.number().describe("Ticket ID"), },
- src/server.js:48-52 (registration)Loop that registers all tools, including 'get_ticket', to the MCP server by calling server.tool with the tool's name, schema, handler, and description.allTools.forEach((tool) => { server.tool(tool.name, tool.schema, tool.handler, { description: tool.description, }); });
- src/zendesk-client.js:81-83 (helper)Low-level ZendeskClient method that performs the API request to retrieve a specific ticket by ID.async getTicket(id) { return this.request("GET", `/tickets/${id}.json`); }