user_create
Create and configure new users in Zabbix by specifying username, password, user groups, and personal details. Returns JSON-formatted results for user creation.
Instructions
Create a new user in Zabbix.
Args:
username: Username
passwd: Password
usrgrps: List of user groups (format: [{"usrgrpid": "1"}])
name: First name
surname: Last name
email: Email address
Returns:
str: JSON formatted creation result
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| No | |||
| name | No | ||
| passwd | Yes | ||
| surname | No | ||
| username | Yes | ||
| usrgrps | Yes |
Input Schema (JSON Schema)
{
"properties": {
"email": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Email"
},
"name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Name"
},
"passwd": {
"title": "Passwd",
"type": "string"
},
"surname": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Surname"
},
"username": {
"title": "Username",
"type": "string"
},
"usrgrps": {
"items": {
"additionalProperties": {
"type": "string"
},
"type": "object"
},
"title": "Usrgrps",
"type": "array"
}
},
"required": [
"username",
"passwd",
"usrgrps"
],
"type": "object"
}
Implementation Reference
- src/zabbix_mcp_server.py:942-977 (handler)The handler function for the 'user_create' MCP tool. It is registered via the @mcp.tool() decorator and implements user creation in Zabbix using the ZabbixAPI. Includes type-hinted parameters serving as input schema, docstring documentation, read-only validation, parameter construction, API call, and JSON response formatting.@mcp.tool() def user_create(username: str, passwd: str, usrgrps: List[Dict[str, str]], name: Optional[str] = None, surname: Optional[str] = None, email: Optional[str] = None) -> str: """Create a new user in Zabbix. Args: username: Username passwd: Password usrgrps: List of user groups (format: [{"usrgrpid": "1"}]) name: First name surname: Last name email: Email address Returns: str: JSON formatted creation result """ validate_read_only() client = get_zabbix_client() params = { "username": username, "passwd": passwd, "usrgrps": usrgrps } if name: params["name"] = name if surname: params["surname"] = surname if email: params["email"] = email result = client.user.create(**params) return format_response(result)