Skip to main content
Glama
adrighem

Domoticz MCP Server

by adrighem

update_user_variable

Update an existing user variable in Domoticz by specifying its name, type (integer, float, string, date, or time), and new value.

Instructions

Update an existing user variable.

vtype (Variable Type): 0: Integer 1: Float 2: String 3: Date (DD/MM/YYYY) 4: Time (HH:MM)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
vtypeYes
valueYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the 'update_user_variable' tool. It is decorated with @mcp.tool(), takes name, vtype, and value parameters, makes an HTTP GET request to Domoticz API with 'updateuservariable' command, invalidates the user variable cache, and returns the response.
    @mcp.tool()
    async def update_user_variable(name: str, vtype: int, value: str) -> str:
        """Update an existing user variable. 
        
        vtype (Variable Type):
        0: Integer
        1: Float
        2: String
        3: Date (DD/MM/YYYY)
        4: Time (HH:MM)
        """
        async with create_client() as client:
            response = await _do_request(client, "GET", f"{DOMOTICZ_API_URL}?type=command¶m=updateuservariable&vname={name}&vtype={vtype}&vvalue={value}")
            _user_variable_cache["timestamp"] = 0 # Invalidate cache
            return response.text
  • The @mcp.tool() decorator registers the function as an MCP tool named 'update_user_variable'.
    @mcp.tool()
    async def update_user_variable(name: str, vtype: int, value: str) -> str:
  • Docstring describing the input parameters: name (str), vtype (int with mapping 0-4 for types), and value (str).
    async def update_user_variable(name: str, vtype: int, value: str) -> str:
        """Update an existing user variable. 
        
        vtype (Variable Type):
        0: Integer
        1: Float
        2: String
        3: Date (DD/MM/YYYY)
        4: Time (HH:MM)
  • Helper function to resolve a user variable name to its idx, used by other user variable tools but not directly by update_user_variable (which uses name directly).
    async def _resolve_user_variable_idx(client: "httpx.AsyncClient", idx: Optional[int] = None, name: Optional[str] = None) -> Optional[int]:
        """Resolve a user variable to its idx."""
        return await _resolve_idx(client, idx, name, _user_variable_cache, f"{DOMOTICZ_API_URL}?type=command¶m=getuservariables")
  • Cache for user variables, which is invalidated (timestamp reset to 0) by update_user_variable after updating.
    _user_variable_cache = {"data": None, "timestamp": 0}
Behavior2/5

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

No annotations are provided, so the description must disclose behavioral traits. It only mentions 'update' which implies mutation, but lacks details on permissions, side effects, error conditions (e.g., if variable doesn't exist), or response format.

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?

The description is short and front-loaded with the purpose, followed by a list. It is efficient, though the list formatting could be slightly more compact.

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

Completeness3/5

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

Given the tool's simplicity (3 params, no enums), the description is minimally adequate. It explains vtype but not value format or behavior for missing variable. An output schema exists but is not shown; still, the description could be more complete.

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

Parameters3/5

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

The schema has 3 parameters with 0% coverage. The description adds value by explaining vtype encoding (0-4). However, name and value lack additional semantics; value format or constraints are not described.

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 description clearly states 'Update an existing user variable' with a specific verb and resource. It also explains the vtype encoding, distinguishing it from sibling tools like add_user_variable and delete_user_variable.

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

Usage Guidelines3/5

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

The description implies this tool is for updating existing variables but provides no explicit when-to-use, when-not-to, or alternatives. No exclusions or context for selection among siblings.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/adrighem/domoticz-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server