Table of Contents

Class Tools

Namespace
OllamaSharp.ModelContextProtocol
Assembly
OllamaSharp.ModelContextProtocol.dll

Contains entry point extensions for the Model Context Protocol (MCP) support.

public static class Tools
Inheritance
Tools
Inherited Members

Methods

GetFromMcpServers(McpClientOptions?, params McpServerConfiguration[])

Gets the tools from the specified MCP server configurations.

public static Task<McpClientTool[]> GetFromMcpServers(McpClientOptions? clientOptions, params McpServerConfiguration[] mcpServers)

Parameters

clientOptions McpClientOptions

Optional client options to use when connecting to the MCP servers.

mcpServers McpServerConfiguration[]

An array of MCP server configurations.

Returns

Task<McpClientTool[]>

An array of McpClientTool objects representing the tools discovered on the provided servers.

Exceptions

ArgumentNullException

Thrown when mcpServers is null or empty.

GetFromMcpServers(params McpServerConfiguration[])

Gets the tools from the specified MCP server configurations.

public static Task<McpClientTool[]> GetFromMcpServers(params McpServerConfiguration[] mcpServers)

Parameters

mcpServers McpServerConfiguration[]

An array of MCP server configurations.

Returns

Task<McpClientTool[]>

An array of McpClientTool objects representing the tools discovered on the provided servers.

Exceptions

ArgumentNullException

Thrown when mcpServers is null or empty.

GetFromMcpServers(string, McpClientOptions?)

Gets the tools from the specified MCP server configuration file.

public static Task<McpClientTool[]> GetFromMcpServers(string configurationFilePath, McpClientOptions? clientOptions = null)

Parameters

configurationFilePath string

The path to the JSON configuration file.

clientOptions McpClientOptions

Optional client options to use when connecting to the MCP servers.

Returns

Task<McpClientTool[]>

An array of McpClientTool objects representing the tools discovered on the configured servers.

Exceptions

ArgumentNullException

Thrown when configurationFilePath is null or empty.

FileNotFoundException

Thrown when the configuration file does not exist at the specified path.

InvalidOperationException

Thrown when the configuration file cannot be deserialized.