get_macro
Retrieve a specific macro from Zendesk Support using its ID to automate ticket responses and streamline customer service workflows.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Macro ID |
Implementation Reference
- src/tools/macros.js:36-51 (handler)The handler function for the 'get_macro' tool, which retrieves a specific macro by ID from Zendesk and returns the JSON response or an error message.handler: async ({ id }) => { try { const result = await zendeskClient.getMacro(id); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error getting macro: ${error.message}` }], isError: true }; } }
- src/tools/macros.js:33-35 (schema)Zod schema for the 'get_macro' tool input, requiring a numeric 'id' parameter.schema: { id: z.number().describe("Macro ID") },
- src/server.js:47-52 (registration)Registration loop that registers all tools, including 'get_macro' from macrosTools, using server.tool(name, schema, handler).// Register each tool with the server allTools.forEach((tool) => { server.tool(tool.name, tool.schema, tool.handler, { description: tool.description, }); });
- src/zendesk-client.js:170-172 (helper)The underlying getMacro method in ZendeskClient that makes the API request to fetch the macro by ID.async getMacro(id) { return this.request("GET", `/macros/${id}.json`); }