Skip to content

Commit c87eba3

Browse files
authored
Core Protocol docs edit pass (#1032)
1 parent f45996d commit c87eba3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+242
-240
lines changed

src/ModelContextProtocol.Core/Protocol/Annotations.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public sealed class Annotations
2222
/// </summary>
2323
/// <remarks>
2424
/// The value is a floating-point number between 0 and 1, where 0 represents the lowest priority
25-
/// 1 represents highest priority.
25+
/// and 1 represents the highest priority.
2626
/// </remarks>
2727
[JsonPropertyName("priority")]
2828
public float? Priority { get; set; }
@@ -31,8 +31,8 @@ public sealed class Annotations
3131
/// Gets or sets the moment the resource was last modified.
3232
/// </summary>
3333
/// <remarks>
34-
/// The corresponding JSON should be an ISO 8601 formatted string (e.g., \"2025-01-12T15:00:58Z\").
35-
/// Examples: last activity timestamp in an open file, timestamp when the resource was attached, etc.
34+
/// The corresponding JSON should be an ISO 8601 formatted string (for example, \"2025-01-12T15:00:58Z\").
35+
/// Examples of when the resource was last modified include last activity in an open file or when the resource was attached.
3636
/// </remarks>
3737
[JsonPropertyName("lastModified")]
3838
public DateTimeOffset? LastModified { get; set; }

src/ModelContextProtocol.Core/Protocol/Argument.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public sealed class Argument
2121
/// Gets or sets the current partial text value for which completion suggestions are requested.
2222
/// </summary>
2323
/// <remarks>
24-
/// This represents the text that has been entered so far and for which completion
24+
/// This property represents the text that has been entered so far and for which completion
2525
/// options should be generated.
2626
/// </remarks>
2727
[JsonPropertyName("value")]

src/ModelContextProtocol.Core/Protocol/CallToolResult.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,19 @@ public sealed class CallToolResult : Result
3636
public JsonNode? StructuredContent { get; set; }
3737

3838
/// <summary>
39-
/// Gets or sets an indication of whether the tool call was unsuccessful.
39+
/// Gets or sets a value that indicates whether the tool call was unsuccessful.
4040
/// </summary>
41+
/// <value>
42+
/// <see langword="true"/> to signify that the tool execution failed; <see langword="false"/> if it was successful.
43+
/// </value>
4144
/// <remarks>
4245
/// <para>
43-
/// When set to <see langword="true"/>, it signifies that the tool execution failed.
4446
/// Tool execution errors (including input validation errors, API failures, and business logic errors)
4547
/// are reported with this property set to <see langword="true"/> and details in the <see cref="Content"/>
4648
/// property, rather than as protocol-level errors.
4749
/// </para>
4850
/// <para>
49-
/// This allows language models to receive detailed error feedback and potentially self-correct
51+
/// This design allows language models to receive detailed error feedback and potentially self-correct
5052
/// in subsequent requests. For example, if a date parameter is in the wrong format or out of range,
5153
/// the error message in <see cref="Content"/> can explain the issue, enabling the model to retry
5254
/// with corrected parameters.

src/ModelContextProtocol.Core/Protocol/CancelledNotificationParams.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public sealed class CancelledNotificationParams : NotificationParams
1717
/// Gets or sets the ID of the request to cancel.
1818
/// </summary>
1919
/// <remarks>
20-
/// This must match the ID of an in-flight request that the sender wishes to cancel.
20+
/// This value must match the ID of an in-flight request that the sender wishes to cancel.
2121
/// </remarks>
2222
[JsonPropertyName("requestId")]
2323
public required RequestId RequestId { get; set; }
@@ -27,4 +27,4 @@ public sealed class CancelledNotificationParams : NotificationParams
2727
/// </summary>
2828
[JsonPropertyName("reason")]
2929
public string? Reason { get; set; }
30-
}
30+
}

src/ModelContextProtocol.Core/Protocol/ClientCapabilities.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespace ModelContextProtocol.Protocol;
77

