variable_set
Create or update environment variables for Railway.app services to configure settings, connection strings, or manage secrets.
Instructions
[API] Create or update an environment variable
⚡️ Best for: ✓ Setting configuration values ✓ Updating connection strings ✓ Managing service secrets
⚠️ Not for: × Bulk variable updates (use variable_bulk_set) × Temporary configuration changes
→ Prerequisites: service_list
→ Alternatives: variable_bulk_set
→ Next steps: deployment_trigger, service_restart
→ Related: variable_list, variable_delete
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"projectId": "<projectId>",
"environmentId": "<environmentId>",
"name": "<name>",
"value": "<value>"
},
"name": "variable_set"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | ID of the project containing the service | |
| environmentId | Yes | ID of the environment for the variable (usually obtained from service_list) | |
| name | Yes | Name of the environment variable | |
| value | Yes | Value to set for the variable | |
| serviceId | No | Optional: ID of the service for the variable, if omitted creates/updates a shared variable |