Table of Contents

Class MongoDbToolProvider

Namespace
Tharga.MongoDB.Mcp
Assembly
Tharga.MongoDB.Mcp.dll

Exposes Tharga.MongoDB actions as MCP tools on the System scope.

public sealed class MongoDbToolProvider : IMcpToolProvider, IMcpProvider
Inheritance
MongoDbToolProvider
Implements
IMcpToolProvider
IMcpProvider
Inherited Members

Constructors

MongoDbToolProvider(IDatabaseMonitor, MongoDbMcpOptions)

public MongoDbToolProvider(IDatabaseMonitor monitor, MongoDbMcpOptions options)

Parameters

monitor IDatabaseMonitor
options MongoDbMcpOptions

Properties

Scope

The scope this provider belongs to. Only the matching endpoint will see its contents.

public McpScope Scope { get; }

Property Value

McpScope

Methods

CallToolAsync(string, JsonElement, IMcpContext, CancellationToken)

Invokes a tool by name with the supplied arguments.

public Task<McpToolResult> CallToolAsync(string toolName, JsonElement arguments, IMcpContext context, CancellationToken cancellationToken)

Parameters

toolName string

Name of the tool as advertised by ListToolsAsync(IMcpContext, CancellationToken).

arguments JsonElement

Raw JSON arguments from the client, already validated against Tharga.Mcp.McpToolDescriptor.InputSchema.

context IMcpContext

The per-call context.

cancellationToken CancellationToken

Cancellation signal from the transport.

Returns

Task<McpToolResult>

ListToolsAsync(IMcpContext, CancellationToken)

Lists tools visible to the caller.

public Task<IReadOnlyList<McpToolDescriptor>> ListToolsAsync(IMcpContext context, CancellationToken cancellationToken)

Parameters

context IMcpContext
cancellationToken CancellationToken

Returns

Task<IReadOnlyList<McpToolDescriptor>>