zendesk_list_macros
Retrieve all active Zendesk macros with their actions, including field and value for each action.
Instructions
List all active Zendesk macros with their actions. Returns JSON array of {id, title, description, actions: [{field, value}]}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/zendesk_mcp/tools/macros.py:9-25 (handler)Core handler function that fetches all active macros from Zendesk via the client and returns them as a JSON array with id, title, description, and actions.
def _list_macros_data() -> str: try: client = get_client() macros = [m for m in client.macros() if getattr(m, "active", False)] return json.dumps([{ "id": m.id, "title": m.title, "description": getattr(m, "description", None), "actions": [ {"field": getattr(a, "field", None), "value": getattr(a, "value", None)} for a in (getattr(m, "actions", []) or []) ], } for m in macros], indent=2) except ConfigError as e: return str(e) except Exception as e: return f"Zendesk API error: {e}" - Tool registration with MCP decorator. No input parameters; returns a JSON string. The docstring defines the output schema.
def zendesk_list_macros() -> str: """List all active Zendesk macros with their actions. Returns JSON array of {id, title, description, actions: [{field, value}]}.""" return _list_macros_data() - src/zendesk_mcp/server.py:46-46 (registration)Registration call that wires register_macro_tools into the MCP server.
register_macro_tools(mcp) - src/zendesk_mcp/server.py:26-26 (registration)Import of the macro tools registration function into the server.
from zendesk_mcp.tools.macros import register_macro_tools - src/zendesk_mcp/tools/macros.py:1-5 (helper)Imports used by the handler: json, httpx, zenpy Ticket/Comment, and get_client/get_oauth_session/ConfigError.
import json import httpx from zenpy.lib.api_objects import Ticket as ZenpyTicket, Comment from zendesk_mcp.client import get_client, get_oauth_session, ConfigError