Skip to main content

List Prompts

Discovers all available prompts on an MCP server. This node returns a list of prompts with their names, descriptions, and parameters, enabling dynamic prompt discovery.

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.

Options

  • Timeout - Timeout in seconds for the operation (default: 30).

Outputs

  • Prompts - Array of prompt objects, each containing name, description, and arguments (if any).

How It Works

  1. Client Lookup - Retrieves the MCP client using the provided Client ID
  2. List Request - Sends a ListPromptsRequest to the MCP server
  3. Response Processing - Extracts prompt information from the server response
  4. Array Creation - Converts prompts to an array of objects with name, description, and arguments
  5. Output - Returns the prompts array

Requirements

  • Valid Client ID from a Connect node
  • Active connection to the MCP server

Output Format

Each prompt in the array contains:

{
"name": "prompt_name",
"description": "What the prompt does",
"arguments": [
{
"name": "param_name",
"description": "Parameter description",
"required": true
}
]
}

The arguments field is optional and only present if the prompt accepts parameters.

Examples

Example 1: List All Prompts

Inputs:

  • Client Id: prompt-server

Prompts Output:

[
{
"name": "greeting",
"description": "Generate a personalized greeting message"
},
{
"name": "code_review",
"description": "Generate a code review prompt",
"arguments": [
{
"name": "language",
"description": "Programming language",
"required": true
},
{
"name": "focus",
"description": "Review focus area",
"required": false
}
]
},
{
"name": "email_template",
"description": "Generate email template",
"arguments": [
{
"name": "recipient",
"description": "Recipient name",
"required": true
},
{
"name": "subject",
"description": "Email subject",
"required": true
}
]
}
]

Example 2: Process Prompt List

Flow:

Connect → List Prompts → Loop through prompts → Display or store

JavaScript processing:

// Access prompts from List Prompts output
const prompts = msg.prompts;

// Extract just prompt names
msg.prompt_names = prompts.map(p => p.name);

// Filter prompts that require parameters
msg.parameterized_prompts = prompts.filter(p => p.arguments && p.arguments.length > 0);

// Find specific prompt
msg.code_review_prompt = prompts.find(p => p.name === 'code_review');

Example 3: Dynamic Prompt Selection

Flow:

List Prompts → Filter by criteria → Select best match → Get Prompt

Example:

// Find prompts related to email
const emailPrompts = msg.prompts.filter(p =>
p.name.includes('email') || p.description.toLowerCase().includes('email')
);

// Use the first matching prompt
if (emailPrompts.length > 0) {
msg.selected_prompt = emailPrompts[0].name;
}

Example 4: Build Prompt Catalog

Flow:

Connect → List Prompts → Format catalog → Save to database

Create documentation:

const catalog = msg.prompts.map(prompt => ({
name: prompt.name,
description: prompt.description,
required_params: prompt.arguments?.filter(a => a.required).map(a => a.name) || [],
optional_params: prompt.arguments?.filter(a => !a.required).map(a => a.name) || []
}));

msg.prompt_catalog = catalog;

Best Practices

  1. Discovery:

    • List prompts at the start of automation to know what's available
    • Cache the list if prompts don't change frequently
    • Use to validate prompt names before calling Get Prompt
  2. Processing:

    • Filter prompts by name patterns or descriptions
    • Check for required vs optional parameters
    • Build dynamic UIs or catalogs from the list
  3. Error Handling:

    • Check if prompts array is not empty
    • Handle servers with no prompts gracefully
    • Validate server connection before listing
  4. Performance:

    • Cache prompt lists to reduce server calls
    • Only refresh when needed
    • Use for initialization, not every iteration

Common Errors and Solutions

Error: "Client Id cannot be empty"

Solution:

  • Ensure Connect node executed successfully
  • Pass Client Id from Connect node
  • Verify client connection is active

Error: "Failed to list prompts"

Solution:

  • Check server is running and accessible
  • Verify Client Id is correct
  • Check server logs for errors
  • Ensure server has ListPrompts capability enabled

Empty Prompts Array

Cause: Server has no prompts registered.

Solution:

  • Verify server has prompts configured
  • Check server is properly initialized
  • Ensure prompts are registered correctly on server

Tips for Effective Use

  1. Initial Discovery - Use at flow start to discover capabilities
  2. Validation - Validate prompt names exist before Get Prompt
  3. Documentation - Generate prompt documentation automatically
  4. Dynamic Selection - Select prompts based on context
  5. Caching - Store prompt list to avoid repeated calls
  6. Filtering - Filter by name patterns or required parameters

Integration Patterns

Pattern 1: Prompt Discovery and Usage

Connect → List Prompts → Select Prompt → Get Prompt → Use

Pattern 2: Validation Before Use

List Prompts → Check if exists → Get Prompt
↓ (if not exists)
Error Handler

Pattern 3: Build Catalog

List Prompts → Format → Store in Database → Display to Users

Pattern 4: Dynamic Menu

List Prompts → Create Menu → User Selects → Get Prompt

Processing Examples

Extract Prompt Names Only

const promptNames = msg.prompts.map(p => p.name);
// ["greeting", "code_review", "email_template"]

Find Prompts with Parameters

const parametric = msg.prompts.filter(p =>
p.arguments && p.arguments.length > 0
);

Create Lookup Map

const promptMap = {};
msg.prompts.forEach(p => {
promptMap[p.name] = {
description: p.description,
params: p.arguments || []
};
});
msg.prompt_lookup = promptMap;

Check if Specific Prompt Exists

const hasCodeReview = msg.prompts.some(p => p.name === 'code_review');
if (!hasCodeReview) {
throw new Error('Required prompt not available');
}