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

Summary

Generates navigation MCP tools from OData entity relationships.

Remarks

This generator creates MCP tools that allow AI models to traverse entity relationships and work with related entities. It supports getting related entities, adding relationships, and removing relationships for both collection and single navigation properties.

Constructors

.ctor

Initializes a new instance of the NavigationToolGenerator class.

Syntax

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

Parameters

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

GenerateAddRelationshipToolAsync

Generates a tool for adding relationships between entities.

Syntax

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

Parameters

NameTypeDescription
entitySetMicrosoft.OData.Mcp.Core.Models.EdmEntitySetThe source entity set.
entityTypeMicrosoft.OData.Mcp.Core.Models.EdmEntityTypeThe source entity type.
navigationPropertyMicrosoft.OData.Mcp.Core.Models.EdmNavigationPropertyThe navigation property for the relationship.
optionsMicrosoft.OData.Mcp.Core.Legacy.Generators.NavigationToolGenerationOptionsOptions controlling tool generation behavior.
cancellationTokenSystem.Threading.CancellationTokenCancellation token for the operation.

Returns

Type: System.Threading.Tasks.Task<Microsoft.OData.Mcp.Core.Legacy.McpTool> A navigation MCP tool for adding relationships.

GenerateAllNavigationToolsAsync

Generates all navigation tools for the specified entity set and its relationships.

Syntax

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

GenerateGetRelatedToolAsync

Generates a tool for getting related entities via navigation properties.

Syntax

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

Parameters

NameTypeDescription
entitySetMicrosoft.OData.Mcp.Core.Models.EdmEntitySetThe source entity set.
entityTypeMicrosoft.OData.Mcp.Core.Models.EdmEntityTypeThe source entity type.
navigationPropertyMicrosoft.OData.Mcp.Core.Models.EdmNavigationPropertyThe navigation property to traverse.
optionsMicrosoft.OData.Mcp.Core.Legacy.Generators.NavigationToolGenerationOptionsOptions controlling tool generation behavior.
cancellationTokenSystem.Threading.CancellationTokenCancellation token for the operation.

Returns

Type: System.Threading.Tasks.Task<Microsoft.OData.Mcp.Core.Legacy.McpTool> A navigation MCP tool for getting related entities.

GenerateRemoveRelationshipToolAsync

Generates a tool for removing relationships between entities.

Syntax

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

Parameters

NameTypeDescription
entitySetMicrosoft.OData.Mcp.Core.Models.EdmEntitySetThe source entity set.
entityTypeMicrosoft.OData.Mcp.Core.Models.EdmEntityTypeThe source entity type.
navigationPropertyMicrosoft.OData.Mcp.Core.Models.EdmNavigationPropertyThe navigation property for the relationship.
optionsMicrosoft.OData.Mcp.Core.Legacy.Generators.NavigationToolGenerationOptionsOptions controlling tool generation behavior.
cancellationTokenSystem.Threading.CancellationTokenCancellation token for the operation.

Returns

Type: System.Threading.Tasks.Task<Microsoft.OData.Mcp.Core.Legacy.McpTool> A navigation MCP tool for removing relationships.

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?