Skip to main content
Glama
JurreBrandsenInfoSupport

Zendesk API MCP Server

list_chats

Retrieve and manage chat data from Zendesk Chat API. Use pagination parameters to fetch specific chat pages and control the number of chats per page, up to a maximum of 100.

Input Schema

NameRequiredDescriptionDefault
pageNoPage number for pagination
per_pageNoNumber of chats per page (max 100)

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "page": { "description": "Page number for pagination", "type": "number" }, "per_page": { "description": "Number of chats per page (max 100)", "type": "number" } }, "type": "object" }

Implementation Reference

  • The main handler function for the 'list_chats' tool. It accepts optional page and per_page parameters, calls zendeskClient.listChats, stringifies the result as JSON, and returns it in the expected content format, handling errors appropriately.
    handler: async ({ page, per_page }) => { try { const params = { page, per_page }; const result = await zendeskClient.listChats(params); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error listing chats: ${error.message}` }], isError: true }; }
  • Input schema for the list_chats tool, defining optional numeric parameters for pagination using Zod validation.
    schema: { page: z.number().optional().describe("Page number for pagination"), per_page: z.number().optional().describe("Number of chats per page (max 100)") },
  • src/tools/chat.js:4-30 (registration)
    Definition and export of the chatTools array containing the complete 'list_chats' tool configuration (name, description, schema, handler), which is later imported and registered.
    export const chatTools = [ { name: "list_chats", description: "List Zendesk Chat conversations", schema: { page: z.number().optional().describe("Page number for pagination"), per_page: z.number().optional().describe("Number of chats per page (max 100)") }, handler: async ({ page, per_page }) => { try { const params = { page, per_page }; const result = await zendeskClient.listChats(params); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error listing chats: ${error.message}` }], isError: true }; } } } ];
  • Supporting method in the ZendeskClient class that performs the actual API request to list chats using the /chats.json endpoint with provided parameters.
    async listChats(params) { return this.request("GET", "/chats.json", null, params); }
  • src/server.js:48-52 (registration)
    Final registration of the 'list_chats' tool (included in allTools via ...chatTools) on the MCP server using server.tool(), passing name, schema, handler, and description.
    allTools.forEach((tool) => { server.tool(tool.name, tool.schema, tool.handler, { description: tool.description, }); });

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/JurreBrandsenInfoSupport/zendesk-mcp'

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