list_views
Retrieve and manage Zendesk views by specifying pagination parameters, enabling efficient organization and access to ticket views.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number for pagination | |
| per_page | No | Number of views 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 views per page (max 100)",
"type": "number"
}
},
"type": "object"
}
Implementation Reference
- src/tools/views.js:12-28 (handler)The async handler function for the "list_views" tool. It accepts optional page and per_page parameters, calls zendeskClient.listViews(params), returns the result as formatted JSON text content, or an error response if failed.handler: async ({ page, per_page }) => { try { const params = { page, per_page }; const result = await zendeskClient.listViews(params); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error listing views: ${error.message}` }], isError: true }; } }
- src/tools/views.js:8-11 (schema)Zod input schema for the "list_views" tool 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 views per page (max 100)") },
- src/server.js:48-52 (registration)The registration loop in the MCP server that registers all tools including "list_views" (via inclusion in allTools which spreads viewsTools) by calling server.tool with name, schema, handler, and description.allTools.forEach((tool) => { server.tool(tool.name, tool.schema, tool.handler, { description: tool.description, }); });
- src/zendesk-client.js:187-189 (helper)Helper method in ZendeskClient that performs the actual API request to list views using GET /views.json with provided params.async listViews(params) { return this.request("GET", "/views.json", null, params); }