forked from modelcontextprotocol/csharp-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMcpServerResourceCreateOptions.cs
More file actions
75 lines (68 loc) · 2.98 KB
/
McpServerResourceCreateOptions.cs
File metadata and controls
75 lines (68 loc) · 2.98 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
using System.ComponentModel;
namespace ModelContextProtocol.Server;
/// <summary>
/// Provides options for controlling the creation of an <see cref="McpServerResource"/>.
/// </summary>
/// <remarks>
/// <para>
/// These options allow for customizing the behavior and metadata of resources created with
/// <see cref="M:McpServerResource.Create"/>. They provide control over naming, description,
/// and dependency injection integration.
/// </para>
/// <para>
/// When creating resources programmatically rather than using attributes, these options
/// provide the same level of configuration flexibility.
/// </para>
/// </remarks>
public sealed class McpServerResourceCreateOptions
{
/// <summary>
/// Gets or sets optional services used in the construction of the <see cref="McpServerResource"/>.
/// </summary>
/// <remarks>
/// These services will be used to determine which parameters should be satisifed from dependency injection. As such,
/// what services are satisfied via this provider should match what's satisfied via the provider passed in at invocation time.
/// </remarks>
public IServiceProvider? Services { get; set; }
/// <summary>
/// Gets or sets the URI template of the <see cref="McpServerResource"/>.
/// </summary>
/// <remarks>
/// If <see langword="null"/>, but an <see cref="McpServerResourceAttribute"/> is applied to the member,
/// the <see cref="McpServerResourceAttribute.UriTemplate"/> from the attribute will be used. If that's not present,
/// a URI template will be inferred from the member's signature.
/// </remarks>
public string? UriTemplate { get; set; }
/// <summary>
/// Gets or sets the name to use for the <see cref="McpServerResource"/>.
/// </summary>
/// <remarks>
/// If <see langword="null"/>, but an <see cref="McpServerResourceAttribute"/> is applied to the member,
/// the name from the attribute will be used. If that's not present, a name based on the members's name will be used.
/// </remarks>
public string? Name { get; set; }
/// <summary>
/// Gets or set the description to use for the <see cref="McpServerResource"/>.
/// </summary>
/// <remarks>
/// If <see langword="null"/>, but a <see cref="DescriptionAttribute"/> is applied to the member,
/// the description from that attribute will be used.
/// </remarks>
public string? Description { get; set; }
/// <summary>
/// Gets or sets the MIME (media) type of the <see cref="McpServerResource"/>.
/// </summary>
public string? MimeType { get; set; }
/// <summary>
/// Creates a shallow clone of the current <see cref="McpServerResourceCreateOptions"/> instance.
/// </summary>
internal McpServerResourceCreateOptions Clone() =>
new McpServerResourceCreateOptions
{
Services = Services,
UriTemplate = UriTemplate,
Name = Name,
Description = Description,
MimeType = MimeType,
};
}