Class ValueObjectMcpServerOptionsExtensions
Namespace: AdCodicem.ValueObjects.ModelContextProtocol
Assembly: AdCodicem.ValueObjects.ModelContextProtocol.dll
Adds the check of value-object arguments to server options the application builds or changes itself.
public static class ValueObjectMcpServerOptionsExtensions
Inheritance
object ← ValueObjectMcpServerOptionsExtensions
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Methods
AddValueObjectValidation(McpServerOptions)
Places the check of the value-object arguments of the tools
public static McpServerOptions AddValueObjectValidation(this McpServerOptions options)
Parameters
options McpServerOptions
The options of the server, before the server is created from them.
Returns
McpServerOptions
The options.
Remarks
The WithValueObjectTools methods of
var options = new McpServerOptions { ToolCollection = [ValueObjectMcpServerTool.Create(method)] };
await using var server = McpServer.Create(transport, options.AddValueObjectValidation());
or after adding a call-tool filter of the application's own where the options are changed later, in
HttpServerTransportOptions.ConfigureSessionOptions for instance, which runs for each session after the
options are configured: the check, already there, moves after that filter. The server builds its pipeline when it
is created, from the filters the options hold then. The SDK refuses call-tool filters beside an explicit
CallToolWithAlternateHandler, and throws when the server is created.
Exceptions
options is null.