Definition
Assembly: Microsoft.OData.Mcp.Core.dll Namespace: Microsoft.OData.Mcp.Core.Server Inheritance: System.ObjectSyntax
Summary
OData MCP tools using the official SDK attribute-based approach.Remarks
This class provides MCP tools for interacting with OData services using the official Model Context Protocol C# SDK patterns with attributes.Constructors
.ctor
Initializes a new instance of the ODataMcpTools class.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
httpClientFactory | System.Net.Http.IHttpClientFactory | The HTTP client factory. |
configuration | Microsoft.Extensions.Options.IOptions<Microsoft.OData.Mcp.Core.Configuration.McpServerConfiguration> | The server configuration. |
logger | Microsoft.Extensions.Logging.ILogger<Microsoft.OData.Mcp.Core.Server.ODataMcpTools> | The logger instance. |
.ctor Inherited
Inherited from
objectSyntax
Methods
CreateEntity
Creates a new entity in the specified OData entity set.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entitySet | string | The name of the entity set. |
entity | string | The entity data as JSON. |
Returns
Type:System.Threading.Tasks.Task<string>
The created entity as JSON.
DeleteEntity
Deletes an entity from the OData service.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entitySet | string | The entity set name. |
key | string | The entity key. |
Returns
Type:System.Threading.Tasks.Task<string>
Success message.
Equals Inherited Virtual
Inherited from
objectSyntax
Parameters
| Name | Type | Description |
|---|---|---|
obj | object? | - |
Returns
Type:bool
Equals Inherited
Inherited from
objectSyntax
Parameters
| Name | Type | Description |
|---|---|---|
objA | object? | - |
objB | object? | - |
Returns
Type:bool
GetEntity
Gets a single entity by its key from an OData service.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entitySet | string | The name of the entity set. |
key | string | The entity key value as a string or number. |
select | string? | Optional comma-separated list of properties to select. |
Returns
Type:System.Threading.Tasks.Task<string>
The entity data as JSON.
GetHashCode Inherited Virtual
Inherited from
objectSyntax
Returns
Type:int
GetMetadata
Gets the OData service metadata document.Syntax
Returns
Type:System.Threading.Tasks.Task<string>
The OData metadata as XML.
GetType Inherited
Inherited from
objectSyntax
Returns
Type:System.Type
MemberwiseClone Inherited
Inherited from
objectSyntax
Returns
Type:object
NavigateRelationship
Navigates from a source entity to related entities via a navigation property.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entitySet | string | The source entity set name. |
key | string | The source entity key. |
navigationProperty | string | The navigation property name. |
Returns
Type:System.Threading.Tasks.Task<string>
The related entities.
QueryEntitySet
Queries an OData entity set with optional filtering, sorting, and pagination.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entitySet | string | The name of the entity set to query. |
filter | string? | Optional OData filter expression. |
orderby | string? | Optional OData orderby expression. |
select | string? | Optional comma-separated list of properties to select. |
top | System.Nullable<int>? | Optional maximum number of results to return. |
skip | System.Nullable<int>? | Optional number of results to skip for pagination. |
count | bool | Optional flag to include the total count of matching entities. |
Returns
Type:System.Threading.Tasks.Task<string>
The query results as JSON.
ReferenceEquals Inherited
Inherited from
objectSyntax
Parameters
| Name | Type | Description |
|---|---|---|
objA | object? | - |
objB | object? | - |
Returns
Type:bool
ToString Inherited Virtual
Inherited from
objectSyntax
Returns
Type:string?
UpdateEntity
Updates an existing entity in the OData service.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entitySet | string | The entity set name. |
key | string | The entity key. |
entity | string | The updated entity data as JSON. |
Returns
Type:System.Threading.Tasks.Task<string>
The updated entity.