host_update
Update an existing host in Zabbix by modifying its ID, name, visible name, or status using the specified parameters. Returns JSON-formatted results for seamless integration.
Instructions
Update an existing host in Zabbix.
Args:
hostid: Host ID to update
host: New host name
name: New visible name
status: New status (0=enabled, 1=disabled)
Returns:
str: JSON formatted update result
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| host | No | ||
| hostid | Yes | ||
| name | No | ||
| status | No |
Input Schema (JSON Schema)
{
"properties": {
"host": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Host"
},
"hostid": {
"title": "Hostid",
"type": "string"
},
"name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Name"
},
"status": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Status"
}
},
"required": [
"hostid"
],
"type": "object"
}
Implementation Reference
- src/zabbix_mcp_server.py:193-220 (handler)The host_update MCP tool handler function that updates an existing host in Zabbix using the Zabbix API client. It validates read-only mode, prepares parameters, calls the API, and formats the response.@mcp.tool() def host_update(hostid: str, host: Optional[str] = None, name: Optional[str] = None, status: Optional[int] = None) -> str: """Update an existing host in Zabbix. Args: hostid: Host ID to update host: New host name name: New visible name status: New status (0=enabled, 1=disabled) Returns: str: JSON formatted update result """ validate_read_only() client = get_zabbix_client() params = {"hostid": hostid} if host: params["host"] = host if name: params["name"] = name if status is not None: params["status"] = status result = client.host.update(**params) return format_response(result)