Table of Contents

Class ServerCapabilities

Namespace
ModelContextProtocol.Protocol
Assembly
ModelContextProtocol.Core.dll

Represents the capabilities that a server may support.

public class ServerCapabilities
Inheritance
ServerCapabilities
Inherited Members

Remarks

Server capabilities define the features and functionality available when clients connect. These capabilities are advertised to clients during the initialize handshake.

See the schema for details.

Properties

Completions

Gets or sets a server's completions capability for supporting argument auto-completion suggestions.

[JsonPropertyName("completions")]
public CompletionsCapability? Completions { get; set; }

Property Value

CompletionsCapability

Experimental

Gets or sets experimental, non-standard capabilities that the server supports.

[JsonPropertyName("experimental")]
public Dictionary<string, object>? Experimental { get; set; }

Property Value

Dictionary<string, object>

Remarks

The Experimental dictionary allows servers to advertise support for features that are not yet standardized in the Model Context Protocol specification. This extension mechanism enables future protocol enhancements while maintaining backward compatibility.

Values in this dictionary are implementation-specific and should be coordinated between client and server implementations. Clients should not assume the presence of any experimental capability without checking for it first.

Logging

Gets or sets a server's logging capability, supporting sending log messages to the client.

[JsonPropertyName("logging")]
public LoggingCapability? Logging { get; set; }

Property Value

LoggingCapability

NotificationHandlers

Gets or sets notification handlers to register with the server.

[JsonIgnore]
public IEnumerable<KeyValuePair<string, Func<JsonRpcNotification, CancellationToken, ValueTask>>>? NotificationHandlers { get; set; }

Property Value

IEnumerable<KeyValuePair<string, Func<JsonRpcNotification, CancellationToken, ValueTask>>>

Remarks

When constructed, the server will enumerate these handlers once, which may contain multiple handlers per notification method key. The server will not re-enumerate the sequence after initialization.

Notification handlers allow the server to respond to client-sent notifications for specific methods. Each key in the collection is a notification method name, and each value is a callback that will be invoked when a notification with that method is received.

Handlers provided via NotificationHandlers will be registered with the server for the lifetime of the server. For transient handlers, RegisterNotificationHandler(string, Func<JsonRpcNotification, CancellationToken, ValueTask>) may be used to register a handler that can then be unregistered by disposing of the IAsyncDisposable returned from the method.

Prompts

Gets or sets a server's prompts capability for serving predefined prompt templates that clients can discover and use.

[JsonPropertyName("prompts")]
public PromptsCapability? Prompts { get; set; }

Property Value

PromptsCapability

Resources

Gets or sets a server's resources capability for serving predefined resources that clients can discover and use.

[JsonPropertyName("resources")]
public ResourcesCapability? Resources { get; set; }

Property Value

ResourcesCapability

Tools

Gets or sets a server's tools capability for listing tools that a client is able to invoke.

[JsonPropertyName("tools")]
public ToolsCapability? Tools { get; set; }

Property Value

ToolsCapability