Template Variables
Promptmark templates use {{variable}} syntax to create fill-in-the-blank prompts. This page documents the complete specification.
Syntax
{{name}} Simple variable (string, required)
{{name:type}} Typed variable (required)
{{name:type:default}} Typed with default (optional)
{{name:enum:opt1,opt2,opt3}} Enum options (required)
{{name:enum:opt1,opt2,opt3:default}} Enum with default (optional)
Variable Names
Variable names must follow these rules:
- Must start with a letter (
a-z,A-Z) - Can contain letters, digits (
0-9), and underscores (_) - Cannot start with an underscore
Valid: name, first_name, user123, Topic
Invalid: _reserved, 1st, my-var
Types
| Type | Aliases | Description | Validation |
|---|---|---|---|
string |
(default) | Single-line text | None |
text |
— | Multi-line text | None |
number |
num, int, float |
Numeric value | Must parse as number |
boolean |
bool |
True/false toggle | true, false, 1, 0 (case-insensitive) |
enum |
select, choice |
Fixed options | Must match an option exactly (case-sensitive) |
If no type is specified, the variable defaults to string.
Default Values
A variable with a default value is optional — it can be left empty during rendering and the default will be used.
A variable without a default is required — rendering will use the variable name as a placeholder if no value is provided.
{{name}} → Required (no default)
{{name:string:World}} → Optional (defaults to "World")
{{active:bool:true}} → Optional (defaults to "true")
Default values have a maximum length of 500 characters.
Enum Variables
Enums define a fixed set of options:
{{style:enum:formal,casual,technical}}
Options are separated by commas. Whitespace around options is trimmed automatically:
{{size:enum:small, medium, large}} → ["small", "medium", "large"]
Enum with Default
The default value is specified after the last colon:
{{style:enum:formal,casual,technical:casual}}
The default must be one of the defined options. If the default doesn’t match any option, it’s ignored.
Rendering Behavior
During rendering, variables are resolved in this priority order:
- Provided value — Value explicitly passed for this variable
- Default value — If the variable has a default and no value was provided
- Unresolved — The
{{placeholder}}text remains unchanged
Duplicate Variables
If a variable name appears multiple times in a template, it’s treated as a single variable. All occurrences are replaced with the same value:
Dear {{name}}, Thank you {{name}} for your inquiry.
→ Dear Alice, Thank you Alice for your inquiry.
Type Validation
Types are validated on input, not on output. During rendering:
number— Value must parse as a valid number (integers, decimals, scientific notation like1e10)boolean— Value must betrue,false,1, or0(case-insensitive)enum— Value must exactly match one option (case-sensitive)string/text— No validation
Empty strings (after trimming whitespace) are treated as “not provided.”
Examples
Code Review Template
Review this {{language:enum:Python,JavaScript,Go,Rust}} code for
{{focus:enum:bugs,performance,security,readability:bugs}}:
{{code:text}}
Provide {{detail:enum:brief,detailed:detailed}} feedback.
Variables:
language— Required enum, 4 optionsfocus— Optional enum, defaults to “bugs”code— Required multi-line textdetail— Optional enum, defaults to “detailed”
Email Generator
Write a {{tone:enum:formal,casual,professional:professional}} email
to {{recipient}} about {{subject}}.
Additional context: {{context:text:None provided}}
Variables:
tone— Optional enum, defaults to “professional”recipient— Required stringsubject— Required stringcontext— Optional text, defaults to “None provided”
MCP Integration
Template variables work with MCP tools:
get_prompt_schema— Returns all variables with types, options, and defaultsvalidate_prompt_inputs— Validates variable values before renderingrender_prompt— Substitutes variables and returns the rendered text
// get_prompt_schema response
{
"variables": [
{
"name": "language",
"type": "enum",
"required": true,
"options": ["Python", "JavaScript", "Go", "Rust"]
},
{
"name": "code",
"type": "text",
"required": true
}
]
}
Limits
| Limit | Value |
|---|---|
| Template text maximum | 100 KB |
| Default value maximum | 500 characters |
| Variable name | Letters, digits, underscores (starts with letter) |