Add ModelContextProtocol.Core package (#428)

This commit is contained in:
Stephen Halter 2025-06-02 15:16:45 -07:00 • committed by GitHub
commit 703b0fe50b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -0,0 +1,37 @@
using System.Text.Json;
using System.Text.Json.Serialization;
namespace ModelContextProtocol.Protocol;
/// <summary>
/// Represents a root URI and its metadata in the Model Context Protocol.
/// </summary>
/// <remarks>
/// Root URIs serve as entry points for resource navigation, typically representing
/// top-level directories or container resources that can be accessed and traversed.
/// Roots provide a hierarchical structure for organizing and accessing resources within the protocol.
/// Each root has a URI that uniquely identifies it and optional metadata like a human-readable name.
/// </remarks>
public class Root
{
/// <summary>
/// Gets or sets the URI of the root.
/// </summary>
[JsonPropertyName("uri")]
public required string Uri { get; init; }
/// <summary>
/// Gets or sets a human-readable name for the root.
/// </summary>
[JsonPropertyName("name")]
public string? Name { get; init; }
/// <summary>
/// Gets or sets additional metadata for the root.
/// </summary>
/// <remarks>
/// This is reserved by the protocol for future use.
/// </remarks>
[JsonPropertyName("meta")]
public JsonElement? Meta { get; init; }
}