Skip to content

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.

csharp
DapperMaticMcpTools(IHttpContextAccessor http)

Parameters ​

  • http (IHttpContextAccessor) - The current request, whose caller the tools run as.

Methods ​

MethodSummary
ListDatasourcesAsyncLists the datasources the caller may see.
DescribeDatasourceAsyncDescribes what the caller may do in a datasource.
QueryRowsAsyncReads rows of a table or view.
InsertRowsAsyncInserts rows.
UpdateRowsAsyncUpdates rows.
DeleteRowsAsyncDeletes rows.
RunFunctionAsyncRuns a declared function.
GetType
ToString
Equals
GetHashCode

ListDatasourcesAsync ​

Lists the datasources the caller may see.

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

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

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

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

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

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

csharp
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 ​

csharp
GetType()

ToString ​

csharp
ToString()

Equals ​

csharp
Equals()

GetHashCode ​

csharp
GetHashCode()