Make "Stateless" mode sessionless (#760)
- This removes the requirement to configure data protection which is the motivating reason for this change - This means that McpServer.ClientInfo will always be null in stateless mode
This commit is contained in:
parent
740a7d0346
commit
47b9582fd7
2 changed files with 28 additions and 72 deletions
|
|
@ -416,7 +416,7 @@ public abstract partial class McpServer : McpSession, IMcpServer
|
|||
{
|
||||
if (ClientCapabilities?.Sampling is null)
|
||||
{
|
||||
if (ServerOptions.KnownClientInfo is not null)
|
||||
if (ClientCapabilities is null)
|
||||
{
|
||||
throw new InvalidOperationException("Sampling is not supported in stateless mode.");
|
||||
}
|
||||
|
|
@ -429,7 +429,7 @@ public abstract partial class McpServer : McpSession, IMcpServer
|
|||
{
|
||||
if (ClientCapabilities?.Roots is null)
|
||||
{
|
||||
if (ServerOptions.KnownClientInfo is not null)
|
||||
if (ClientCapabilities is null)
|
||||
{
|
||||
throw new InvalidOperationException("Roots are not supported in stateless mode.");
|
||||
}
|
||||
|
|
@ -442,7 +442,7 @@ public abstract partial class McpServer : McpSession, IMcpServer
|
|||
{
|
||||
if (ClientCapabilities?.Elicitation is null)
|
||||
{
|
||||
if (ServerOptions.KnownClientInfo is not null)
|
||||
if (ClientCapabilities is null)
|
||||
{
|
||||
throw new InvalidOperationException("Elicitation is not supported in stateless mode.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public static class McpServerExtensions
|
|||
/// <exception cref="InvalidOperationException">The client does not support sampling.</exception>
|
||||
/// <remarks>
|
||||
/// This method requires the client to support sampling capabilities.
|
||||
/// It allows detailed control over sampling parameters including messages, system prompt, temperature,
|
||||
/// It allows detailed control over sampling parameters including messages, system prompt, temperature,
|
||||
/// and token limits.
|
||||
/// </remarks>
|
||||
[Obsolete($"Use {nameof(McpServer)}.{nameof(McpServer.SampleAsync)} instead. This member will be removed in a subsequent release.")] // See: https://github.com/modelcontextprotocol/csharp-sdk/issues/774
|
||||
|
|
|
|||
Loading…
Reference in a new issue