Replies: 1 comment 2 replies
-
Thanks for opening this discussion!
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Pre-submission Checklist
Your Idea
Creating a GH Discussion as requested by @dsp-ant based on a Discord thread we had on the subject.
Context and Motivation
The Model Context Protocol (MCP) includes a sampling/createMessage API that allows servers to request language model (LLM) responses from clients without having direct API credentials or embeddings. As contributors experiment with using the sampling API to build agents and tools, questions arise about
Key Discussion Points
1. Tool Calls During Sampling
Problem: When an LLM (invoked by a server’s sampling/createMessage request) suggests making a tool call, how should that be communicated and executed?
Current State: The sampling request as currently defined doesn’t explicitly support passing tools or tool definitions to the LLM. The model messages for sampling are limited to text or image responses and do not include resource/tool embeddings.
Potential Approach:
One idea: The client, which implements createMessage, could supply tool context by including them in the system prompt or as part of includeContext. If the LLM requests a tool call, the client could pause the sampling, execute the tool call (via a separate MCP tool/call request), incorporate the response, and continue sampling. This would effectively turn createMessage into a loop until a “steady-state” (no more tool calls requested) is reached.
Concerns:
2. Meaning and Usage of
includeContext
Problem:
includeContext
is described as a mechanism for providing system or conversation context to the LLM. But what kinds of context should be included (e.g., tool definitions, multi-server contexts, etc.)?Interpretations:
thisServer
: Include the assistant message that triggered the sampling request.allServers
: Potentially include broader conversation history or additional user-assistant pairs, and possibly external resources or tool definitions.Open Question: Is it intended or advisable to include tool definitions from other servers or the host application via
includeContext
? The protocol is silent on this, and it might introduce security or complexity concerns. For example, if server A requests sampling with theincludeContext: allServers
, should the client include tools and resources from server B in that fulfilling that request?3. Notifications and Progress Updates
Question: Are notifications bidirectional? Can a client send notifications back to the server, perhaps for streaming partial outputs or reporting progress?
Current Understanding: Notifications as shown in the docs primarily describe server-to-client messages. However, there doesn't seem to be any reason for clients not to be able to send notifications to the server.
Proposal: Consider using notifications or a similar mechanism to stream partial responses from the client’s sampling process back to the server during sampling. This would avoid adding new primitives while supporting progress updates.
Scope
Beta Was this translation helpful? Give feedback.
All reactions