Is there any sane way of using the MCP Prompts between the Client and Server? #4996
Unanswered
KaustubhKhati
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I’m struggling to piece together how to seamlessly use the MCP Prompt from an MCP server to an MCP client, both using Spring AI 1.1.0.
The Problem
The server returns a GetPromptResult which contains a PromptMessage, but neither of these directly correlates to what a ChatClient expects.
The implementation also doesn’t make things easy.
The example shows:
However, to build the message string, it seems I can’t use the PromptTemplate or AssistantPromptTemplate directly.
Instead, I end up having to do something like:
Honestly, this feels unnecessarily complicated.
It would make more sense if the server just returned the prompt with placeholders to the client, and then let the client resolve and fill them.
But even that doesn’t seem straightforward.
Example client usage:
I’d appreciate it if someone could point out if my current approach is completely wrong and suggest a better, more idiomatic way to handle this scenario.
Beta Was this translation helpful? Give feedback.
All reactions