Skip to content

Commit e2a802e

Browse files
authored
Writing style edits (#1024)
1 parent 820821f commit e2a802e

File tree

7 files changed

+54
-46
lines changed

7 files changed

+54
-46
lines changed

docs/concepts/elicitation/elicitation.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,22 @@ Servers request structured data from users with the <xref:ModelContextProtocol.S
1515
The C# SDK registers an instance of <xref:ModelContextProtocol.Server.McpServer> with the dependency injection container,
1616
so tools can simply add a parameter of type <xref:ModelContextProtocol.Server.McpServer> to their method signature to access it.
1717

18-
The MCP Server must specify the schema of each input value it is requesting from the user.
19-
Primitive types (string, number, boolean) and enum types are supported for elicitation requests.
20-
The schema may include a description to help the user understand what is being requested.
18+
The MCP Server must specify the schema of each input value it's requesting from the user.
19+
Primitive types (string, number, Boolean) and enum types are supported for elicitation requests.
20+
The schema might include a description to help the user understand what's being requested.
2121

2222
For enum types, the SDK supports several schema formats:
23-
- **UntitledSingleSelectEnumSchema**: A single-select enum where the enum values serve as both the value and display text
24-
- **TitledSingleSelectEnumSchema**: A single-select enum with separate display titles for each option (using JSON Schema `oneOf` with `const` and `title`)
25-
- **UntitledMultiSelectEnumSchema**: A multi-select enum allowing multiple values to be selected
26-
- **TitledMultiSelectEnumSchema**: A multi-select enum with display titles for each option
27-
- **LegacyTitledEnumSchema** (deprecated): The legacy enum schema using `enumNames` for backward compatibility
23+
24+
- **UntitledSingleSelectEnumSchema**: A single-select enum where the enum values serve as both the value and display text.
25+
- **TitledSingleSelectEnumSchema**: A single-select enum with separate display titles for each option (using JSON Schema `oneOf` with `const` and `title`).
26+
- **UntitledMultiSelectEnumSchema**: A multi-select enum allowing multiple values to be selected.
27+
- **TitledMultiSelectEnumSchema**: A multi-select enum with display titles for each option.
28+
- **LegacyTitledEnumSchema** (deprecated): The legacy enum schema using `enumNames` for backward compatibility.
2829

2930
The server can request a single input or multiple inputs at once.
3031
To help distinguish multiple inputs, each input has a unique name.
3132

32-
The following example demonstrates how a server could request a boolean response from the user.
33+
The following example demonstrates how a server could request a Boolean response from the user.
3334

3435
[!code-csharp[](samples/server/Tools/InteractiveTools.cs?name=snippet_GuessTheNumber)]
3536

@@ -46,7 +47,6 @@ This will be highly dependent on the client application and how it interacts wit
4647
If the user provides the requested information, the ElicitationHandler should return an <xref:ModelContextProtocol.Protocol.ElicitResult> with the action set to "accept" and the content containing the user's input.
4748
If the user does not provide the requested information, the ElicitationHandler should return an [<xref:ModelContextProtocol.Protocol.ElicitResult> with the action set to "reject" and no content.
4849

49-
Below is an example of how a console application might handle elicitation requests.
50-
Here's an example implementation:
50+
Here's an example implementation of how a console application might handle elicitation requests:
5151

5252
[!code-csharp[](samples/client/Program.cs?name=snippet_ElicitationHandler)]

docs/concepts/filters.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ Execution flow: `filter1 -> filter2 -> filter3 -> baseHandler -> filter3 -> filt
6666
## Common Use Cases
6767

6868
### Logging
69+
6970
```csharp
7071
.AddListToolsFilter(next => async (context, cancellationToken) =>
7172
{
@@ -79,6 +80,7 @@ Execution flow: `filter1 -> filter2 -> filter3 -> baseHandler -> filter3 -> filt
7980
```
8081

8182
### Error Handling
83+
8284
```csharp
8385
.AddCallToolFilter(next => async (context, cancellationToken) =>
8486
{
@@ -98,6 +100,7 @@ Execution flow: `filter1 -> filter2 -> filter3 -> baseHandler -> filter3 -> filt
98100
```
99101

100102
### Performance Monitoring
103+
101104
```csharp
102105
.AddListToolsFilter(next => async (context, cancellationToken) =>
103106
{
@@ -112,6 +115,7 @@ Execution flow: `filter1 -> filter2 -> filter3 -> baseHandler -> filter3 -> filt
112115
```
113116

114117
### Caching
118+
115119
```csharp
116120
.AddListResourcesFilter(next => async (context, cancellationToken) =>
117121
{
@@ -214,22 +218,26 @@ public class RestrictedTools
214218
The authorization filters work differently for list operations versus individual operations:
215219

216220
#### List Operations (ListTools, ListPrompts, ListResources)
221+
217222
For list operations, the filters automatically remove unauthorized items from the results. Users only see tools, prompts, or resources they have permission to access.
218223

219224
#### Individual Operations (CallTool, GetPrompt, ReadResource)
225+
220226
For individual operations, the filters throw an `McpException` with "Access forbidden" message. These get turned into JSON-RPC errors if uncaught by middleware.
221227

222228
### Filter Execution Order and Authorization
223229

224230
Authorization filters are applied automatically when you call `AddAuthorizationFilters()`. These filters run at a specific point in the filter pipeline, which means:
225231

226232
**Filters added before authorization filters** can see:
227-
- Unauthorized requests for operations before they are rejected by the authorization filters
228-
- Complete listings for unauthorized primitives before they are filtered out by the authorization filters
233+
234+
- Unauthorized requests for operations before they are rejected by the authorization filters.
235+
- Complete listings for unauthorized primitives before they are filtered out by the authorization filters.
229236

230237
**Filters added after authorization filters** will only see:
231-
- Authorized requests that passed authorization checks
232-
- Filtered listings containing only authorized primitives
238+
239+
- Authorized requests that passed authorization checks.
240+
- Filtered listings containing only authorized primitives.
233241

234242
This allows you to implement logging, metrics, or other cross-cutting concerns that need to see all requests, while still maintaining proper authorization:
235243

@@ -312,6 +320,6 @@ You can also create custom authorization filters using the filter methods:
312320

313321
Within filters, you have access to:
314322

315-
- `context.User` - The current user's `ClaimsPrincipal`
316-
- `context.Services` - The request's service provider for resolving authorization services
317-
- `context.MatchedPrimitive` - The matched tool/prompt/resource with its metadata including authorization attributes via `context.MatchedPrimitive.Metadata`
323+
- `context.User` - The current user's `ClaimsPrincipal`.
324+
- `context.Services` - The request's service provider for resolving authorization services.
325+
- `context.MatchedPrimitive` - The matched tool/prompt/resource with its metadata including authorization attributes via `context.MatchedPrimitive.Metadata`.

docs/concepts/httpcontext/httpcontext.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ uid: httpcontext
77

88
## HTTP Context
99

10-
When using the Streamable HTTP transport, an MCP server may need to access the underlying [HttpContext] for a request.
10+
When using the Streamable HTTP transport, an MCP server might need to access the underlying [HttpContext] for a request.
1111
The [HttpContext] contains request metadata such as the HTTP headers, authorization context, and the actual path and query string for the request.
1212

1313
To access the [HttpContext], the MCP server should add the [IHttpContextAccessor] service to the application service collection (typically in Program.cs).
14-
Then any classes, e.g. a class containing MCP tools, should accept an [IHttpContextAccessor] in their constructor and store this for use by its methods.
14+
Then any classes, for example, a class containing MCP tools, should accept an [IHttpContextAccessor] in their constructor and store this for use by its methods.
1515
Methods then use the [HttpContext property][IHttpContextAccessor.HttpContext] of the accessor to get the current context.
1616

1717
[HttpContext]: https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.http.httpcontext

docs/concepts/logging/logging.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ uid: logging
77

88
## Logging
99

10-
MCP servers may expose log messages to clients through the [Logging utility].
10+
MCP servers can expose log messages to clients through the [Logging utility].
1111

1212
[Logging utility]: https://modelcontextprotocol.io/specification/2025-06-18/server/utilities/logging
1313

@@ -18,7 +18,7 @@ This document describes how to implement logging in MCP servers and how clients
1818
MCP uses the logging levels defined in [RFC 5424](https://tools.ietf.org/html/rfc5424).
1919

2020
The MCP C# SDK uses the standard .NET [ILogger] and [ILoggerProvider] abstractions, which support a slightly
21-
different set of logging levels. Here's the levels and how they map to standard .NET logging levels.
21+
different set of logging levels. The following table shows the levels and how they map to standard .NET logging levels.
2222

2323
| Level | .NET | Description | Example Use Case |
2424
|-----------|------|-----------------------------------|------------------------------|
@@ -46,8 +46,8 @@ MCP servers that implement the Logging utility must declare this in the capabili
4646
[Initialization]: https://modelcontextprotocol.io/specification/2025-06-18/basic/lifecycle#initialization
4747

4848
Servers built with the C# SDK always declare the logging capability. Doing so does not obligate the server
49-
to send log messages -- only allows it. Note that stateless MCP servers may not be capable of sending log
50-
messages as there may not be an open connection to the client on which the log messages could be sent.
49+
to send log messages&mdash;only allows it. Note that stateless MCP servers might not be capable of sending log
50+
messages as there might not be an open connection to the client on which the log messages could be sent.
5151

5252
The C# SDK provides an extension method <xref:Microsoft.Extensions.DependencyInjection.McpServerBuilderExtensions.WithSetLoggingLevelHandler*> on <xref:Microsoft.Extensions.DependencyInjection.IMcpServerBuilder> to allow the
5353
server to perform any special logic it wants to perform when a client sets the logging level. However, the
@@ -70,7 +70,7 @@ Clients should check if the server supports logging by checking the <xref:ModelC
7070

7171
If the server supports logging, the client should set the level of log messages it wishes to receive with
7272
the <xref:ModelContextProtocol.Client.McpClient.SetLoggingLevel*> method on <xref:ModelContextProtocol.Client.McpClient>. If the client does not set a logging level, the server might choose
73-
to send all log messages or none -- this is not specified in the protocol -- so it is important that the client
73+
to send all log messages or none&mdash;this is not specified in the protocol. So it's important that the client
7474
sets a logging level to ensure it receives the desired log messages and only those messages.
7575

7676
The `loggingLevel` set by the client is an MCP logging level.

docs/concepts/progress/progress.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The Model Context Protocol (MCP) supports [progress tracking] for long-running o
1212
[progress tracking]: https://modelcontextprotocol.io/specification/2025-06-18/basic/utilities/progress
1313

1414
Typically progress tracking is supported by server tools that perform operations that take a significant amount of time to complete, such as image generation or complex calculations.
15-
However, progress tracking is defined in the MCP specification as a general feature that can be implemented for any request that is handled by either a server or a client.
15+
However, progress tracking is defined in the MCP specification as a general feature that can be implemented for any request that's handled by either a server or a client.
1616
This project illustrates the common case of a server tool that performs a long-running operation and sends progress updates to the client.
1717

1818
### Server Implementation
@@ -30,7 +30,7 @@ The server must verify that the caller provided a `progressToken` in the request
3030
### Client Implementation
3131

3232
Clients request progress updates by including a `progressToken` in the parameters of a request.
33-
Note that servers are not required to support progress tracking, so clients should not depend on receiving progress updates.
33+
Note that servers aren't required to support progress tracking, so clients should not depend on receiving progress updates.
3434

3535
In the MCP C# SDK, clients can specify a `progressToken` in the request parameters when calling a tool method.
3636
The client should also provide a notification handler to process "notifications/progress" notifications.

docs/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ _layout: landing
44

55
# Overview
66

7-
The official C# SDK for the [Model Context Protocol](https://modelcontextprotocol.io/), enabling .NET applications, services, and libraries to implement and interact with MCP clients and servers. Please visit our [API documentation](https://modelcontextprotocol.github.io/csharp-sdk/api/ModelContextProtocol.html) for more details on available functionality.
7+
The official C# SDK for the [Model Context Protocol](https://modelcontextprotocol.io/), enabling .NET applications, services, and libraries to implement and interact with MCP clients and servers. For more details on available functionality, please see the [API documentation](https://modelcontextprotocol.github.io/csharp-sdk/api/ModelContextProtocol.html).
88

99
## About MCP
1010

@@ -16,11 +16,11 @@ For more information about MCP:
1616
- [Protocol Specification](https://modelcontextprotocol.io/specification/)
1717
- [GitHub Organization](https://github.com/modelcontextprotocol)
1818

19-
For how-to guides, tutorials, and additional guidance, refer to the [official MCP documentation](https://modelcontextprotocol.io/).
19+
For how-to guides, tutorials, and additional guidance, see the [official MCP documentation](https://modelcontextprotocol.io/).
2020

2121
## Official SDK packages
2222

23-
The official C# SDK packages for stable and pre-release versions are published to the [NuGet Gallery](https://www.nuget.org) under the [ModelContextProtocolOfficial](https://www.nuget.org/profiles/ModelContextProtocolOfficial) profile.
23+
The official C# SDK packages for stable and prerelease versions are published to the [NuGet Gallery](https://www.nuget.org) under the [ModelContextProtocolOfficial](https://www.nuget.org/profiles/ModelContextProtocolOfficial) profile.
2424

2525
Continuous integration builds are published to the modelcontextprotocol organization's [GitHub NuGet package registry](https://github.com/orgs/modelcontextprotocol/packages?ecosystem=nuget).
2626

0 commit comments

Comments
 (0)