McpServerToolCreateOptions miss MarshalResult option.
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- csharp
- Domain
- backend-api-design
Research direction
Start with McpServerToolCreateOptions, AIFunctionFactoryOptions, McpServerTool.Create, DeriveOptions, and CreateAIFunctionFactoryOptions to trace how creation settings flow. Add a supported way to configure MarshalResult through the tool creation options, then verify that the configured callback reaches AIFunctionFactoryOptions without reflection.
Written by the indexing model from the issue text.
Description
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);
- Dominant language
- C#
- Stars
- 4.5k
- Forks
- 814
- Avg merge
- 9d 19h
- Merged PRs (30d)
- 4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from modelcontextprotocol/csharp-sdk
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
modelcontextprotocol/csharp-sdk#1867 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
modelcontextprotocol/csharp-sdk#1840 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
modelcontextprotocol/csharp-sdk#1836 ·
-
enhancement needs confirmation
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
modelcontextprotocol/csharp-sdk#678 · 1 comment ·
-
enhancement needs confirmation P3 ready for work
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
modelcontextprotocol/csharp-sdk#515 · 6 comments · 3 reactions ·
All issues in modelcontextprotocol/csharp-sdk
Similar issues
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
Type: enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
apache/arrow-adbc#4809 ·
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
microsoft/vscode-azurefunctions#5197 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
microsoft/microsoft-ui-reactor#1274 ·