itemprototype_get
Retrieve item prototypes from Zabbix by specifying item IDs, discovery rule IDs, or host IDs. Filter and format results in JSON for efficient monitoring integration.
Instructions
Get item prototypes from Zabbix with optional filtering.
Args:
itemids: List of item prototype IDs to retrieve
discoveryids: List of discovery rule IDs to filter by
hostids: List of host IDs to filter by
output: Output format
search: Search criteria
filter: Filter criteria
Returns:
str: JSON formatted list of item prototypes
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| discoveryids | No | ||
| filter | No | ||
| hostids | No | ||
| itemids | No | ||
| output | No | extend | |
| search | No |
Input Schema (JSON Schema)
{
"properties": {
"discoveryids": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"title": "Discoveryids"
},
"filter": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
"type": "null"
}
],
"default": null,
"title": "Filter"
},
"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"
},
"output": {
"default": "extend",
"title": "Output",
"type": "string"
},
"search": {
"anyOf": [
{
"additionalProperties": {
"type": "string"
},
"type": "object"
},
{
"type": "null"
}
],
"default": null,
"title": "Search"
}
},
"type": "object"
}
Implementation Reference
- src/zabbix_mcp_server.py:1358-1393 (handler)The handler function for the 'itemprototype_get' MCP tool. It is decorated with @mcp.tool() which also serves as registration. The function calls the Zabbix API to retrieve item prototypes based on the provided parameters and returns a formatted JSON response.@mcp.tool() def itemprototype_get(itemids: Optional[List[str]] = None, discoveryids: 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 item prototypes from Zabbix with optional filtering. Args: itemids: List of item prototype IDs to retrieve discoveryids: List of discovery rule IDs to filter by hostids: List of host IDs to filter by output: Output format (extend or list of specific fields) search: Search criteria filter: Filter criteria Returns: str: JSON formatted list of item prototypes """ client = get_zabbix_client() params = {"output": output} if itemids: params["itemids"] = itemids if discoveryids: params["discoveryids"] = discoveryids if hostids: params["hostids"] = hostids if search: params["search"] = search if filter: params["filter"] = filter result = client.itemprototype.get(**params) return format_response(result)