Class MongoDbToolProvider
Exposes Tharga.MongoDB actions as MCP tools on the System scope.
public sealed class MongoDbToolProvider : IMcpToolProvider, IMcpProvider
- Inheritance
-
MongoDbToolProvider
- Implements
-
IMcpToolProviderIMcpProvider
- Inherited Members
Constructors
MongoDbToolProvider(IDatabaseMonitor, MongoDbMcpOptions)
public MongoDbToolProvider(IDatabaseMonitor monitor, MongoDbMcpOptions options)
Parameters
monitorIDatabaseMonitoroptionsMongoDbMcpOptions
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
toolNamestringName of the tool as advertised by ListToolsAsync(IMcpContext, CancellationToken).
argumentsJsonElementRaw JSON arguments from the client, already validated against Tharga.Mcp.McpToolDescriptor.InputSchema.
contextIMcpContextThe per-call context.
cancellationTokenCancellationTokenCancellation 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
contextIMcpContextcancellationTokenCancellationToken
Returns
- Task<IReadOnlyList<McpToolDescriptor>>