Add McpClientOptions.InitializeMeta to set _meta on the initialize request (#1599)
This commit is contained in:
parent
20ddd2fb10
commit
af6fcff595
2 changed files with 61 additions and 0 deletions
|
|
@ -679,6 +679,7 @@ internal sealed partial class McpClientImpl : McpClient
|
|||
ProtocolVersion = requestProtocol,
|
||||
Capabilities = _options.Capabilities ?? new ClientCapabilities(),
|
||||
ClientInfo = _options.ClientInfo ?? DefaultImplementation,
|
||||
Meta = _options.InitializeMeta,
|
||||
},
|
||||
McpJsonUtilities.JsonContext.Default.InitializeRequestParams,
|
||||
McpJsonUtilities.JsonContext.Default.InitializeResult,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using ModelContextProtocol.Protocol;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json.Nodes;
|
||||
|
||||
namespace ModelContextProtocol.Client;
|
||||
|
||||
|
|
@ -31,6 +32,21 @@ public sealed class McpClientOptions
|
|||
/// </summary>
|
||||
public ClientCapabilities? Capabilities { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the metadata to include in the <c>_meta</c> field of the <see cref="RequestMethods.Initialize"/> request.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// When set, this value is sent as <see cref="RequestParams.Meta"/> on the <see cref="InitializeRequestParams"/> during the initialization handshake.
|
||||
/// This allows passing implementation-specific data to the server alongside the standard <c>initialize</c> parameters,
|
||||
/// such as authentication context a server validates before completing the handshake.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// When <see langword="null"/>, no <c>_meta</c> field is sent.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public JsonObject? InitializeMeta { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the protocol version to request from the server, using a date-based versioning scheme.
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Reference in a new issue