Skip to main content
Glama

usermacro_get

Retrieve global macros from Zabbix using optional filters like globalmacroids, hostids, or custom criteria. Output results in JSON format for integration or analysis.

Instructions

Get global macros from Zabbix with optional filtering.

Args: globalmacroids: List of global macro IDs to retrieve hostids: List of host IDs to filter by (for host macros) output: Output format (extend, shorten, or specific fields) search: Search criteria filter: Filter criteria Returns: str: JSON formatted list of global macros

Input Schema

NameRequiredDescriptionDefault
filterNo
globalmacroidsNo
hostidsNo
outputNoextend
searchNo

Input Schema (JSON Schema)

{ "properties": { "filter": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "title": "Filter" }, "globalmacroids": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Globalmacroids" }, "hostids": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Hostids" }, "output": { "default": "extend", "title": "Output", "type": "string" }, "search": { "anyOf": [ { "additionalProperties": { "type": "string" }, "type": "object" }, { "type": "null" } ], "default": null, "title": "Search" } }, "type": "object" }

Implementation Reference

  • Handler function for the usermacro_get tool, decorated with @mcp.tool() for registration and execution. Retrieves user macros (global or host-specific) from Zabbix API.
    @mcp.tool() def usermacro_get(globalmacroids: Optional[List[str]] = None, hostids: Optional[List[str]] = None, output: Union[str, List[str]] = "extend", search: Optional[Dict[str, str]] = None, filter: Optional[Dict[str, Any]] = None) -> str: """Get global macros from Zabbix with optional filtering. Args: globalmacroids: List of global macro IDs to retrieve hostids: List of host IDs to filter by (for host macros) output: Output format (extend or list of specific fields) search: Search criteria filter: Filter criteria Returns: str: JSON formatted list of global macros """ client = get_zabbix_client() params = {"output": output} if globalmacroids: params["globalmacroids"] = globalmacroids if hostids: params["hostids"] = hostids if search: params["search"] = search if filter: params["filter"] = filter result = client.usermacro.get(**params) return format_response(result)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mpeirone/zabbix-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server