Skip to main content
Glama
Zabbix MCP Server

Zabbix MCP Server

history_get

Read-only

Retrieve historical item data (collected metric values) from Zabbix by item or host ID, with time range, data type, sorting and filtering. Use it to inspect raw metric values over a period.

Instructions

Retrieve historical item data (collected metric values). History stores every collected value and is the most granular data source in Zabbix. Always specify the 'history' parameter to select the correct data type (0=numeric float, 1=character/string, 2=log, 3=numeric unsigned, 4=text, 5=binary on 7.0+, 6=JSON on 8.0+; Zabbix assumes 3 when omitted). Use 'time_from' and 'time_till' (Unix timestamp, ISO 8601 or a relative time such as now-1h) to bound the time range. Combine with 'itemids' or 'hostids' to target specific metrics. For long time ranges, consider using trend.get instead as it returns aggregated min/avg/max values and is more efficient. With 'itemids' the newest values come first unless a sort is given, so 'limit' keeps the latest ones. Identifiers come first: an item ID cannot be derived from a host name or a metric name, it has to be looked up. Resolve it with item_get (hostids or a host filter plus search on key_ or name; output itemid, name, key_, value_type, units), then pass the IDs as 'itemids' and the item's value_type as 'history'. For one item known by host name and key, item_history_summary_get does the lookup itself and returns the values with min / avg / max in one call.

Input Schema

