Get Prompt
Retrieves a prompt from an MCP server with optional parameters and returns the rendered prompt content. This node enables your automation to fetch dynamic prompt templates from MCP servers.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
Inputs
- Client Id - The MCP client connection identifier from the Connect node.
- Prompt Name - The name of the prompt to retrieve from the server.
- Parameters - JSON object containing parameters to pass to the prompt template (optional). Parameters are substituted into template variables.
Options
- Timeout - Timeout in seconds for the operation (default: 30).
Outputs
- Prompt Content - The rendered prompt content as a string, with parameters substituted into the template.
How It Works
The Get Prompt node retrieves prompts from MCP servers:
- Client Lookup - Retrieves the MCP client using the provided Client ID
- Parameter Processing - Converts parameters to map[string]string format
- Request Creation - Creates an MCP GetPromptRequest with name and parameters
- Prompt Retrieval - Sends request to server and receives prompt response
- Content Extraction - Extracts text content from the prompt messages
- Output - Returns the rendered prompt content
Requirements
- Valid Client ID from a Connect node
- Non-empty Prompt Name
- Active connection to the MCP server
- Optional parameters matching the prompt's expected variables
Error Handling
The node returns specific errors:
- ErrInvalidArg - Client ID or Prompt Name is empty
- ErrMCPToolCall - Failed to retrieve the prompt from the server
Usage Notes
Parameters Format
Parameters can be provided in multiple formats:
- JSON Object:
{"name": "Alice", "company": "Acme Corp"} - JSON String:
'{"name": "Alice"}' - Message Variable:
msg.prompt_params
Parameter Conversion
- All parameter values are converted to strings
- Non-string values are JSON-serialized
- Empty parameters are treated as empty object
{}
Prompt Content
- The output is the rendered prompt text
- Template variables are replaced with parameter values
- If multiple messages exist, the first message's text is returned
Examples
Example 1: Simple Greeting Prompt
Inputs:
- Client Id:
prompt-server - Prompt Name:
greeting - Parameters:
{
"name": "John",
"company": "Tech Corp"
}
Prompt Content Output:
Welcome John to Tech Corp! We're excited to have you join our team.
Example 2: Code Review Prompt
Inputs:
- Client Id:
ai-prompts - Prompt Name:
code_review - Parameters:
{
"language": "Python",
"focus": "security",
"severity": "critical"
}
Prompt Content Output:
Review the following Python code for:
- Best practices
- Security issues
- Performance optimization
- Code style consistency
Focus area: security
Severity level: critical
Example 3: Email Template
Inputs:
- Client Id:
template-server - Prompt Name:
email_template - Parameters:
{
"recipient_name": "Alice",
"subject": "Project Update",
"sender_name": "Bob",
"sender_title": "Project Manager"
}
Prompt Content Output:
Subject: Project Update
Dear Alice,
[Body content would be here]
Best regards,
Bob
Project Manager
Example 4: Report Generation Prompt
Inputs:
- Client Id:
report-server - Prompt Name:
sales_report - Parameters:
{
"period": "Q1 2024",
"region": "North America",
"metric": "revenue"
}
Prompt Content Output:
Generate a sales report for Q1 2024 focusing on North America.
Primary metric: revenue
Include trend analysis and comparison with previous period.
Example 5: No Parameters
Inputs:
- Client Id:
prompt-server - Prompt Name:
daily_standup - Parameters: (empty)
Prompt Content Output:
Daily Standup Questions:
1. What did you accomplish yesterday?
2. What are you working on today?
3. Are there any blockers?
Best Practices
-
Prompt Discovery:
- Use List Prompts node first to discover available prompts
- Verify prompt name spelling matches exactly
- Check prompt descriptions for parameter requirements
-
Parameter Management:
- Provide all required parameters
- Use consistent parameter naming
- Document parameter purposes
- Handle optional parameters appropriately
-
Error Handling:
- Check if prompt retrieval succeeded
- Validate prompt content is not empty
- Handle missing prompts gracefully
-
Response Processing:
- Parse the prompt content as needed
- Use the content in subsequent AI operations
- Store prompts for reuse if appropriate
-
Timeout Configuration:
- Use default timeout for simple prompts
- Increase timeout for complex prompt generation
- Handle timeout errors
Common Errors and Solutions
Error: "Client Id cannot be empty"
Cause: Client ID input is missing or empty.
Solution:
- Connect Client Id from a Connect node
- Verify Connect node executed successfully
- Check Client Id is being passed correctly
Error: "Prompt name cannot be empty"
Cause: Prompt Name input is missing or empty.
Solution:
- Provide a valid prompt name
- Use List Prompts to discover available prompts
- Check spelling matches exactly
Error: "MCP client not found"
Cause: No client exists with the provided Client ID.
Solution:
- Ensure Connect node executed before Get Prompt
- Verify Client ID is correct
- Check connection didn't fail or close
Error: "Failed to get prompt"
Cause: Prompt retrieval failed on the server.
Solution:
- Verify prompt exists on the server
- Check parameters match prompt's expected variables
- Ensure prompt name is correct
- Check server logs for errors
Tips for Effective Use
- List First - Use List Prompts to discover available prompts
- Understand Parameters - Know which parameters each prompt expects
- Handle Errors - Implement error handling for failed retrievals
- Cache Prompts - Cache static prompts to reduce server calls
- Validate Output - Check prompt content is not empty
- Use with AI - Feed prompt content to AI models (Claude, GPT, etc.)
- Test Parameters - Test with various parameter combinations
Integration with AI Models
Pattern: Using Prompts with Claude
Get Prompt → Claude Generate Text
Flow:
- Get Prompt retrieves template
- Prompt content becomes User Prompt or System Prompt
- Claude generates response based on the prompt
Example:
Get Prompt (code_review) → Claude Generate Text
Input: code to review
System: [prompt content]
Pattern: Dynamic Prompt Selection
Determine Context → Get Prompt (dynamic name) → AI Model
Flow:
- Logic determines which prompt to use
- Get Prompt retrieves appropriate prompt
- AI model processes with the prompt
Usage Patterns
Pattern 1: Static Prompt Retrieval
Connect → Get Prompt → Use Prompt Content
Pattern 2: Parameterized Prompt
Prepare Parameters → Get Prompt → AI Processing
Pattern 3: Multi-Prompt Workflow
Connect → Get Prompt A → Process
→ Get Prompt B → Process
→ Combine Results
Pattern 4: Conditional Prompt Selection
Determine Scenario → Branch → Get Prompt X
→ Get Prompt Y
Pattern 5: Prompt with AI
Get Prompt → Claude/GPT → Process Response
Advanced Examples
Dynamic Parameter Building
// In a JavaScript node before Get Prompt
msg.prompt_params = {
user_name: msg.user.name,
user_role: msg.user.role,
context: msg.current_task,
date: new Date().toISOString().split('T')[0],
preferences: JSON.stringify(msg.user.preferences)
};
Multi-Step Prompt Composition
Get Prompt (intro) → Store
Get Prompt (body) → Store → Combine → AI Model
Get Prompt (conclusion) → Store
Localized Prompts
// Select prompt based on language
const language = msg.user.language;
const promptName = `greeting_${language}`; // greeting_en, greeting_es, etc.