Skip to main content

Prompt Out

Returns the result of a prompt request to the MCP client. This node completes the prompt generation flow by sending the rendered prompt content back to the requesting client.

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.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Inputs

  • Caller ID - Unique identifier for the prompt request. This is automatically provided by the system and matches the request to its response channel.
  • Result - The generated prompt content to return to the client. Must be a string value.

How It Works

The Prompt Out node completes the prompt generation workflow:

  1. Request Tracking - Receives the Caller ID that identifies the specific client request
  2. Channel Lookup - Finds the response channel associated with this request
  3. Result Validation - Validates that the result is a string
  4. Response Creation - Creates an MCP-compliant prompt result with the content
  5. Client Delivery - Sends the result back to the waiting client through the response channel

The node creates a structured prompt response with:

  • A title (currently set to "Code review assistance")
  • An array of prompt messages with the role set to "assistant"
  • The result text as the message content

Requirements

  • Must receive a valid Caller ID from the message context
  • Result must be a string value (not an object or other type)
  • Must be used after a Prompt In node in the flow

Error Handling

The node returns specific errors in the following cases:

  • NoCallId - Failed to get the Caller ID from the message
  • NoChannel - No response channel found for the provided Caller ID (request may have expired or been cancelled)
  • ResultError - Failed to extract the result from the message
  • InvalidResultType - Result is not a string (must be converted to string first)

Usage Notes

Flow Structure

A typical prompt flow structure:

  1. Listen node (with Prompt In connected to prompts port)
  2. Prompt In node (receives request)
  3. Processing logic (template rendering, data fetching, etc.)
  4. Prompt Out node (sends response)

Result Format

  • The Result input must contain a string
  • If your result is an object, convert it to JSON string first
  • Empty strings are allowed but not recommended
  • The result should be meaningful prompt content

Caller ID Management

  • The Caller ID is automatically managed by the system
  • It's passed through the message context
  • Don't manually modify or create Caller IDs
  • Each request gets a unique Caller ID

Examples

Example 1: Simple Text Response

Prompt In receives:

{
"prompt_name": "greeting",
"parameters": {
"name": "John"
}
}

Processing: Generate greeting: "Hello John, welcome to our service!"

Prompt Out inputs:

  • Caller ID: (from message)
  • Result: "Hello John, welcome to our service!"

Client receives: The greeting text


Example 2: Template-Based Prompt

Prompt In receives:

{
"prompt_name": "email_draft",
"parameters": {
"recipient": "Alice",
"topic": "project update"
}
}

Processing:

  1. Fetch email template
  2. Replace variables: recipient, topic
  3. Add signature

Prompt Out inputs:

  • Caller ID: (from message)
  • Result: Complete email text with all variables replaced

Example 3: Dynamic Content Generation

Prompt In receives:

{
"prompt_name": "report_summary",
"parameters": {
"report_id": "2024-Q1",
"sections": ["sales", "marketing"]
}
}

Processing:

  1. Query database for report data
  2. Generate summary for each section
  3. Format as structured text

Prompt Out inputs:

  • Caller ID: (from message)
  • Result: Formatted report summary text

Example 4: Error Handling Flow

Processing Logic:

Try:
- Validate parameters
- Generate prompt content
- Send via Prompt Out
Catch:
- Log error
- Generate error message
- Send error message via Prompt Out

This ensures clients always receive a response, even on errors.

Best Practices

  1. Always Send Response:

    • Every Prompt In should have a corresponding Prompt Out
    • Always send a response, even if it's an error message
    • Don't leave clients waiting for responses that never arrive
  2. Result Validation:

    • Ensure Result is a string before sending
    • Validate that content is not empty
    • Check for proper formatting
  3. Error Messages:

    • If processing fails, send a meaningful error message
    • Include context about what went wrong
    • Don't expose sensitive error details to clients
  4. Content Quality:

    • Send well-formatted, readable content
    • Ensure all template variables are replaced
    • Validate content meets client expectations
  5. Performance:

    • Process requests efficiently
    • Avoid blocking operations before Prompt Out
    • Set reasonable timeouts
  6. Testing:

    • Test with various input parameters
    • Verify responses are correctly formatted
    • Check error handling paths

Common Errors and Solutions

Error: "NoCallId - Failed to get call ID"

Cause: The Caller ID is missing from the message context.

Solution:

  • Ensure Prompt Out is connected after Prompt In
  • Check that message context is properly passed through the flow
  • Verify no nodes are clearing the message context

Error: "NoChannel - No channel found for caller ID"

Cause: The response channel for this request no longer exists.

Solution:

  • The client may have timed out or cancelled the request
  • Reduce processing time before Prompt Out
  • This can happen if the flow takes too long to process

Error: "InvalidResultType - Expected result to be a string"

Cause: The Result input is not a string type.

Solution:

  • Convert objects to JSON strings using JSON.stringify
  • Ensure template rendering produces a string
  • Check data type before sending to Prompt Out

Error: "ResultError - Failed to get result"

Cause: The Result input is missing or inaccessible.

Solution:

  • Ensure the Result input is connected
  • Verify the source of Result provides a value
  • Check for null or undefined values

Tips for Effective Use

  1. Consistent Structure - Always use the same flow pattern: In → Process → Out
  2. Caller ID Handling - Pass the Caller ID through your processing nodes unchanged
  3. String Conversion - Convert complex objects to strings before Prompt Out
  4. Timeout Awareness - Process and respond quickly to avoid timeouts
  5. Error Responses - Send meaningful error messages instead of failing silently
  6. Logging - Log responses for debugging and monitoring
  7. Testing - Test the complete In/Out flow with various scenarios

Integration Patterns

Pattern 1: Simple Pass-Through

Prompt In → Prompt Out

Direct pass-through of static content.

Pattern 2: Template Rendering

Prompt In → Template Engine → Prompt Out

Render template with parameters.

Pattern 3: Data Enrichment

Prompt In → Database Query → Format → Prompt Out

Fetch data and incorporate into prompt.

Pattern 4: Error Handling

Prompt In → Try → Process → Prompt Out

Catch → Error Message → Prompt Out

Handle errors gracefully with fallback messages.

Pattern 5: Multi-Stage Processing

Prompt In → Validate → Fetch Data → Transform → Format → Prompt Out

Complex multi-stage processing with proper error handling at each stage.