Update content according to latest spec (#513)

* Update content according to latest spec

* Add Title to a bunch of types

* Add _meta to lots of types

* Address feedback, more cleanup, fix NAOT test failure
This commit is contained in:
Stephen Toub 2025-06-16 19:39:41 -04:00 • committed by GitHub
commit 2bcff315f8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,4 +1,5 @@
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;
namespace ModelContextProtocol.Protocol;
@ -6,14 +7,16 @@ namespace ModelContextProtocol.Protocol;
/// <summary>
/// Represents a tool that the server is capable of calling.
/// </summary>
public class Tool
public sealed class Tool : IBaseMetadata
{
/// <summary>
/// Gets or sets the name of the tool.
/// </summary>
/// <inheritdoc />
[JsonPropertyName("name")]
public string Name { get; set; } = string.Empty;
/// <inheritdoc />
[JsonPropertyName("title")]
public string? Title { get; set; }
/// <summary>
/// Gets or sets a human-readable description of the tool.
/// </summary>
@ -74,7 +77,7 @@ public class Tool
/// if an invalid schema is provided.
/// </para>
/// <para>
/// The schema should describe the shape of the data as returned in <see cref="CallToolResponse.StructuredContent"/>.
/// The schema should describe the shape of the data as returned in <see cref="CallToolResult.StructuredContent"/>.
/// </para>
/// </remarks>
[JsonPropertyName("outputSchema")]
@ -102,4 +105,13 @@ public class Tool
/// </remarks>
[JsonPropertyName("annotations")]
public ToolAnnotations? Annotations { get; set; }
/// <summary>
/// Gets or sets metadata reserved by MCP for protocol-level metadata.
/// </summary>
/// <remarks>
/// Implementations must not make assumptions about its contents.
/// </remarks>
[JsonPropertyName("_meta")]
public JsonObject? Meta { get; set; }
}