-
Notifications
You must be signed in to change notification settings - Fork 681
Expand file tree
/
Copy pathElicitResult.cs
More file actions
71 lines (65 loc) · 2.62 KB
/
ElicitResult.cs
File metadata and controls
71 lines (65 loc) · 2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using System.Text.Json;
using System.Text.Json.Serialization;
namespace ModelContextProtocol.Protocol;
/// <summary>
/// Represents the client's response to an elicitation request.
/// </summary>
public sealed class ElicitResult : Result
{
/// <summary>
/// Gets or sets the user action in response to the elicitation.
/// </summary>
/// <value>
/// Defaults to "cancel" if not explicitly set.
/// </value>
/// <remarks>
/// <list type="bullet">
/// <item>
/// <term>"accept"</term>
/// <description>User submitted the form/confirmed the action</description>
/// </item>
/// <item>
/// <term>"decline"</term>
/// <description>User explicitly declined the action</description>
/// </item>
/// <item>
/// <term>"cancel"</term>
/// <description>User dismissed without making an explicit choice (default)</description>
/// </item>
/// </list>
/// </remarks>
[JsonPropertyName("action")]
public string Action { get; set; } = "cancel";
/// <summary>
/// Gets or sets the submitted form data.
/// </summary>
/// <remarks>
/// <para>
/// This is typically omitted if the action is "cancel" or "decline".
/// </para>
/// <para>
/// Values in the dictionary should be of types <see cref="JsonValueKind.String"/>, <see cref="JsonValueKind.Number"/>,
/// <see cref="JsonValueKind.True"/>, or <see cref="JsonValueKind.False"/>.
/// </para>
/// </remarks>
[JsonPropertyName("content")]
public IDictionary<string, JsonElement>? Content { get; set; }
/// <summary>
/// Gets a value indicating whether the user accepted the elicitation request.
/// </summary>
/// <returns><see langword="true"/> if the action is "accept"; otherwise, <see langword="false"/>.</returns>
[JsonIgnore]
public bool IsAccepted => string.Equals(Action, "accept", StringComparison.OrdinalIgnoreCase);
/// <summary>
/// Gets a value indicating whether the user declined the elicitation request.
/// </summary>
/// <returns><see langword="true"/> if the action is "decline"; otherwise, <see langword="false"/>.</returns>
[JsonIgnore]
public bool IsDeclined => string.Equals(Action, "decline", StringComparison.OrdinalIgnoreCase);
/// <summary>
/// Gets a value indicating whether the user canceled the elicitation request.
/// </summary>
/// <returns><see langword="true"/> if the action is "cancel"; otherwise, <see langword="false"/>.</returns>
[JsonIgnore]
public bool IsCanceled => string.Equals(Action, "cancel", StringComparison.OrdinalIgnoreCase);
}