forked from modelcontextprotocol/csharp-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResource.cs
More file actions
78 lines (71 loc) · 2.99 KB
/
Resource.cs
File metadata and controls
78 lines (71 loc) · 2.99 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
72
73
74
75
76
77
78
using System.Text.Json.Serialization;
namespace ModelContextProtocol.Protocol;
/// <summary>
/// Represents a known resource that the server is capable of reading.
/// </summary>
/// <remarks>
/// See the <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">schema</see> for details.
/// </remarks>
public class Resource
{
/// <summary>
/// Gets or sets the URI of this resource.
/// </summary>
[JsonPropertyName("uri")]
public required string Uri { get; init; }
/// <summary>
/// Gets or sets a human-readable name for this resource.
/// </summary>
[JsonPropertyName("name")]
public required string Name { get; init; }
/// <summary>
/// Gets or sets a description of what this resource represents.
/// </summary>
/// <remarks>
/// <para>
/// This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a \"hint\" to the model.
/// </para>
/// <para>
/// The description should provide clear context about the resource's content, format, and purpose.
/// This helps AI models make better decisions about when to access or reference the resource.
/// </para>
/// <para>
/// Client applications can also use this description for display purposes in user interfaces
/// or to help users understand the available resources.
/// </para>
/// </remarks>
[JsonPropertyName("description")]
public string? Description { get; init; }
/// <summary>
/// Gets or sets the MIME type of this resource.
/// </summary>
/// <remarks>
/// <para>
/// <see cref="MimeType"/> specifies the format of the resource content, helping clients to properly interpret and display the data.
/// Common MIME types include "text/plain" for plain text, "application/pdf" for PDF documents,
/// "image/png" for PNG images, and "application/json" for JSON data.
/// </para>
/// <para>
/// This property may be <see langword="null"/> if the MIME type is unknown or not applicable for the resource.
/// </para>
/// </remarks>
[JsonPropertyName("mimeType")]
public string? MimeType { get; init; }
/// <summary>
/// Gets or sets the size of the raw resource content (before base64 encoding), in bytes, if known.
/// </summary>
/// <remarks>
/// This can be used by applications to display file sizes and estimate context window usage.
/// </remarks>
[JsonPropertyName("size")]
public long? Size { get; init; }
/// <summary>
/// Gets or sets optional annotations for the resource.
/// </summary>
/// <remarks>
/// These annotations can be used to specify the intended audience (<see cref="Role.User"/>, <see cref="Role.Assistant"/>, or both)
/// and the priority level of the resource. Clients can use this information to filter or prioritize resources for different roles.
/// </remarks>
[JsonPropertyName("annotations")]
public Annotations? Annotations { get; init; }
}