88
/// <summary>
9-
/// Represents the capabilities that a client may support.
9+
/// Represents the capabilities that a client supports.
1010
/// </summary>
1111
/// <remarks>
1212
/// <para>
@@ -24,13 +24,13 @@ public sealed class ClientCapabilities
2424
/// </summary>
2525
/// <remarks>
2626
/// <para>
27-
/// The <see cref="Experimental"/> dictionary allows clients to advertise support for features that are not yet
28-
/// standardized in the Model Context Protocol specification. This extension mechanism enables
27+
/// The <see cref="Experimental"/> dictionary allows clients to advertise support for features that are not yet
28+
/// standardized in the Model Context Protocol specification. This extension mechanism enables
2929
/// future protocol enhancements while maintaining backward compatibility.
3030
/// </para>
3131
/// <para>
32-
/// Values in this dictionary are implementation-specific and should be coordinated between client
33-
/// and server implementations. Servers should not assume the presence of any experimental capability
32+
/// Values in this dictionary are implementation-specific and should be coordinated between client
33+
/// and server implementations. Servers should not assume the presence of any experimental capability
3434
/// without checking for it first.
3535
/// </para>
3636
/// </remarks>
@@ -42,7 +42,7 @@ public sealed class ClientCapabilities
4242
/// </summary>
4343
/// <remarks>
4444
/// <para>
45-
/// When <see cref="Roots"/> is non-<see langword="null"/>, the client indicates that it can respond to
45+
/// When <see cref="Roots"/> is non-<see langword="null"/>, the client indicates that it can respond to
4646
/// server requests for listing root URIs. Root URIs serve as entry points for resource navigation in the protocol.
4747
/// </para>
4848
/// <para>
@@ -54,14 +54,14 @@ public sealed class ClientCapabilities
5454
public RootsCapability? Roots { get; set; }
5555

5656
/// <summary>
57-
/// Gets or sets the client's sampling capability, which indicates whether the client
57+
/// Gets or sets the client's sampling capability, which indicates whether the client
5858
/// supports issuing requests to an LLM on behalf of the server.
5959
/// </summary>
6060
[JsonPropertyName("sampling")]
6161
public SamplingCapability? Sampling { get; set; }
6262

6363
/// <summary>
64-
/// Gets or sets the client's elicitation capability, which indicates whether the client
64+
/// Gets or sets the client's elicitation capability, which indicates whether the client
6565
/// supports elicitation of additional information from the user on behalf of the server.
6666
/// </summary>
6767
[JsonPropertyName("elicitation")]
@@ -70,7 +70,7 @@ public sealed class ClientCapabilities
7070
/// <summary>Gets or sets notification handlers to register with the client.</summary>
7171
/// <remarks>
7272
/// <para>
73-
/// When constructed, the client will enumerate these handlers once, which may contain multiple handlers per notification method key.
73+
/// When constructed, the client will enumerate these handlers, which may contain multiple handlers per notification method key, once.
7474
/// The client will not re-enumerate the sequence after initialization.
7575
/// </para>
7676
/// <para>
@@ -80,12 +80,12 @@ public sealed class ClientCapabilities
8080
/// </para>
8181
/// <para>
8282
/// Handlers provided via <see cref="NotificationHandlers"/> will be registered with the client for the lifetime of the client.
83-
/// For transient handlers, <see cref="McpSession.RegisterNotificationHandler"/> may be used to register a handler that can
83+
/// For transient handlers, <see cref="McpSession.RegisterNotificationHandler"/> can be used to register a handler that can
8484
/// then be unregistered by disposing of the <see cref="IAsyncDisposable"/> returned from the method.
8585
/// </para>
8686
/// </remarks>
8787
[JsonIgnore]
8888
[Obsolete($"Use {nameof(McpClientOptions.Handlers.NotificationHandlers)} instead. This member will be removed in a subsequent release.")] // See: https://github.com/modelcontextprotocol/csharp-sdk/issues/774
8989
[EditorBrowsable(EditorBrowsableState.Never)]
9090
public IEnumerable<KeyValuePair<string, Func<JsonRpcNotification, CancellationToken, ValueTask>>>? NotificationHandlers { get; set; }
91-
}
91+
}

src/ModelContextProtocol.Core/Protocol/Completion.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public sealed class Completion
1616
/// <remarks>
1717
/// This collection contains the actual text strings to be presented to users as completion suggestions.
1818
/// The array will be empty if no suggestions are available for the current input.
19-
/// Per the specification, this should not exceed 100 items.
19+
/// Per the specification, this collection should not exceed 100 items.
2020
/// </remarks>
2121
[JsonPropertyName("values")]
2222
public IList<string> Values { get; set; } = [];
@@ -25,13 +25,13 @@ public sealed class Completion
2525
/// Gets or sets the total number of completion options available.
2626
/// </summary>
2727
/// <remarks>
28-
/// This can exceed the number of values actually sent in the response.
28+
/// This value can exceed the number of values actually sent in the response.
2929
/// </remarks>
3030
[JsonPropertyName("total")]
3131
public int? Total { get; set; }
3232

