Skip to main content
Glama
mpeirone

zabbix-mcp-server

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

TableJSON Schema
NameRequiredDescriptionDefault
filterNo
globalmacroidsNo
hostidsNo
outputNoextend
searchNo

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)
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states this is a 'Get' operation (implying read-only) and mentions optional filtering, but doesn't describe authentication requirements, rate limits, pagination behavior, error conditions, or what happens when no macros match. For a tool with 5 parameters and no annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a clear purpose statement followed by parameter and return sections. It's appropriately sized at 7 lines, with each sentence adding value. The front-loaded purpose statement is effective, though the parameter explanations could be more detailed given the 0% schema coverage.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 5 parameters with 0% schema coverage and no output schema, the description provides basic parameter semantics and return format information. However, for a data retrieval tool with complex filtering options ('search' vs 'filter'), it lacks details on query syntax, result structure beyond 'JSON formatted list', and error handling. The absence of annotations increases the need for more comprehensive documentation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description lists all 5 parameters with brief explanations, adding meaningful context beyond the schema (which has 0% description coverage). It clarifies that 'globalmacroids' retrieves specific macros, 'hostids' filters 'for host macros', and 'output' has format options. However, it doesn't explain the difference between 'search' and 'filter' criteria or provide examples of valid values, leaving some ambiguity.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get global macros from Zabbix with optional filtering.' It specifies the verb ('Get'), resource ('global macros'), and system ('Zabbix'), making the purpose unambiguous. However, it doesn't differentiate from sibling tools like 'host_get' or 'user_get' beyond mentioning 'global macros' specifically.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It mentions optional filtering but doesn't explain when filtering is appropriate, what the 'hostids' parameter means in the context of global macros, or how this tool relates to sibling tools like 'host_get' that might retrieve similar data. No explicit when/when-not instructions are provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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