resolve_prompt tool fetches a prompt and performs variable substitution by replacing {{variable}} placeholders with caller-supplied values. This is the core tool for using prompts with dynamic content.
Access Control
Same access rules asget_prompt:
- Authenticated users: Can resolve their own prompts (public or private) OR any other user’s public prompts
- Anonymous callers: Can only resolve public prompts
- Private prompts: Returns
PROMPT_NOT_FOUNDfor unauthorized access
Parameters
UUID of the prompt to resolve. Must be a valid UUID format.
Key-value map of variable names to their replacement values. Keys should match the variable names in the template (without braces). All values must be strings.Example:
{ "language": "TypeScript", "pr_url": "https://github.com/..." }Response
Returns a resolution result with the substituted content.The prompt content after variable substitution. Placeholders with matching values are replaced; unresolved placeholders remain as
{{variable}}.Array of variable names that were found in the template but had no matching entry in the
variables parameter. Useful for detecting partial resolutions.Variable Resolution Rules
- Exact match required: Variable names are case-sensitive and must match exactly
- Whitespace normalized:
{{ var }}and{{var}}both match key"var" - Partial resolution allowed: If some variables are missing, they remain as
{{variable}}in the output - Empty strings are valid: Providing
""as a value replaces the placeholder with an empty string - No nested braces: The pattern
{{ {{nested}} }}is not supported
Examples
Full Resolution
Request:Partial Resolution
When some variables are not provided, they remain in the output: Request:Implementation Details
- Uses the
resolvePrompt()utility function from/src/lib/utils/variable-parser.ts:49 - Variable extraction uses regex:
/\{\{\s*([^}]+?)\s*\}\}/g - The resolution preserves all formatting, whitespace, and line breaks
- Variables are extracted before resolution to populate
unresolved_variables - The same prompt content is fetched as in
get_prompt(latest version fromprompt_versions)
Error Codes
Invalid parameters:
prompt_id is not a valid UUID, or variables is not a valid string recordPrompt does not exist, is archived, or caller lacks permission to access it
Database query failed or other internal error occurred