item_get
Retrieve specific Zabbix monitoring items by filtering with item IDs, host IDs, group IDs, or templates. Returns results in JSON format for streamlined data access and integration.
Instructions
Get items from Zabbix with optional filtering.
Args:
itemids: List of item IDs to retrieve
hostids: List of host IDs to filter by
groupids: List of host group IDs to filter by
templateids: List of template IDs to filter by
output: Output format
search: Search criteria
filter: Filter criteria
limit: Maximum number of results
Returns:
str: JSON formatted list of items
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filter | No | ||
| groupids | No | ||
| hostids | No | ||
| itemids | No | ||
| limit | No | ||
| output | No | extend | |
| search | No | ||
| templateids | No |
Input Schema (JSON Schema)
{
"properties": {
"filter": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
"type": "null"
}
],
"default": null,
"title": "Filter"
},
"groupids": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"title": "Groupids"
},
"hostids": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"title": "Hostids"
},
"itemids": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"title": "Itemids"
},
"limit": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Limit"
},
"output": {
"default": "extend",
"title": "Output",
"type": "string"
},
"search": {
"anyOf": [
{
"additionalProperties": {
"type": "string"
},
"type": "object"
},
{
"type": "null"
}
],
"default": null,
"title": "Search"
},
"templateids": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"title": "Templateids"
}
},
"type": "object"
}
Implementation Reference
- src/zabbix_mcp_server.py:325-368 (handler)The primary handler function for the 'item_get' MCP tool. Decorated with @mcp.tool() for automatic registration. Retrieves Zabbix items using the ZabbixAPI client with flexible filtering parameters and formats the response as JSON.def item_get(itemids: Optional[List[str]] = None, hostids: Optional[List[str]] = None, groupids: Optional[List[str]] = None, templateids: Optional[List[str]] = None, output: Union[str, List[str]] = "extend", search: Optional[Dict[str, str]] = None, filter: Optional[Dict[str, Any]] = None, limit: Optional[int] = None) -> str: """Get items from Zabbix with optional filtering. Args: itemids: List of item IDs to retrieve hostids: List of host IDs to filter by groupids: List of host group IDs to filter by templateids: List of template IDs to filter by output: Output format (extend or list of specific fields) search: Search criteria filter: Filter criteria limit: Maximum number of results Returns: str: JSON formatted list of items """ client = get_zabbix_client() params = {"output": output} if itemids: params["itemids"] = itemids if hostids: params["hostids"] = hostids if groupids: params["groupids"] = groupids if templateids: params["templateids"] = templateids if search: params["search"] = search if filter: params["filter"] = filter if limit: params["limit"] = limit result = client.item.get(**params) return format_response(result)