set_variables
Adds, changes or removes variables in one scope.
Overview
set_variables changes the variables of one scope: an environment, a collection, a folder, globals, or by default the workspace's own. Each row in set replaces the variable with its key, keeping its place, or is added at the end. Fields a row leaves out keep their values. remove deletes variables by key. Keys are case-sensitive.
A secret variable's value can't be set or read through MCP. To have a credential, add a variable with secret set to true and no value, refer to it as {{name}}, and enter its value in Relay. Leave value out, or give [redacted], to keep an existing value.
{
"workspaceId": "7D1E6C2A-4F0B-4C55-9A57-3B8E2F1D9C40",
"set": [
{ "key": "baseUrl", "value": "https://api.example.com" },
{ "key": "token", "secret": true }
],
"remove": ["oldHost"]
}Parameters
Prop
Type
Return Value
The scope as list_variables returns it, plus changed, which is false when nothing differed.
Discussion
Give at most one of environmentId, collectionId, folderId and global. The tool returns an error when a row gives a secret a value or makes a secret variable visible, and for a read-only or unavailable workspace.
See Also
- list_variables: Lists variables by scope, with secret values hidden.
- set_auth: Sets the auth of a request, folder, collection or workspace.