NameRequiredDescriptionDefault
limitNoMaximum number of results to return.
filterNoReturn only results whose properties exactly match the given values (a single value or a list of values per key). Example: {"status": 0} or {"status": [0, 1]}. Keys: clock, itemid, ns, value. Text properties cannot be filtered; use 'search' for them.
outputNoProperties of the history object to return. Pass 'extend' for all, 'count' for the number of matches only, or a list of property names. Default when omitted: 'extend'. Properties: clock, itemid, ns, value.
searchNoReturn results that match the given pattern (case-insensitive by default). Example: {"name": "web"} finds 'Web Server', 'my-web-app', etc.
serverNoTarget Zabbix server. Available: default. Defaults to 'default' if omitted.
historyNoHistory data type to retrieve: 0=numeric float, 1=character/string, 2=log, 3=numeric unsigned (Zabbix default when omitted), 4=text, 5=binary (7.0+), 6=JSON (8.0+). Must match the item's value_type, otherwise the result is empty.
hostidsNoReturn only history for the given host IDs.
itemidsNoReturn only history for the given item IDs (from item_get; never guessed). Needed for a scoped answer: without itemids or hostids the call returns the values of every item of the selected type.
raw_jsonNoStrips the security disclaimer preamble from the response so it is pure JSON. Default: false. Requires the bearer token to have 'allow_raw_json' explicitly enabled by an operator in the admin portal - tokens without that policy receive a PolicyError instead. WARNING: setting true bypasses the prompt-injection mitigation marker that wraps untrusted Zabbix data (host names, item descriptions, problem text). LLM clients (Claude, GPT, Cursor, ...) should leave this false; only programmatic non-LLM consumers (Python scripts, n8n workflows that json.loads the result) should set true.
sortfieldNoSort by one or more of: itemid, clock, ns (7.0+) (a list for several; pair with 'sortorder'). No other property is sortable. When omitted and 'itemids' is given, the result is sorted by clock with the newest first. Without 'itemids' nothing is sorted.
sortorderNoSort order: 'ASC' (ascending) or 'DESC' (descending). 'DESC' while 'sortfield' is omitted (newest first); 'ASC' alone returns the oldest first.
time_fromNoReturn only data collected after this time (Unix timestamp, ISO 8601 date-time such as 2026-04-01T08:00:00Z, or a relative time such as now-1h, now/d or now-7d/d; a value without a zone is read in the zone resolved for the call) (inclusive).
time_tillNoReturn only data collected before this time (Unix timestamp, ISO 8601 date-time such as 2026-04-01T08:00:00Z, or a relative time such as now-1h, now/d or now-7d/d; a value without a zone is read in the zone resolved for the call) (inclusive).
countOutputNoReturn the count of matching results instead of the actual data.
searchByAnyNoIf true, return results matching ANY search field (OR). Default is ALL fields (AND).
extra_paramsNoOther native history.get parameters, merged into the request as-is. Parameters: maxValueSize (8.0+). Any other key is refused here, because Zabbix would silently ignore it. For a parameter you are sure exists on your release but is not listed, use zabbix_raw_api_call.
searchWildcardsEnabledNoIf true, enable * and ? wildcards in search patterns.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed12 schema fields changedv1.42.2
    • addedInput schema / additionalProperties
      Added value: +false
    • changedInput schema / properties / extra_params / anyOf
      Previous value: -[
      -  {
      -    "additionalProperties": true,
      -    "type": "object"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "propertyNames": {
      +      "enum": [
      +        "editable",
      +        "excludeSearch",
      +        "startSearch",
      +        "maxValueSize"
      +      ]
      +    },
      +    "type": "object"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / properties / filter / anyOf
      Previous value: -[
      -  {
      -    "additionalProperties": true,
      -    "type": "object"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "propertyNames": {
      +      "enum": [
      +        "clock",
      +        "itemid",
      +        "ns",
      +        "value"
      +      ]
      +    },
      +    "type": "object"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / properties / history / anyOf
      Previous value: -[
      -  {
      -    "type": "integer"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "enum": [
      +      0,
      +      1,
      +      2,
      +      3,
      +      4,
      +      5,
      +      6
      +    ],
      +    "type": "integer"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / properties / itemids / description
      Previous value: -"Return only history for the given item IDs."New value: +"Return only history for the given item IDs (from item_get; never guessed). Needed for a scoped answer: without itemids or hostids the call returns the values of every item of the selected type."
    • changedInput schema / properties / output / anyOf
      Previous value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "enum": [
      +      "extend",
      +      "count"
      +    ],
      +    "type": "string"
      +  },
      +  {
      +    "items": {
      +      "enum": [
      +        "clock",
      +        "itemid",
      +        "ns",
      +        "value"
      +      ],
      +      "type": "string"
      +    },
      +    "minItems": 1,
      +    "type": "array"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / properties / output / description
      Previous value: -"Properties of the history object to return. Pass 'extend' for all, 'count' for the number of matches only, or a comma-separated list of property names. Default when omitted: 'extend'. Properties: clock, itemid, ns, value."New value: +"Properties of the history object to return. Pass 'extend' for all, 'count' for the number of matches only, or a list of property names. Default when omitted: 'extend'. Properties: clock, itemid, ns, value."
    • changedInput schema / properties / sortfield / anyOf
      Previous value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "enum": [
      +      "itemid",
      +      "clock",
      +      "ns"
      +    ],
      +    "type": "string"
      +  },
      +  {
      +    "items": {
      +      "enum": [
      +        "itemid",
      +        "clock",
      +        "ns"
      +      ],
      +      "type": "string"
      +    },
      +    "minItems": 1,
      +    "type": "array"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / properties / sortfield / description
      Previous value: -"Sort by one or more of: itemid, clock, ns (7.0+) (comma-separated for several; pair with 'sortorder'). No other property is sortable."New value: +"Sort by one or more of: itemid, clock, ns (7.0+) (a list for several; pair with 'sortorder'). No other property is sortable. When omitted and 'itemids' is given, the result is sorted by clock with the newest first. Without 'itemids' nothing is sorted."
    • changedInput schema / properties / sortorder / anyOf
      Previous value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "enum": [
      +      "ASC",
      +      "DESC"
      +    ],
      +    "type": "string"
      +  },
      +  {
      +    "items": {
      +      "enum": [
      +        "ASC",
      +        "DESC"
      +      ],
      +      "type": "string"
      +    },
      +    "minItems": 1,
      +    "type": "array"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / properties / sortorder / description
      Previous value: -"Sort order: 'ASC' (ascending) or 'DESC' (descending)."New value: +"Sort order: 'ASC' (ascending) or 'DESC' (descending). 'DESC' while 'sortfield' is omitted (newest first); 'ASC' alone returns the oldest first."
    • changedOutput schema / (root)
      Previous value: -{
      -  "properties": {
      -    "result": {
      -      "title": "Result",
      -      "type": "string"
      -    }
      -  },
      -  "required": [
      -    "result"
      -  ],
      -  "title": "history_getOutput",
      -  "type": "object"
      -}New value: +null
  2. First observedv1.41.0

TDQS

A4.7/5.0
Behavior5/5

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

Beyond readOnlyHint/openWorldHint, the description discloses that omitting history makes Zabbix assume type 3, that a mismatched history returns an empty result, that the default sort is newest-first only when itemids is supplied, and that without itemids/hostids the call returns values for every item of that type. The raw_json warning adds a policy/auth constraint (allow_raw_json token flag) and a prompt-injection tradeoff that annotations do not convey.

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?

Content is front-loaded: purpose, then the critical history parameter, then time bounds, then scoping, then alternates and the ID-resolution workflow. It is fairly long and the closing sentence about item_history_summary_get partly duplicates guidance already implied, but almost every sentence carries actionable information.

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

Completeness4/5

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

For a 17-parameter read tool with no output schema, the description covers scoping, ordering, defaults, time formats, and the security/format caveat of raw_json. The one remaining gap is the shape of returned records (clock/itemid/ns/value), which only the schema hints at, so an agent must open the schema to know what comes back.

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

Parameters4/5

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

Schema coverage is 100%, so baseline is 3, but the description goes beyond it by explaining the relationship between parameters: history must match the item's value_type, limit keeps the latest rows given the default newest-first ordering, and itemids/hostids scope what would otherwise be an unbounded query. It adds workflow semantics rather than restating field descriptions.

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

Purpose5/5

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

The opening sentence names a specific verb and resource ('Retrieve historical item data (collected metric values)') and immediately positions it as 'the most granular data source in Zabbix', which separates it from trend_get and item_history_summary_get. An agent can identify the tool without opening the schema.

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

Usage Guidelines5/5

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

It gives explicit routing rules: use trend_get for long ranges, use item_history_summary_get when one item is known by host name plus key, and resolve IDs with item_get first. It also states the precondition that an item ID cannot be derived from a host or metric name, so no guessing is permitted.

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