Table of Contents

Class McpClientTool

Namespace
OllamaSharp.ModelContextProtocol.Server
Assembly
OllamaSharp.ModelContextProtocol.dll

Represents a tool to interact with an MCP server.

public class McpClientTool : Tool, IAsyncInvokableTool
Inheritance
McpClientTool
Implements
Inherited Members

Constructors

McpClientTool(McpClientTool, IMcpClient)

Initializes a new instance of McpClientTool using the specified MCP tool metadata and client.

public McpClientTool(McpClientTool mcpTool, IMcpClient client)

Parameters

mcpTool McpClientTool

The MCP tool definition containing name, description, and JSON schema.

client IMcpClient

The client used to invoke the underlying MCP calls.

Methods

InvokeMethodAsync(IDictionary<string, object?>?)

Invokes the method asynchronously with the specified arguments.

public Task<object?> InvokeMethodAsync(IDictionary<string, object?>? args)

Parameters

args IDictionary<string, object>

The arguments to pass to the method.

Returns

Task<object>

A task that represents the asynchronous operation. The task result contains the result of the method invocation.