3333
/// <summary>
34-
/// Gets or sets an indicator as to whether there are additional completion options beyond
34+
/// Gets or sets a value that indicates whether there are additional completion options beyond
3535
/// those provided in the current response, even if the exact total is unknown.
3636
/// </summary>
3737
[JsonPropertyName("hasMore")]

src/ModelContextProtocol.Core/Protocol/CompletionsCapability.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace ModelContextProtocol.Protocol;
2323
/// <para>
2424
/// This class is intentionally empty as the Model Context Protocol specification does not
2525
/// currently define additional properties for sampling capabilities. Future versions of the
26-
/// specification may extend this capability with additional configuration options.
26+
/// specification might extend this capability with additional configuration options.
2727
/// </para>
2828
/// </remarks>
2929
public sealed class CompletionsCapability
@@ -40,4 +40,4 @@ public sealed class CompletionsCapability
4040
[Obsolete($"Use {nameof(McpServerOptions.Handlers.CompleteHandler)} instead. This member will be removed in a subsequent release.")] // See: https://github.com/modelcontextprotocol/csharp-sdk/issues/774
4141
[EditorBrowsable(EditorBrowsableState.Never)]
4242
public McpRequestHandler<CompleteRequestParams, CompleteResult>? CompleteHandler { get; set; }
43-
}
43+
}

src/ModelContextProtocol.Core/Protocol/ContentBlock.cs

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,11 @@ private protected ContentBlock()
3535
/// <summary>
3636
/// When overridden in a derived class, gets the type of content.
3737
/// </summary>
38+
/// <value>
39+
/// The type of content. Valid values include "image", "audio", "text", "resource", "resource_link", "tool_use", and "tool_result".
40+
/// </value>
3841
/// <remarks>
39-
/// This determines the structure of the content object. Valid values include "image", "audio", "text", "resource", "resource_link", "tool_use", and "tool_result".
42+
/// This value determines the structure of the content object.
4043
/// </remarks>
4144
[JsonPropertyName("type")]
4245
public abstract string Type { get; }
@@ -381,9 +384,7 @@ public sealed class ImageContentBlock : ContentBlock
381384
/// Gets or sets the MIME type (or "media type") of the content, specifying the format of the data.
382385
/// </summary>
383386
/// <remarks>
384-
/// <para>
385387
/// Common values include "image/png" and "image/jpeg".
386-
/// </para>
387388
/// </remarks>
388389
[JsonPropertyName("mimeType")]
389390
public required string MimeType { get; set; }
@@ -405,9 +406,7 @@ public sealed class AudioContentBlock : ContentBlock
405406
/// Gets or sets the MIME type (or "media type") of the content, specifying the format of the data.
406407
/// </summary>
407408
/// <remarks>
408-
/// <para>
409409
/// Common values include "audio/wav" and "audio/mp3".
410-
/// </para>
411410
/// </remarks>
412411
[JsonPropertyName("mimeType")]
413412
public required string MimeType { get; set; }
@@ -427,7 +426,7 @@ public sealed class EmbeddedResourceBlock : ContentBlock
427426
/// </summary>
428427
/// <remarks>
429428
/// <para>
430-
/// Resources can be either text-based (<see cref="TextResourceContents"/>) or
429+
/// Resources can be either text-based (<see cref="TextResourceContents"/>) or
431430
/// binary (<see cref="BlobResourceContents"/>), allowing for flexible data representation.
432431
/// Each resource has a URI that can be used for identification and retrieval.
433432
/// </para>
@@ -463,7 +462,7 @@ public sealed class ResourceLinkBlock : ContentBlock
463462
/// </summary>
464463
/// <remarks>
465464
/// <para>
466-
/// This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a \"hint\" to the model.
465+
/// This description can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a \"hint\" to the model.
467466
/// </para>
468467
/// <para>
469468
/// The description should provide clear context about the resource's content, format, and purpose.
@@ -487,7 +486,7 @@ public sealed class ResourceLinkBlock : ContentBlock
487486
/// "image/png" for PNG images, and "application/json" for JSON data.
488487
/// </para>
489488
/// <para>
490-
/// This property may be <see langword="null"/> if the MIME type is unknown or not applicable for the resource.
489+
/// This property can be <see langword="null"/> if the MIME type is unknown or not applicable for the resource.
491490
/// </para>
492491
/// </remarks>
493492
[JsonPropertyName("mimeType")]
@@ -497,7 +496,7 @@ public sealed class ResourceLinkBlock : ContentBlock
497496
/// Gets or sets the size of the raw resource content (before base64 encoding), in bytes, if known.
498497
/// </summary>
499498
/// <remarks>
500-
/// This can be used by applications to display file sizes and estimate context window usage.
499+
/// This value can be used by applications to display file sizes and estimate context window usage.
501500
/// </remarks>
502501
[JsonPropertyName("size")]
503502
public long? Size { get; set; }
@@ -541,7 +540,7 @@ public sealed class ToolResultContentBlock : ContentBlock
541540
/// Gets or sets the ID of the tool use this result corresponds to.
542541
/// </summary>
543542
/// <remarks>
544-
/// This must match the ID from a previous <see cref="ToolUseContentBlock"/>.
543+
/// This value must match the ID from a previous <see cref="ToolUseContentBlock"/>.
545544
/// </remarks>
546545
[JsonPropertyName("toolUseId")]
547546
public required string ToolUseId { get; set; }
@@ -550,7 +549,7 @@ public sealed class ToolResultContentBlock : ContentBlock
550549
/// Gets or sets the unstructured result content of the tool use.
551550
/// </summary>
552551
/// <remarks>
553-
/// This has the same format as CallToolResult.Content and can include text, images,
552+
/// This value has the same format as CallToolResult.Content and can include text, images,
554553
/// audio, resource links, and embedded resources.
555554
/// </remarks>
556555
[JsonPropertyName("content")]
@@ -560,17 +559,19 @@ public sealed class ToolResultContentBlock : ContentBlock
560559
/// Gets or sets an optional structured result object.
561560
/// </summary>
562561
/// <remarks>
563-
/// If the tool defined an outputSchema, this should conform to that schema.
562+
/// If the tool defined an outputSchema, this object should conform to that schema.
564563
/// </remarks>
565564
[JsonPropertyName("structuredContent")]
566565
public JsonElement? StructuredContent { get; set; }
567566

