Skip to content
Discussion options

You must be logged in to vote

For anybody wondering, I have found a solution by writing an McpClientTool wrapper that implements the AIFunction class and setting the values I want to send to ModelContextProtocol.RequestOptions' Meta object. During agent initialization wrap your existing MCP tools with this class.

class CustomTool(McpClientTool tool) : AIFunction
{
    private readonly McpClientTool _internalTool = internalTool;

    protected override async ValueTask<object?> InvokeCoreAsync(AIFunctionArguments arguments, CancellationToken cancellationToken)
    {
        var meta = new JsonObject();
        meta.Add("key1", JsonValue.Create("value1"));
        var requestOptions = new ModelContextProtocol.RequestOptions

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
7 replies
@stephentoub
Comment options

@fthbrmnby
Comment options

@stephentoub
Comment options

@fthbrmnby
Comment options

@stephentoub
Comment options

Answer selected by fthbrmnby
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants