execute_prompt_with_llm
Execute prompts with LLMs by retrieving templates from MCP servers, filling variables, and returning structured responses with metadata for testing workflows.
Instructions
Execute a prompt with an LLM and return the response.
This tool performs the complete workflow:
Retrieves the prompt from the connected MCP server with prompt_arguments
Optionally fills template variables in the prompt messages
Sends the prompt messages to an LLM
Returns the LLM's response along with metadata
Supports two prompt patterns:
Standard MCP prompts: Pass arguments via prompt_arguments, server handles substitution
Template variables: Use fill_variables to replace {variable} placeholders in messages
Args: prompt_name: Name of the prompt to execute prompt_arguments: Dictionary of arguments to pass to the MCP prompt (default: {}) fill_variables: Dictionary of template variables to fill in prompt messages (default: None) Used for manual string replacement of {variable_name} patterns. Values are JSON-serialized before substitution if they're not strings. llm_config: Optional LLM configuration with keys: - url: LLM endpoint URL (default: from LLM_URL env var) - model: Model name (default: from LLM_MODEL_NAME env var) - api_key: API key (default: from LLM_API_KEY env var) - max_tokens: Maximum tokens in response (default: 1000) - temperature: Sampling temperature (default: 0.7)
Returns: Dictionary with execution results including: - success: True if execution succeeded - prompt: Original prompt information - llm_request: The request sent to the LLM - llm_response: The LLM's response - parsed_response: Attempted JSON parsing if response looks like JSON - metadata: Timing and configuration information
Raises: Returns error dict for various failure scenarios: - not_connected: No active MCP connection - prompt_not_found: Prompt doesn't exist - llm_config_error: Missing or invalid LLM configuration - llm_request_error: LLM request failed
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prompt_name | Yes | Name of the prompt to execute | |
| prompt_arguments | No | Arguments to pass to the MCP prompt (JSON object or string) | |
| fill_variables | No | Template variables to fill in prompt messages (JSON object or string) | |
| llm_config | No | LLM configuration (url, model, api_key, etc.) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||