-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
Question
Hello,
According to the Model Context Protocol (MCP) specification (Sampling), the MCP Server can forward prompts to the client for execution at a large language model (LLM) through a sampling mechanism.
I am trying to implement a use case where the MCP Server performs "sampling" and requests the MCP Client to execute a prompt and return the output without involving a User-In-The-Loop.
Essentially, I want the MCP Server to trigger prompt execution independently and receive the result from the client, and that the MCP Server can trigger prompt execution whenever the server needs it.
I have some questions to clarify this setup:
-
Is it correct that the MCP Server can independently initiate a sampling message to the MCP Client, without the MCP Client first invoking a TOOL (or something else) on the MCP Server?
-
If this is possible, could you please provide example code or guidance demonstrating how to implement this flow where the MCP Server triggers sampling and the client responds with the prompt output?
Thank you for your assistance.
Additional Context
No response