Skip to main content

Definition

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

Syntax

Summary

Configuration options for MCP tool generation.

Remarks

These options control how tools are generated from OData metadata, including which operations to include, authorization requirements, and performance optimizations.

Constructors

.ctor

Initializes a new instance of the McpToolGenerationOptions class.

Syntax

.ctor Inherited

Inherited from object

Syntax

Properties

AlwaysExcludePropertyTypes

Gets or sets the list of property types that should always be excluded from default selections.

Syntax

Property Value

Type: System.Collections.Generic.List<string> A list of EDM type names to exclude.

Remarks

This list allows customization of which property types are automatically excluded from default $select statements. Common values include “Edm.Binary”, “Edm.Stream”, and potentially large geographic data types.

CustomMetadata

Gets or sets custom metadata to include in all generated tools.

Syntax

Property Value

Type: System.Collections.Generic.Dictionary<string, object> A dictionary of custom metadata key-value pairs.

Remarks

This metadata will be added to all generated tools and can be used for custom processing or filtering logic.

DefaultRequiredRoles

Gets or sets the default required roles for generated tools.

Syntax

Property Value

Type: System.Collections.Generic.List<string> A collection of roles required by default for all tools.

Remarks

These roles will be added to all generated tools unless overridden by entity-specific or operation-specific role configurations.

DefaultRequiredScopes

Gets or sets the default required scopes for generated tools.

Syntax

Property Value

Type: System.Collections.Generic.List<string> A collection of OAuth2 scopes required by default for all tools.

Remarks

These scopes will be added to all generated tools unless overridden by entity-specific or operation-specific scope configurations.

EntityScopes

Gets or sets entity-specific scope requirements.

Syntax

Property Value

Type: System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> A dictionary mapping entity type names to their required scopes.

Remarks

This allows configuring different authorization requirements for different entity types. Entity type names should be fully qualified.

ExcludeBinaryFieldsByDefault

Gets or sets a value indicating whether to exclude binary and stream fields from default $select statements.

Syntax

Property Value

Type: bool true to exclude binary fields by default; otherwise, false.

Remarks

When enabled, properties of type Edm.Binary and Edm.Stream will be automatically excluded from list operations unless explicitly included in the $select parameter. This helps prevent large binary data from overwhelming the response and improves performance.

ExcludeEntityTypes

Gets or sets the entity types to exclude from tool generation.

Syntax

Property Value

Type: System.Collections.Generic.HashSet<string> A collection of entity type names to exclude.

Remarks

Entity types listed here will be excluded from tool generation even if they would otherwise be included. This takes precedence over the IncludeEntityTypes setting.

ExcludeOperations

Gets or sets the operations to exclude for each entity type.

Syntax

Property Value

Type: System.Collections.Generic.HashSet<Microsoft.OData.Mcp.Core.Tools.McpToolOperationType> A collection of operation types to exclude.

Remarks

Operations listed here will be excluded from tool generation. This takes precedence over the IncludeOperations setting.

GenerateBatchTools

Gets or sets a value indicating whether to generate batch operation tools.

Syntax

Property Value

Type: bool true to generate batch tools; otherwise, false.

Remarks

Batch tools allow processing multiple operations in a single request, improving performance for bulk operations.

GenerateCrudTools

Gets or sets a value indicating whether to generate CRUD tools for entity types.

Syntax

Property Value

Type: bool true to generate CRUD tools; otherwise, false.

Remarks

CRUD tools provide basic Create, Read, Update, and Delete operations for each entity type in the OData model.

GenerateEntitySetTools

Gets or sets a value indicating whether to generate tools for entity sets.

Syntax

Property Value

Type: bool true to generate entity set tools; otherwise, false.

Remarks

Entity set tools operate on collections of entities and may have different permissions or behaviors than individual entity tools.

GenerateNavigationTools

Gets or sets a value indicating whether to generate navigation tools.

Syntax

Property Value

Type: bool true to generate navigation tools; otherwise, false.

Remarks

Navigation tools allow traversing relationships between entities, following navigation properties defined in the OData model.

GenerateQueryTools

Gets or sets a value indicating whether to generate query tools.

Syntax

Property Value

Type: bool true to generate query tools; otherwise, false.

Remarks

Query tools provide advanced search and filtering capabilities using OData query syntax like filter,filter, orderby, select,andselect, and expand.

IncludeDetailedSchemas

Gets or sets a value indicating whether to include detailed property schemas.

Syntax

Property Value

Type: bool true to include detailed schemas; otherwise, false.

Remarks

Detailed schemas provide full type information and validation rules but result in larger tool definitions and longer generation times.

IncludeEntityTypes

Gets or sets the entity types to include in tool generation.

Syntax

Property Value

Type: System.Collections.Generic.HashSet<string> A collection of entity type names to include, or empty to include all.

Remarks

When specified, only tools for the listed entity types will be generated. If empty, tools will be generated for all entity types in the model. Entity type names should be fully qualified (e.g., “MyNamespace.Customer”).

