Skip to main content

Definition

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

Syntax

Summary

Factory for creating MCP tools dynamically from OData metadata.

Remarks

This factory generates MCP tools based on the parsed OData model, creating tools for CRUD operations, queries, and navigation between entities. The tools are generated dynamically to match the structure and capabilities of the OData service.

Constructors

.ctor

Initializes a new instance of the McpToolFactory class.

Syntax

Parameters

Exceptions

.ctor Inherited

Inherited from object

Syntax

Methods

BuildDefaultSelectForEntityType

Builds a default $select statement for an entity type, excluding binary and stream fields.

Syntax

Parameters

Returns

Type: string? A comma-separated list of property names to select, or null if all properties should be included.

Equals Inherited Virtual

Inherited from object

Syntax

Parameters

Returns

Type: bool

Equals Inherited

Inherited from object

Syntax

Parameters

Returns

Type: bool

FilterToolsForUser

Filters tools based on user authorization context.

Syntax

Parameters

Returns

Type: System.Collections.Generic.IEnumerable<Microsoft.OData.Mcp.Core.Tools.McpToolDefinition> A collection of tools the user is authorized to access.

Exceptions

GenerateCrudToolsAsync

Generates CRUD operation tools for a specific entity type.

Syntax

Parameters

Returns

Type: System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.OData.Mcp.Core.Tools.McpToolDefinition>> A collection of CRUD tool definitions.

Exceptions

GenerateEntitySetToolsAsync

Generates tools for entity set operations (collection-level operations).

Syntax

Parameters

Returns

Type: System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.OData.Mcp.Core.Tools.McpToolDefinition>> A collection of entity set tool definitions.

Exceptions

GenerateEntityToolsAsync

Generates MCP tools for a specific entity type.

Syntax

Parameters

Returns

Type: System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.OData.Mcp.Core.Tools.McpToolDefinition>> A collection of generated MCP tool definitions for the entity type.

Exceptions

GenerateNavigationToolsAsync

Generates navigation tools for entity relationships.

Syntax

Parameters

Returns

Type: System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.OData.Mcp.Core.Tools.McpToolDefinition>> A collection of navigation tool definitions.

Exceptions

GenerateQueryToolsAsync

Generates query tools for the OData model.

Syntax

Parameters

Returns

Type: System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.OData.Mcp.Core.Tools.McpToolDefinition>> A collection of query tool definitions.

Exceptions

GenerateToolsAsync

Generates all MCP tools for the specified OData model.

Syntax

Parameters

Returns

Type: System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.OData.Mcp.Core.Tools.McpToolDefinition>> A collection of generated MCP tool definitions.

Exceptions

GetAvailableToolNames

Gets all available tool names.

Syntax

Returns

Type: System.Collections.Generic.IEnumerable<string> A collection of all tool names that have been generated.

GetHashCode Inherited Virtual

Inherited from object

Syntax

Returns

Type: int

GetTool

Gets the tool definition by name.

Syntax

Parameters

Returns

Type: Microsoft.OData.Mcp.Core.Tools.McpToolDefinition? The tool definition if found; otherwise, null.

GetType Inherited

Inherited from object

Syntax

Returns

Type: System.Type

IsBinaryOrStreamField

Determines if a property is a binary or stream field that should be excluded by default.

Syntax

Parameters

Returns

Type: bool True if the property is a binary or stream field; otherwise, false.

MemberwiseClone Inherited

Inherited from object

Syntax

Returns

Type: object

ReferenceEquals Inherited

Inherited from object

Syntax

Parameters

Returns

Type: bool

ToString Inherited Virtual

Inherited from object

Syntax

Returns

Type: string?

ValidateTools

Validates that the generated tools are compatible with the MCP specification.

Syntax

Parameters

Returns

Type: System.Collections.Generic.IEnumerable<string> A collection of validation errors, or empty if all tools are valid.

Exceptions

  • Microsoft.OData.Mcp.Core.Tools.IMcpToolFactory