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.CrudToolGenerator

Summary

Generates CRUD (Create, Read, Update, Delete) MCP tools from OData entity types.

Remarks

This generator creates MCP tools that allow AI models to perform basic data operations on OData entities. It generates separate tools for each CRUD operation, with proper validation, documentation, and parameter handling.

Constructors

.ctor

Initializes a new instance of the CrudToolGenerator class.

Syntax

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

Parameters

NameTypeDescription
loggerMicrosoft.Extensions.Logging.ILogger<Microsoft.OData.Mcp.Core.Legacy.Generators.CrudToolGenerator>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

GenerateAllCrudToolsAsync

Generates all CRUD tools for the specified entity set.

Syntax

public System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.OData.Mcp.Core.Legacy.McpTool>> GenerateAllCrudToolsAsync(Microsoft.OData.Mcp.Core.Models.EdmEntitySet entitySet, Microsoft.OData.Mcp.Core.Models.EdmEntityType entityType, Microsoft.OData.Mcp.Core.Legacy.Generators.CrudToolGenerationOptions 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.CrudToolGenerationOptionsOptions 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 CRUD operations.

GenerateCreateToolAsync

Generates a CREATE tool for the specified entity type.

Syntax

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

Parameters

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

Returns

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

GenerateDeleteToolAsync

Generates a DELETE tool for the specified entity type.

Syntax

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

Parameters

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

Returns

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

GenerateReadToolAsync

Generates a READ tool for the specified entity type.

Syntax

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

Parameters

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

Returns

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

GenerateUpdateToolAsync

Generates an UPDATE tool for the specified entity type.

Syntax

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

Parameters

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

Returns

Type: System.Threading.Tasks.Task<Microsoft.OData.Mcp.Core.Legacy.McpTool> An UPDATE 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?