AI seeded comments from robch and then edited by stephentoub (#238)

* AI generated `///` comment updates

* Fix compilation issues

* Fix incorrect XML comment structure

* Update all Client comments

* Update all Configuration comments

* Update all Messages comments

* Update all Transport comments

* Update all Types comments

* Update all Server comments

* Undo some commenting

---------

Co-authored-by: Stephen Toub <stoub@microsoft.com>
This commit is contained in:
Rob Chambers 2025-04-09 22:30:44 -07:00 • committed by GitHub
commit 77871c5aac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,37 +1,58 @@
using ModelContextProtocol.Utils.Json;
using ModelContextProtocol.Utils.Json;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace ModelContextProtocol.Protocol.Types;
/// <summary>
/// Represents a tool that the server is capable of calling. Part of the ListToolsResponse.
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">See the schema for details</see>
/// Represents a tool that the server is capable of calling.
/// </summary>
public class Tool
{
private JsonElement _inputSchema = McpJsonUtilities.DefaultMcpToolSchema;
/// <summary>
/// The name of the tool.
/// Gets or sets the name of the tool.
/// </summary>
[JsonPropertyName("name")]
public string Name { get; set; } = string.Empty;
/// <summary>
/// A human-readable description of the tool.
/// Gets or sets a human-readable description of the tool.
/// </summary>
/// <remarks>
/// <para>
/// This description helps the AI model understand what the tool does and when to use it.
/// It should be clear, concise, and accurately describe the tool's purpose and functionality.
/// </para>
/// <para>
/// The description is typically presented to AI models to help them determine when
/// and how to use the tool based on user requests.
/// </para>
/// </remarks>
[JsonPropertyName("description")]
public string? Description { get; set; }
/// <summary>
/// A JSON Schema object defining the expected parameters for the tool.
/// Gets or sets a JSON Schema object defining the expected parameters for the tool.
/// </summary>
/// <remarks>
/// Needs to a valid JSON schema object that additionally is of type object.
/// <para>
/// The schema must be a valid JSON Schema object with the "type" property set to "object".
/// This is enforced by validation in the setter which will throw an <see cref="ArgumentException"/>
/// if an invalid schema is provided.
/// </para>
/// <para>
/// The schema typically defines the properties (parameters) that the tool accepts,
/// their types, and which ones are required. This helps AI models understand
/// how to structure their calls to the tool.
/// </para>
/// <para>
/// If not explicitly set, a default minimal schema of <c>{"type":"object"}</c> is used.
/// </para>
/// </remarks>
[JsonPropertyName("inputSchema")]
public JsonElement InputSchema
public JsonElement InputSchema
{
get => _inputSchema;
set
@ -46,8 +67,13 @@ public class Tool
}
/// <summary>
/// Optional additional tool information.
/// Gets or sets optional additional tool information and behavior hints.
/// </summary>
/// <remarks>
/// These annotations provide metadata about the tool's behavior, such as whether it's read-only,
/// destructive, idempotent, or operates in an open world. They also can include a human-readable title.
/// Note that these are hints and should not be relied upon for security decisions.
/// </remarks>
[JsonPropertyName("annotations")]
public ToolAnnotations? Annotations { get; set; }
}