Class McpJsonUtilities
- Namespace
- ModelContextProtocol
- Assembly
- ModelContextProtocol.Core.dll
Provides a collection of utility methods for working with JSON data in the context of MCP.
public static class McpJsonUtilities
- Inheritance
-
McpJsonUtilities
- Inherited Members
Properties
DefaultOptions
Gets the JsonSerializerOptions singleton used as the default in JSON serialization operations.
public static JsonSerializerOptions DefaultOptions { get; }
Property Value
Remarks
For Native AOT or applications disabling IsReflectionEnabledByDefault, this instance includes source generated contracts for all common exchange types contained in the ModelContextProtocol library.
It additionally turns on the following settings:
- Enables Web defaults.
- Enables WhenWritingNull as the default ignore condition for properties.
- Enables AllowReadingFromString as the default number handling for number types.
Methods
GetTypeInfo<T>(JsonSerializerOptions)
Gets the resolved JsonTypeInfo<T> for T from the specified options.
public static JsonTypeInfo<T> GetTypeInfo<T>(this JsonSerializerOptions options)
Parameters
optionsJsonSerializerOptionsThe serializer options providing the type-info resolver chain.
Returns
- JsonTypeInfo<T>
The resolved JsonTypeInfo<T>.
Type Parameters
TThe type whose serialization metadata should be resolved.