Skip to main content

Definition

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

Syntax

Microsoft.OData.Mcp.Core.Server.DynamicODataMcpTools

Summary

Dynamic OData MCP tools that generate methods based on discovered OData metadata.

Remarks

This class provides dynamically generated MCP tools based on the structure of OData services. It discovers entity sets, operations, and schemas to create contextual tools for AI models.

Constructors

.ctor

Initializes a new instance of the DynamicODataMcpTools class.

Syntax

public DynamicODataMcpTools(System.Net.Http.IHttpClientFactory httpClientFactory, Microsoft.Extensions.Options.IOptions<Microsoft.OData.Mcp.Core.Configuration.McpServerConfiguration> configuration, Microsoft.OData.Mcp.Core.Parsing.ICsdlMetadataParser metadataParser, Microsoft.Extensions.Logging.ILogger<Microsoft.OData.Mcp.Core.Server.DynamicODataMcpTools> logger)

Parameters

NameTypeDescription
httpClientFactorySystem.Net.Http.IHttpClientFactoryThe HTTP client factory.
configurationMicrosoft.Extensions.Options.IOptions<Microsoft.OData.Mcp.Core.Configuration.McpServerConfiguration>The server configuration.
metadataParserMicrosoft.OData.Mcp.Core.Parsing.ICsdlMetadataParserThe CSDL metadata parser.
loggerMicrosoft.Extensions.Logging.ILogger<Microsoft.OData.Mcp.Core.Server.DynamicODataMcpTools>The logger instance.

.ctor Inherited

Inherited from object

Syntax

public Object()

Methods

DescribeEntityType

Gets detailed schema information for a specific entity type.

Syntax

public System.Threading.Tasks.Task<string> DescribeEntityType(string entityTypeName)

Parameters

NameTypeDescription
entityTypeNamestringThe name of the entity type to describe.

Returns

Type: System.Threading.Tasks.Task<string> Detailed schema information including properties, keys, and navigation properties.

DiscoverEntitySets

Discovers and lists all available entity sets in the OData service.

Syntax

public System.Threading.Tasks.Task<string> DiscoverEntitySets()

Returns

Type: System.Threading.Tasks.Task<string> A JSON array of entity set information including names and types.

Equals Inherited Virtual

Inherited from object

Syntax

public virtual bool Equals(object obj)

Parameters

NameTypeDescription
objobject?-

Returns

Type: bool

Equals Inherited

Inherited from object

Syntax

public static bool Equals(object objA, object objB)

Parameters

NameTypeDescription
objAobject?-
objBobject?-

Returns

Type: bool

GenerateQueryExamples

Generates sample OData query URLs for a specific entity set.

Syntax

public System.Threading.Tasks.Task<string> GenerateQueryExamples(string entitySetName, bool includeAdvanced = false)

Parameters

NameTypeDescription
entitySetNamestringThe name of the entity set.
includeAdvancedboolWhether to include advanced query examples.

Returns

Type: System.Threading.Tasks.Task<string> A collection of sample OData query URLs with explanations.

GetHashCode Inherited Virtual

Inherited from object

Syntax

public virtual int GetHashCode()

Returns

Type: int

GetType Inherited

Inherited from object

Syntax

public System.Type GetType()

Returns

Type: System.Type

MemberwiseClone Inherited

Inherited from object

Syntax

protected internal object MemberwiseClone()

Returns

Type: object

ReferenceEquals Inherited

Inherited from object

Syntax

public static bool ReferenceEquals(object objA, object objB)

Parameters

NameTypeDescription
objAobject?-
objBobject?-

Returns

Type: bool

ToString Inherited Virtual

Inherited from object

Syntax

public virtual string ToString()

Returns

Type: string?

ValidateQuery

Validates an OData query URL against the service metadata.

Syntax

public System.Threading.Tasks.Task<string> ValidateQuery(string queryUrl)

Parameters

NameTypeDescription
queryUrlstringThe OData query URL to validate.

Returns

Type: System.Threading.Tasks.Task<string> Validation results including any errors or warnings.