Skip to content

Commit 46d25b7

Browse files
authored
Add context to complete requests (#488)
1 parent c560f47 commit 46d25b7

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace ModelContextProtocol.Protocol;
4+
5+
/// <summary>
6+
/// Represents additional context information for completion requests.
7+
/// </summary>
8+
/// <remarks>
9+
/// This context provides information that helps the server generate more relevant
10+
/// completion suggestions, such as previously resolved variables in a template.
11+
/// </remarks>
12+
public class CompleteContext
13+
{
14+
/// <summary>
15+
/// Gets or sets previously-resolved variables in a URI template or prompt.
16+
/// </summary>
17+
[JsonPropertyName("arguments")]
18+
public IDictionary<string, string>? Arguments { get; init; }
19+
}

src/ModelContextProtocol.Core/Protocol/CompleteRequestParams.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,11 @@ public class CompleteRequestParams : RequestParams
3030
/// and the current partial input.
3131
/// </summary>
3232
[JsonPropertyName("argument")]
33-
public required Argument Argument { get; init; }
33+
public required Argument Argument { get; init; }
34+
35+
/// <summary>
36+
/// Gets or sets additional, optional context for completions.
37+
/// </summary>
38+
[JsonPropertyName("context")]
39+
public CompleteContext? Context { get; init; }
3440
}

0 commit comments

Comments
 (0)