Skip to main content

Definition

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

Syntax

Microsoft.OData.Mcp.Core.Legacy.Generators.QueryToolGenerator

Summary

Generates query MCP tools from OData entity types.

Remarks

This generator creates MCP tools that allow AI models to perform advanced querying operations on OData entities, including filtering, sorting, projection, and expansion. It supports all standard OData query options like filter,filter, orderby, select,select, expand, top,top, skip, and $search.

Constructors

.ctor

Initializes a new instance of the QueryToolGenerator class.

Syntax

public QueryToolGenerator(Microsoft.Extensions.Logging.ILogger<Microsoft.OData.Mcp.Core.Legacy.Generators.QueryToolGenerator> logger)

Parameters

NameTypeDescription
loggerMicrosoft.Extensions.Logging.ILogger<Microsoft.OData.Mcp.Core.Legacy.Generators.QueryToolGenerator>The logger instance.

.ctor Inherited

Inherited from object

Syntax

public Object()

Methods

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

GenerateAllQueryToolsAsync

Generates all query tools for the specified entity set.

Syntax

public System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.OData.Mcp.Core.Legacy.McpTool>> GenerateAllQueryToolsAsync(Microsoft.OData.Mcp.Core.Models.EdmEntitySet entitySet, Microsoft.OData.Mcp.Core.Models.EdmEntityType entityType, Microsoft.OData.Mcp.Core.Legacy.Generators.QueryToolGenerationOptions options, System.Threading.CancellationToken cancellationToken = null)

Parameters

NameTypeDescription
entitySetMicrosoft.OData.Mcp.Core.Models.EdmEntitySetThe entity set to generate tools for.
entityTypeMicrosoft.OData.Mcp.Core.Models.EdmEntityTypeThe entity type definition.
optionsMicrosoft.OData.Mcp.Core.Legacy.Generators.QueryToolGenerationOptionsOptions controlling tool generation behavior.
cancellationTokenSystem.Threading.CancellationTokenCancellation token for the operation.

Returns

Type: System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.OData.Mcp.Core.Legacy.McpTool>> A collection of generated MCP tools for query operations.

GenerateCountToolAsync

Generates a count tool for getting entity counts with optional filtering.

Syntax

public System.Threading.Tasks.Task<Microsoft.OData.Mcp.Core.Legacy.McpTool> GenerateCountToolAsync(Microsoft.OData.Mcp.Core.Models.EdmEntitySet entitySet, Microsoft.OData.Mcp.Core.Models.EdmEntityType entityType, Microsoft.OData.Mcp.Core.Legacy.Generators.QueryToolGenerationOptions options, System.Threading.CancellationToken cancellationToken = null)

Parameters

NameTypeDescription
entitySetMicrosoft.OData.Mcp.Core.Models.EdmEntitySetThe entity set to count.
entityTypeMicrosoft.OData.Mcp.Core.Models.EdmEntityTypeThe entity type definition.
optionsMicrosoft.OData.Mcp.Core.Legacy.Generators.QueryToolGenerationOptionsOptions controlling tool generation behavior.
cancellationTokenSystem.Threading.CancellationTokenCancellation token for the operation.

Returns

Type: System.Threading.Tasks.Task<Microsoft.OData.Mcp.Core.Legacy.McpTool> A count MCP tool for the entity type.

GenerateListToolAsync

Generates a query tool for listing entities with filtering and sorting.

Syntax

public System.Threading.Tasks.Task<Microsoft.OData.Mcp.Core.Legacy.McpTool> GenerateListToolAsync(Microsoft.OData.Mcp.Core.Models.EdmEntitySet entitySet, Microsoft.OData.Mcp.Core.Models.EdmEntityType entityType, Microsoft.OData.Mcp.Core.Legacy.Generators.QueryToolGenerationOptions options, System.Threading.CancellationToken cancellationToken = null)

Parameters

NameTypeDescription
entitySetMicrosoft.OData.Mcp.Core.Models.EdmEntitySetThe entity set to query.
entityTypeMicrosoft.OData.Mcp.Core.Models.EdmEntityTypeThe entity type definition.
optionsMicrosoft.OData.Mcp.Core.Legacy.Generators.QueryToolGenerationOptionsOptions controlling tool generation behavior.
cancellationTokenSystem.Threading.CancellationTokenCancellation token for the operation.

Returns

Type: System.Threading.Tasks.Task<Microsoft.OData.Mcp.Core.Legacy.McpTool> A query MCP tool for the entity type.

GenerateSearchToolAsync

Generates a search tool for full-text search across entity properties.

Syntax

public System.Threading.Tasks.Task<Microsoft.OData.Mcp.Core.Legacy.McpTool> GenerateSearchToolAsync(Microsoft.OData.Mcp.Core.Models.EdmEntitySet entitySet, Microsoft.OData.Mcp.Core.Models.EdmEntityType entityType, Microsoft.OData.Mcp.Core.Legacy.Generators.QueryToolGenerationOptions options, System.Threading.CancellationToken cancellationToken = null)

Parameters

NameTypeDescription
entitySetMicrosoft.OData.Mcp.Core.Models.EdmEntitySetThe entity set to search.
entityTypeMicrosoft.OData.Mcp.Core.Models.EdmEntityTypeThe entity type definition.
optionsMicrosoft.OData.Mcp.Core.Legacy.Generators.QueryToolGenerationOptionsOptions controlling tool generation behavior.
cancellationTokenSystem.Threading.CancellationTokenCancellation token for the operation.

Returns

Type: System.Threading.Tasks.Task<Microsoft.OData.Mcp.Core.Legacy.McpTool> A search MCP tool for the entity type.

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?