# vars.set

Source: https://docs.lightair.app/developers/remote-api/vars.set

> Sets a global variable that automations and widgets read.

JSON-RPC 2.0 method of Lightair's Remote API (ws://localhost:4455/rpc). Group: Automations. Script plugins need the `project.write` permission.

## Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `name` | `string` | yes | The variable's name. |
| `value` | `any` | no | Its value. Default null. |

## Errors

Invalid params (-32602) without `name`.

## From an AI agent

The MCP server's `widgets (action: set_var)` reaches this method.

## Example

```json
{ "jsonrpc": "2.0", "id": 1, "method": "vars.set", "params": { "name": "deaths", "value": 12 } }
```

Result:

```json
{}
```

## Related

- [automation.list](https://docs.lightair.app/developers/remote-api/automation.list.md)
