Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

McpServerToolCreateOptions miss MarshalResult option.

Đang mở
#1,602 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@jstar0 đang làm issue này rồi.

Từ ngày 13/9/2026.

  • #1761 của @andyst-dev — đã đóng, không merge
  • #1874 của @jstar0 — đang mở

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
68/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
csharp
Lĩnh vực
backend-api-design

Hướng nghiên cứu

Bắt đầu với McpServerToolCreateOptions, AIFunctionFactoryOptions, McpServerTool.Create, DeriveOptions và CreateAIFunctionFactoryOptions để theo dõi cách các thiết đặt tạo được truyền đi. Thêm một cách được hỗ trợ để cấu hình MarshalResult thông qua các tùy chọn tạo tool, sau đó xác minh rằng callback đã cấu hình đến được AIFunctionFactoryOptions mà không dùng reflection.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement P2 ready for work

Is your feature request related to a problem? Please describe.
i need MarshalResult for AIFunctionFactoryOptions, but the CreateAIFunctionFactoryOptions assign the MarshalResult=new ValueTask(result).
i without any solution to reset it, i just can to create a AIFunction,then use the AIFunction to create McpServerTool.

but i will loss many settings from DeriveOptions and CreateAIFunctionFactoryOptions(private methods).

Describe the solution you'd like
please add a MarhsalResult option in McpServerToolCreateOptions, then i can initialize the AIFunctionFactoryOptions.MarshalResult.

or add a Action< AIFunctionFactoryOptions > initailizeAIFunctionOptions, then call after CreateAIFunctionFactoryOptions, give me a chance to update the aifunction options.

        public new static AIFunctionMcpServerResource Create(MethodInfo method, object? target, McpServerResourceCreateOptions? options
            , Action<AIFunctionFactoryOptions> initializeAIFunctionFactoryOptions = null)
        {
            Throw.IfNull(method, "method");
            options = DeriveOptions(method, options);

            var aioptions = CreateAIFunctionFactoryOptions(method, options);
            initializeAIFunctionFactoryOptions?.Invoke(aioptions);

            return Create(AIFunctionFactory.Create(method, target, aioptions), options);
        }
        public new static AIFunctionMcpServerTool Create(MethodInfo method, object? target, McpServerToolCreateOptions? options
            , Action<AIFunctionFactoryOptions> initializeAIFunctionFactoryOptions = null)
        {
            Throw.IfNull(method, "method");
            options = DeriveOptions(method, options);

            var aioptions = CreateAIFunctionFactoryOptions(method, options);
            initializeAIFunctionFactoryOptions?.Invoke(aioptions);

            return Create(AIFunctionFactory.Create(method, target, aioptions), options);
        }`
        public new static AIFunctionMcpServerPrompt Create(MethodInfo method, object? target, McpServerPromptCreateOptions? options
            , Action<AIFunctionFactoryOptions> initializeAIFunctionFactoryOptions = null)
        {
            Throw.IfNull(method, "method");
            options = DeriveOptions(method, options);

            var aioptions = CreateAIFunctionFactoryOptions(method, options);
            initializeAIFunctionFactoryOptions?.Invoke(aioptions);

            return Create(AIFunctionFactory.Create(method, target, aioptions), options);
        }

Describe alternatives you've considered
currently , i just can use reflection to invoke DeriveOptions and CreateAIFunctionFactoryOptions,
but this was not stable in the future version. please add a standard MarshalResult options for my feature.

                    var createoptions = new McpServerToolCreateOptions()
                    {
                        Name = mcpname,
                        SerializerOptions = serializeroptions,
                    };
                    createoptions = (McpServerToolCreateOptions)DummyInstance.Value.Tool_DeriveOptions.Invoke(null, [mcpmethod, createoptions]);

                    var aifuncoptions = (AIFunctionFactoryOptions)DummyInstance.Value.Tool_CreateAIFunctionFactoryOptions.Invoke(null, [mcpmethod, createoptions]);
                    aifuncoptions.MarshalResult = OnToolMarshalResult;

                    var aifunc = AIFunctionFactory.Create(mcpmethod, instance, aifuncoptions);
                    var tool = McpServerTool.Create(aifunc, createoptions);
                    log.Info($"McpTool 已建立 - tool:{tool}。\r\n{mcpmethod}");

                    tools.Add(tool);

Ngôn ngữ chính
C#
Star
4.6k
Fork
819
Merge trung bình
8 ngày 7 giờ
Pull request đã merge (30 ngày)
3

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của modelcontextprotocol/csharp-sdk

Tất cả issue của modelcontextprotocol/csharp-sdk

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.