forked from modelcontextprotocol/csharp-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMcpServerResource.cs
More file actions
28 lines (24 loc) · 910 Bytes
/
McpServerResource.cs
File metadata and controls
28 lines (24 loc) · 910 Bytes
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
using Microsoft.Extensions.FileProviders;
using ModelContextProtocol.Protocol.Types;
namespace ModelContextProtocol.Server;
/// <summary>
/// Represents a resource that the server supports.
/// </summary>
public abstract class McpServerResource : IMcpServerPrimitive
{
/// <summary>
/// The resource instance.
/// </summary>
public abstract required Resource ProtocolResource { get; init; }
/// <inheritdoc />
public string Name => ProtocolResource.Name;
/// <summary>
/// Gets the resource URI.
/// </summary>
/// <param name="request">The request context.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The file info of the resource.</returns>
public abstract Task<IFileInfo> GetFileInfoAsync(
RequestContext<ReadResourceRequestParams> request,
CancellationToken cancellationToken = default);
}