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
clientOptionsMcpClientOptionsOptional client options to use when connecting to the MCP servers.
mcpServersMcpServerConfiguration[]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
mcpServersis null or empty.
GetFromMcpServers(params McpServerConfiguration[])
Gets the tools from the specified MCP server configurations.
public static Task<McpClientTool[]> GetFromMcpServers(params McpServerConfiguration[] mcpServers)
Parameters
mcpServersMcpServerConfiguration[]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
mcpServersis 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
configurationFilePathstringThe path to the JSON configuration file.
clientOptionsMcpClientOptionsOptional 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
configurationFilePathis 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.