list_groups
Retrieve groups from Zendesk Support with pagination options to manage group listings efficiently using page and per_page parameters.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number for pagination | |
| per_page | No | Number of groups 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 groups per page (max 100)",
"type": "number"
}
},
"type": "object"
}
Implementation Reference
- src/tools/groups.js:12-28 (handler)The main handler function for the 'list_groups' tool. It prepares params from input, calls zendeskClient.listGroups, formats the result as MCP content (JSON string), or returns an error message.handler: async ({ page, per_page }) => { try { const params = { page, per_page }; const result = await zendeskClient.listGroups(params); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error listing groups: ${error.message}` }], isError: true }; } }
- src/tools/groups.js:8-11 (schema)Zod schema defining the optional input parameters 'page' and 'per_page' for pagination.schema: { page: z.number().optional().describe("Page number for pagination"), per_page: z.number().optional().describe("Number of groups per page (max 100)") },
- src/server.js:48-52 (registration)The registration code that iterates over allTools (which includes list_groups from groupsTools) and registers each tool with the MCP server using server.tool(name, schema, handler, description).allTools.forEach((tool) => { server.tool(tool.name, tool.schema, tool.handler, { description: tool.description, }); });
- src/zendesk-client.js:145-147 (helper)Helper method in ZendeskClient that makes the actual API request to list groups with pagination params.async listGroups(params) { return this.request("GET", "/groups.json", null, params); }