create_view
Create custom views in Zendesk by defining a title and conditions to filter and organize tickets based on specific criteria.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| conditions | Yes | Conditions for the view | |
| description | No | View description | |
| title | Yes | View title |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"conditions": {
"additionalProperties": false,
"description": "Conditions for the view",
"properties": {
"all": {
"items": {
"additionalProperties": false,
"properties": {
"field": {
"description": "Field to filter on",
"type": "string"
},
"operator": {
"description": "Operator for comparison",
"type": "string"
},
"value": {
"description": "Value to compare against"
}
},
"required": [
"field",
"operator"
],
"type": "object"
},
"type": "array"
},
"any": {
"items": {
"additionalProperties": false,
"properties": {
"field": {
"description": "Field to filter on",
"type": "string"
},
"operator": {
"description": "Operator for comparison",
"type": "string"
},
"value": {
"description": "Value to compare against"
}
},
"required": [
"field",
"operator"
],
"type": "object"
},
"type": "array"
}
},
"type": "object"
},
"description": {
"description": "View description",
"type": "string"
},
"title": {
"description": "View title",
"type": "string"
}
},
"required": [
"title",
"conditions"
],
"type": "object"
}
Implementation Reference
- src/tools/views.js:72-92 (handler)The handler function for the 'create_view' MCP tool. It constructs the view data from inputs (title, description, conditions) and delegates to zendeskClient.createView, returning formatted success/error responses.handler: async ({ title, description, conditions }) => { try { const viewData = { title, description, conditions }; const result = await zendeskClient.createView(viewData); return { content: [{ type: "text", text: `View created successfully!\n\n${JSON.stringify(result, null, 2)}` }] }; } catch (error) { return { content: [{ type: "text", text: `Error creating view: ${error.message}` }], isError: true }; }
- src/tools/views.js:56-71 (schema)Zod input schema for 'create_view' tool: required title (string), optional description (string), and conditions object with optional 'all' and 'any' arrays of {field, operator, value} filters.schema: { title: z.string().describe("View title"), description: z.string().optional().describe("View description"), conditions: z.object({ all: z.array(z.object({ field: z.string().describe("Field to filter on"), operator: z.string().describe("Operator for comparison"), value: z.any().describe("Value to compare against") })).optional(), any: z.array(z.object({ field: z.string().describe("Field to filter on"), operator: z.string().describe("Operator for comparison"), value: z.any().describe("Value to compare against") })).optional() }).describe("Conditions for the view") },
- src/server.js:48-52 (registration)Bulk registration of all MCP tools (including 'create_view' from viewsTools) by iterating over allTools array and calling server.tool(name, schema, handler, {description}).allTools.forEach((tool) => { server.tool(tool.name, tool.schema, tool.handler, { description: tool.description, }); });
- src/zendesk-client.js:195-197 (helper)ZendeskClient helper method that performs the actual API POST request to /views.json with {view: data} to create the view, called by the tool handler.async createView(data) { return this.request("POST", "/views.json", { view: data }); }