list_organizations
Retrieve and manage Zendesk organizations with pagination support. Define page numbers and limit results per page (up to 100) for efficient organization management via the Zendesk API.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number for pagination | |
| per_page | No | Number of organizations 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 organizations per page (max 100)",
"type": "number"
}
},
"type": "object"
}
Implementation Reference
- src/tools/organizations.js:12-28 (handler)The asynchronous handler function for the 'list_organizations' MCP tool. It constructs params, invokes zendeskClient.listOrganizations, returns formatted JSON response or error.handler: async ({ page, per_page }) => { try { const params = { page, per_page }; const result = await zendeskClient.listOrganizations(params); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error listing organizations: ${error.message}` }], isError: true }; } }
- src/tools/organizations.js:8-11 (schema)Zod input schema defining optional pagination parameters: page and per_page.schema: { page: z.number().optional().describe("Page number for pagination"), per_page: z.number().optional().describe("Number of organizations per page (max 100)") },
- src/tools/organizations.js:5-29 (registration)Tool definition object for 'list_organizations' exported in organizationsTools array.{ name: "list_organizations", description: "List organizations in Zendesk", schema: { page: z.number().optional().describe("Page number for pagination"), per_page: z.number().optional().describe("Number of organizations per page (max 100)") }, handler: async ({ page, per_page }) => { try { const params = { page, per_page }; const result = await zendeskClient.listOrganizations(params); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error listing organizations: ${error.message}` }], isError: true }; } } },
- src/server.js:31-52 (registration)Collection of all tool arrays (including organizationsTools) into allTools and registration loop calling server.tool() for each tool.const allTools = [ ...ticketsTools, ...usersTools, ...organizationsTools, ...groupsTools, ...macrosTools, ...viewsTools, ...triggersTools, ...automationsTools, ...searchTools, ...helpCenterTools, ...supportTools, ...talkTools, ...chatTools, ]; // Register each tool with the server allTools.forEach((tool) => { server.tool(tool.name, tool.schema, tool.handler, { description: tool.description, }); });
- src/zendesk-client.js:122-124 (helper)ZendeskClient helper method that performs the actual API GET request to /organizations.json with params.async listOrganizations(params) { return this.request("GET", "/organizations.json", null, params); }