Skip to main content

Definition

Assembly: Microsoft.OData.Mcp.Core.dll Namespace: Microsoft.OData.Mcp.Core.Catalog Inheritance: System.Object

Syntax

Summary

Validates tool payloads against the declared EDM before any OData HTTP is sent, and formats values for the wire.

Remarks

This is how the first tools/call becomes the right one: a wrong JSON kind, an unknown property, a missing required-on-create value, an enum member that does not exist, or a string over MaxLength is reported with the declared shape instead of a round trip to the service. Every rule here is OPTIMIZATION.md §4 and §5.

Methods

DescribeExpected

Describes the JSON the EDM type expects, for error messages.

Syntax

Parameters

Returns

Type: string Text such as a JSON number or one of Red, Green.

Exceptions

FormatUrlLiteral

Formats a primitive or enumeration argument as an OData URL literal for a function call.

Syntax

Parameters

Returns

Type: string? The literal (for example 'open', 33, NS.Color'Red', duration'P1D'), or null when the value must travel as a parameter alias (complex types, collections, entities).

Exceptions

NormalizeBodyValue

Converts a validated argument to the value written into an action’s JSON body.

Syntax

Parameters

Returns

Type: object? The member name for enumerations given as numbers or OData literals; otherwise the element unchanged.

Exceptions

ValidateEntityBody

Validates a create or update body against the declared type.

Syntax

Parameters

Returns

Type: string? null when the body is valid; otherwise the message the caller returns as a tool error.

Exceptions

Remarks

Checks, in order: required-on-create (POST only, unless ODataMcpCatalogOptions.EnforceRequiredOnCreate is off), unknown properties on closed types, JSON kind per EDM type, null for non-nullable properties, enum membership, and MaxLength. Keys containing @ (annotations, Nav@odata.bind) and navigation property names (deep insert) are passed through.

ValidateOperationArguments

Validates the parameters object of an odata_call against the operation’s declared parameters.

Syntax

Parameters

Returns

Type: string? null when every argument is declared, required ones are present, and kinds match; otherwise the error message.

Exceptions

Remarks

Names match by exact spelling; there is no fuzzy matching. Passing the binding parameter is an unknown-parameter error.

ValidateOperationArguments

Validates non-binding operation arguments against the declared parameters.

Syntax

Parameters

Returns

Type: string? null when every argument is declared, required ones are present, and kinds match; otherwise the error message.

Exceptions

Remarks

Names match by exact spelling; there is no fuzzy matching. Passing the binding parameter is an unknown-parameter error.

ValidateValue

Validates one JSON value against an EDM type.

Syntax

Parameters

Returns

Type: string? null when the value fits; otherwise a sentence ending in a period.

Exceptions