using ModelContextProtocol.Protocol.Types;
using ModelContextProtocol.Utils;
namespace ModelContextProtocol.Server;
/// Provides an that delegates all operations to an inner .
///
/// This is recommended as a base type when building tools that can be chained around an underlying .
/// The default implementation simply passes each call to the inner tool instance.
///
public abstract class DelegatingMcpServerTool : McpServerTool
{
private readonly McpServerTool _innerTool;
/// Initializes a new instance of the class around the specified .
/// The inner tool wrapped by this delegating tool.
protected DelegatingMcpServerTool(McpServerTool innerTool)
{
Throw.IfNull(innerTool);
_innerTool = innerTool;
}
///
public override Tool ProtocolTool => _innerTool.ProtocolTool;
///
public override Task InvokeAsync(
RequestContext request,
CancellationToken cancellationToken = default) =>
_innerTool.InvokeAsync(request, cancellationToken);
///
public override string ToString() => _innerTool.ToString();
}