You should look up export_vars in the documentation. Example:
set foo "bar"
set url [export_vars -base some-other-url {foo}]
(If you leave out -base
, it will just return the part after ?
.) You can also include more than one variable, and even name then differently:
set x 3
set y 8
# We want to call x "z"!
set url [export_vars -base some-url {{z $x} y}]