Add context to complete requests (#488)

This commit is contained in:
Stephen Toub 2025-06-05 20:30:00 -07:00 • committed by GitHub
commit 46d25b7558
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 26 additions and 1 deletions

View file

@ -0,0 +1,19 @@
using System.Text.Json.Serialization;
namespace ModelContextProtocol.Protocol;
/// <summary>
/// Represents additional context information for completion requests.
/// </summary>
/// <remarks>
/// This context provides information that helps the server generate more relevant
/// completion suggestions, such as previously resolved variables in a template.
/// </remarks>
public class CompleteContext
{
/// <summary>
/// Gets or sets previously-resolved variables in a URI template or prompt.
/// </summary>
[JsonPropertyName("arguments")]
public IDictionary<string, string>? Arguments { get; init; }
}

View file

@ -30,5 +30,11 @@ public class CompleteRequestParams : RequestParams
/// and the current partial input.
/// </summary>
[JsonPropertyName("argument")]
public required Argument Argument { get; init; }
public required Argument Argument { get; init; }
/// <summary>
/// Gets or sets additional, optional context for completions.
/// </summary>
[JsonPropertyName("context")]
public CompleteContext? Context { get; init; }
}