Use token placeholders for arguments in prompt messages
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3572404. --> Reported by: [eojthebrave](https://www.drupal.org/user/79230) >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>Consider adding some kind of token substitution that injects prompt arguments into the response message.</p> <p>Right now you can create a prompt, and configure it to have one or more argument. When the prompt is invoked, say via Claude Desktop, you're asked to provide a value for those arguments. And then Claude sends that to the MCP server along with the request for the prompt. It would be helpful if there was some kind of token replacement so that you could write a prompt message with dynamic placeholders and the argument values would be substituted in.</p> <p>For example:</p> <pre><pre>id: explain_drupal_api<br>label: explain-drupal-api<br>title: 'Explain Drupal API class/method/function'<br>description: 'Get a detailed explanation of a Drupal class/method/function.'<br>arguments:<br>&nbsp; -<br>&nbsp;&nbsp;&nbsp; label: api_name<br>&nbsp;&nbsp;&nbsp; machine_name: api_name<br>&nbsp;&nbsp;&nbsp; description: 'FQN like \\Drupal\\node\\Entity\\Node'<br>&nbsp;&nbsp;&nbsp; required: true<br>messages:<br>&nbsp; -<br>&nbsp;&nbsp;&nbsp; role: user<br>&nbsp;&nbsp;&nbsp; content:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type: text<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; text: "Search for the {$api_name} and find the main documentation for the API, examples of it being used in Drupal core or tests, and related methods. Then summarize your findings.</pre></pre><h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Add some code in the prompt handling flow that allows for replacing tokens like `{$arg1}` or `{{arg1}}` or similar in a prompt template with values provided by the MCP client.</p> <p>Update the UI with some documentation that makes it clear how this works.</p>
issue