list_users
Retrieve and filter Zendesk user accounts by role with pagination controls for efficient user management.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number for pagination | |
| per_page | No | Number of users per page (max 100) | |
| role | No | Filter users by role |
Implementation Reference
- src/tools/users.js:13-29 (handler)The handler function for the 'list_users' tool. It constructs parameters from input, calls zendeskClient.listUsers, formats the result as JSON text response or error message.handler: async ({ page, per_page, role }) => { try { const params = { page, per_page, role }; const result = await zendeskClient.listUsers(params); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error listing users: ${error.message}` }], isError: true }; } }
- src/tools/users.js:8-12 (schema)Zod schema defining optional input parameters for the list_users tool: page, per_page, and role.schema: { page: z.number().optional().describe("Page number for pagination"), per_page: z.number().optional().describe("Number of users per page (max 100)"), role: z.enum(["end-user", "agent", "admin"]).optional().describe("Filter users by role") },
- src/server.js:48-52 (registration)Generic registration loop that registers all tools, including 'list_users' from usersTools, with the MCP server using server.tool().allTools.forEach((tool) => { server.tool(tool.name, tool.schema, tool.handler, { description: tool.description, }); });
- src/zendesk-client.js:101-102 (helper)ZendeskClient helper method that performs the actual API GET request to /users.json with pagination/filter params.async listUsers(params) { return this.request("GET", "/users.json", null, params);