Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Add client-side tool call interceptor (annotation-aware policy enforcement)

Open
#1,453 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
csharp
Domain
api, security

Research direction

Start by reading McpClientTool.ProtocolTool.Annotations and the McpClientOptions and McpClientHandlers APIs, then compare them with the server-side AddCallToolFilter pipeline. Define how the proposed ToolCallFilter can inspect annotations and enforce policy across client tool invocation paths, with tests showing blocked destructive calls and allowed calls proceeding through next.

Written by the indexing model from the issue text.

Description

enhancement P2 ready for work

The MCP C# SDK v1.1.0 exposes ToolAnnotations via McpClientTool.ProtocolTool.Annotations, but provides no built-in mechanism for a host to inspect those annotations and decide whether to allow invocation.

The server-side filter pipeline (WithRequestFilters(f => f.AddCallToolFilter(...))) has no client-side equivalent. McpClientOptions has no ToolCallPolicy or BeforeToolCall hook. McpClientHandlers only handles server→client requests (Sampling, Elicitation).

Proposed API

var client = await McpClient.CreateAsync(transport, new McpClientOptions
{
    ToolCallFilter = async (toolName, annotations, args, next, ct) =>
    {
        if (annotations?.DestructiveHint == true)
            throw new ToolBlockedException("Requires confirmation");
        return await next(toolName, args, ct);
    }
});

Without this, hosts must manually wrap every McpClientTool before passing to an IChatClient, and any unwrapped path bypasses policy entirely.

See also: https://modelcontextprotocol.io/blog/2026-03-16-tool-annotations (lethal trifecta attack pattern)

Dominant language
C#
Stars
4.5k
Forks
814
Avg merge
9d 19h
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from modelcontextprotocol/csharp-sdk

All issues in modelcontextprotocol/csharp-sdk

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.