DapperMaticMcpTools
Namespace: MJCZone.DapperMatic.AspNetCore.Mcp
Assembly: MJCZone.DapperMatic.AspNetCore
Summary
DapperMatic as tools for AI assistants, over the Model Context Protocol: each call runs as the request's signed-in caller, held to their tenant and to the policies, exactly as the web API's endpoints are.
sealed public
Contents
Constructors (1) | Methods (11)
Constructors
DapperMaticMcpTools
Initializes a new instance of the DapperMaticMcpTools class.
DapperMaticMcpTools(IHttpContextAccessor http)Parameters
- http (IHttpContextAccessor) - The current request, whose caller the tools run as.
Methods
| Method | Summary |
|---|---|
| ListDatasourcesAsync | Lists the datasources the caller may see. |
| DescribeDatasourceAsync | Describes what the caller may do in a datasource. |
| QueryRowsAsync | Reads rows of a table or view. |
| InsertRowsAsync | Inserts rows. |
| UpdateRowsAsync | Updates rows. |
| DeleteRowsAsync | Deletes rows. |
| RunFunctionAsync | Runs a declared function. |
| GetType | |
| ToString | |
| Equals | |
| GetHashCode |
ListDatasourcesAsync
Lists the datasources the caller may see.
Task<object> ListDatasourcesAsync(CancellationToken cancellationToken)Parameters
- cancellationToken (CancellationToken) - The cancellation token.
Returns
Type: Task<object>
Their ids and descriptions.
DescribeDatasourceAsync
Describes what the caller may do in a datasource.
Task<object> DescribeDatasourceAsync(
string datasourceId,
string schema,
CancellationToken cancellationToken)Parameters
- datasourceId (string) - The datasource.
- schema (string) - The schema, or null.
- cancellationToken (CancellationToken) - The cancellation token.
Returns
Type: Task<object>
The caller's OpenAPI document of the datasource.
QueryRowsAsync
Reads rows of a table or view.
Task<object> QueryRowsAsync(
string datasourceId,
string table,
string filter,
string orderby,
string select,
string expand,
Int32} top,
Int32} skip,
bool count,
string after,
string search,
string apply,
bool view,
string schema,
CancellationToken cancellationToken)Parameters
- datasourceId (string) - The datasource.
- table (string) - The table or view.
- filter (string) - An OData condition, or null.
- orderby (string) - An OData ordering, or null.
- select (string) - Columns, comma-separated, or null.
- expand (string) - Relations to read with each row, or null.
- top (Int32}) - The most rows.
- skip (Int32}) - The rows to skip.
- count (bool) - Whether to count every matching row.
- after (string) - A cursor of the page before, or null.
- search (string) - Words to search for, or null.
- apply (string) - An OData $apply grouping, or null.
- view (bool) - Whether it is a view.
- schema (string) - The schema, or null.
- cancellationToken (CancellationToken) - The cancellation token.
Returns
Type: Task<object>
The rows, and the page.
InsertRowsAsync
Inserts rows.
Task<object> InsertRowsAsync(
string datasourceId,
string table,
JsonElement rows,
string schema,
CancellationToken cancellationToken)Parameters
- datasourceId (string) - The datasource.
- table (string) - The table.
- rows (JsonElement) - The rows, an array of objects.
- schema (string) - The schema, or null.
- cancellationToken (CancellationToken) - The cancellation token.
Returns
Type: Task<object>
The rows written, with their keys.
UpdateRowsAsync
Updates rows.
Task<object> UpdateRowsAsync(
string datasourceId,
string table,
JsonElement set,
string filter,
string schema,
CancellationToken cancellationToken)Parameters
- datasourceId (string) - The datasource.
- table (string) - The table.
- set (JsonElement) - The columns to set.
- filter (string) - The rows to change.
- schema (string) - The schema, or null.
- cancellationToken (CancellationToken) - The cancellation token.
Returns
Type: Task<object>
How many rows changed.
DeleteRowsAsync
Deletes rows.
Task<object> DeleteRowsAsync(
string datasourceId,
string table,
string filter,
string schema,
CancellationToken cancellationToken)Parameters
- datasourceId (string) - The datasource.
- table (string) - The table.
- filter (string) - The rows to delete.
- schema (string) - The schema, or null.
- cancellationToken (CancellationToken) - The cancellation token.
Returns
Type: Task<object>
How many rows were deleted.
RunFunctionAsync
Runs a declared function.
Task<object> RunFunctionAsync(
string datasourceId,
string function,
JsonElement} arguments,
CancellationToken cancellationToken)Parameters
- datasourceId (string) - The datasource.
- function (string) - The function.
- arguments (JsonElement}) - Its arguments, an object.
- cancellationToken (CancellationToken) - The cancellation token.
Returns
Type: Task<object>
The rows it returned.
GetType
GetType()ToString
ToString()Equals
Equals()GetHashCode
GetHashCode()