IncludeExamples

Gets or sets a value indicating whether to include examples in generated tools.

Syntax

Property Value

Type: bool true to include examples; otherwise, false.

Remarks

Examples help AI models understand how to use the tools effectively but increase the size of the tool definitions.

IncludeOperations

Gets or sets the operations to include for each entity type.

Syntax

Property Value

Type: System.Collections.Generic.HashSet<Microsoft.OData.Mcp.Core.Tools.McpToolOperationType> A collection of operation types to include.

Remarks

This allows fine-grained control over which operations are available for each entity type. If empty, all supported operations will be included.

MaxNavigationDepth

Gets or sets the maximum depth for navigation property traversal.

Syntax

Property Value

Type: int The maximum depth for following navigation properties.

Remarks

This prevents infinite recursion when generating navigation tools for models with circular references.

MaxToolCount

Gets or sets the maximum number of tools to generate.

Syntax

Property Value

Type: System.Nullable<int> The maximum number of tools to generate, or null for no limit.

Remarks

This setting can be used to prevent generation of too many tools from very large OData models, which could impact performance.

OperationScopes

Gets or sets operation-specific scope requirements.

Syntax

Property Value

Type: System.Collections.Generic.Dictionary<Microsoft.OData.Mcp.Core.Tools.McpToolOperationType, System.Collections.Generic.List<string>> A dictionary mapping operation types to their required scopes.

Remarks

This allows configuring different authorization requirements for different operation types (e.g., read vs. write operations).

OptimizeForPerformance

Gets or sets a value indicating whether to optimize for performance.

Syntax

Property Value

Type: bool true to optimize for performance; otherwise, false.

Remarks

Performance optimization may reduce the number of generated tools or simplify their schemas to improve runtime performance.

ToolNamePrefix

Gets or sets the tool name prefix.

Syntax

Property Value

Type: string A prefix to add to all generated tool names.

Remarks

The prefix helps avoid naming conflicts when multiple OData services are exposed through the same MCP server.

ToolNameSuffix

Gets or sets the tool name suffix.

Syntax

Property Value

Type: string A suffix to add to all generated tool names.

Remarks

The suffix can be used for versioning or other organizational purposes.

ToolVersion

Gets or sets the tool version for generated tools.

Syntax

Property Value

Type: string The version string to assign to generated tools.

Remarks

This version is used for tool identification and compatibility checking. It should follow semantic versioning principles.

Methods

Clone

Creates a copy of these options.

Syntax

Returns

Type: Microsoft.OData.Mcp.Core.Tools.McpToolGenerationOptions A new instance with the same settings as this instance.

Default

Creates default options for tool generation.

Syntax

Returns

Type: Microsoft.OData.Mcp.Core.Tools.McpToolGenerationOptions A new instance with default settings.

Equals Inherited Virtual

Inherited from object

Syntax

Parameters

Returns

Type: bool

Equals Inherited

Inherited from object

Syntax

Parameters

Returns

Type: bool

FormatToolName

Formats a tool name with the configured prefix and suffix.

Syntax

Parameters

Returns

Type: string The formatted tool name.

GetCombinedScopes

Gets the required scopes for a specific entity type and operation combination.

Syntax

Parameters

Returns

Type: System.Collections.Generic.IEnumerable<string> The combined required scopes.

GetEntityScopes

Gets the required scopes for the specified entity type.

Syntax

Parameters

Returns

Type: System.Collections.Generic.IEnumerable<string> The required scopes for the entity type.

GetHashCode Inherited Virtual

Inherited from object

Syntax

Returns

Type: int

GetOperationScopes

Gets the required scopes for the specified operation type.

Syntax

Parameters

Returns

Type: System.Collections.Generic.IEnumerable<string> The required scopes for the operation type.

GetType Inherited

Inherited from object

Syntax

Returns

Type: System.Type

MemberwiseClone Inherited

Inherited from object

Syntax

Returns

Type: object

Performance

Creates options optimized for performance.

Syntax

Returns

Type: Microsoft.OData.Mcp.Core.Tools.McpToolGenerationOptions A new instance with performance-optimized settings.

ReadOnly

Creates options for read-only access.

Syntax

Returns

Type: Microsoft.OData.Mcp.Core.Tools.McpToolGenerationOptions A new instance configured for read-only operations.

ReferenceEquals Inherited

Inherited from object

Syntax

Parameters

Returns

Type: bool

ShouldIncludeEntityType

Determines whether the specified entity type should be included.

Syntax

Parameters

Returns

Type: bool true if the entity type should be included; otherwise, false.

ShouldIncludeOperation

Determines whether the specified operation should be included.

Syntax

Parameters

Returns

Type: bool true if the operation should be included; otherwise, false.

ToString Inherited Virtual

Inherited from object

Syntax

Returns

Type: string?

Validate

Validates the options for consistency and completeness.

Syntax

Returns

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