← All help topics

Templates and quoting

Wherever a tool uses a value, you write it as {{ name }}. These are templates: SolutionMCP fills them in just before the tool runs.

What you can write

TemplateMeans
{{ city }}The value of the city parameter.
{% if limit %}--limit={{ limit }}{% endif %}Only when limit is set.
{% for t in tags %}{{ t }} {% endfor %}Once for each item in a list.
{{ name | upper }}A filter: upper, lower, trim, default, replace, join, length, basename, dirname.
{{ secret.API_KEY }}One of your secrets.
{{ env.HOME }}An environment variable.
{{ os }}macos, windows or linux.
{{ home }}Your home folder.
{{ pack_dir }}The folder the pack file is in.

A value that isn't set becomes empty, instead of failing.

Quoting is automatic

This is what keeps your tools safe: a value from the AI can't break out and run commands of its own.

  • Programs: each argument is passed on its own, without a shell, so nothing needs quoting.
  • Scripts: every value is quoted for the script's language. Don't add quotes yourself.
  • Web requests: values in the address are encoded.

If you do need quoting somewhere it isn't automatic, like in a program's argument that's later used in a shell, use a filter: | sh for shells, | ps for PowerShell, | py for Python, | json for JSON and JavaScript, | url for addresses and | applescript for AppleScript.

Warning: The | safe filter turns quoting off. Only use it for values you wrote yourself, never for what the AI sends.

Text with braces in it

If a script needs {{ or {% as plain text, like a shell ${#var}, wrap that part in {% raw %} and {% endraw %}.

See also Programs, scripts and web requests.