568567
/// <summary>
569-
/// Gets or sets whether the tool use resulted in an error.
568+
/// Gets or sets a value that indicates whether the tool use resulted in an error.
570569
/// </summary>
570+
/// <value>
571+
/// <see langword="true"/> if the tool use resulted in an error; <see langword="false"/> if it succeeded. The default is <see langword="false"/>.
572+
/// </value>
571573
/// <remarks>
572-
/// If true, the content typically describes the error that occurred.
573-
/// Default: false
574+
/// If <see langword="true"/>, the content typically describes the error that occurred.
574575
/// </remarks>
575576
[JsonPropertyName("isError")]
576577
public bool? IsError { get; set; }

src/ModelContextProtocol.Core/Protocol/ContextInclusion.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@ namespace ModelContextProtocol.Protocol;
1212
/// <para>
1313
/// <see cref="ContextInclusion"/>, and in particular <see cref="ThisServer"/> and <see cref="AllServers"/>, are deprecated.
1414
/// Servers should only use these values if the client declares <see cref="ClientCapabilities.Sampling"/> with
15-
/// <see cref="SamplingCapability.Context"/> set. These values may be removed in future spec releases.
15+
/// <see cref="SamplingCapability.Context"/> set. These values might be removed in future spec releases.
1616
/// </para>
1717
/// </remarks>
1818
[JsonConverter(typeof(JsonStringEnumConverter<ContextInclusion>))]
1919
public enum ContextInclusion
2020
{
2121
/// <summary>
22-
/// Indicates that no context should be included.
22+
/// No context should be included.
2323
/// </summary>
2424
[JsonStringEnumMemberName("none")]
2525
None,
2626

2727
/// <summary>
28-
/// Indicates that context from the server that sent the request should be included.
28+
/// Context from the server that sent the request should be included.
2929
/// </summary>
3030
/// <remarks>
3131
/// This value is soft-deprecated. Servers should only use this value if the client
@@ -35,7 +35,7 @@ public enum ContextInclusion
3535
ThisServer,
3636

3737
/// <summary>
38-
/// Indicates that context from all servers that the client is connected to should be included.
38+
/// Context from all servers that the client is connected to should be included.
3939
/// </summary>
4040
/// <remarks>
4141
/// This value is soft-deprecated. Servers should only use this value if the client

0 commit comments

Comments
 (0)