Table of Contents

Method RegisterAsync

Namespace
LMKit.Agents.Tools
Assembly
LM-Kit.NET.dll

RegisterAsync(McpClient, bool, CancellationToken)

Asynchronously registers all tools from an MCP client.

public Task<int> RegisterAsync(McpClient mcpClient, bool overwrite = false, CancellationToken cancellationToken = default)

Parameters

mcpClient McpClient

An initialized MCP client.

overwrite bool

When true, replaces existing tools with the same name.

cancellationToken CancellationToken

A token to monitor for cancellation requests.

Returns

Task<int>

A task representing the operation. The result is the number of tools registered.

Exceptions

ArgumentNullException

Thrown when mcpClient is null.

RegisterAsync(McpClient, Func<McpTool, bool>, bool, CancellationToken)

Asynchronously registers filtered tools from an MCP client.

public Task<int> RegisterAsync(McpClient mcpClient, Func<McpTool, bool> filter = null, bool overwrite = false, CancellationToken cancellationToken = default)

Parameters

mcpClient McpClient

An initialized MCP client.

filter Func<McpTool, bool>

A predicate to filter tools. Return true to include, false to exclude. Pass null to include all tools.

overwrite bool

When true, replaces existing tools with the same name.

cancellationToken CancellationToken

A token to monitor for cancellation requests.

Returns

Task<int>

A task representing the operation. The result is the number of tools registered.