Skip to content

Generated tool input schema for reflected C# parameter objects does not satisfy OpenAI strict function schema requirements in VS Copilot. #1447

@KKMicrosoft

Description

@KKMicrosoft

MCP .NET SDK version: 1.10 (Also on 0.40 version of SDK)

VS: 18.2.2

[McpServerTool] method with object-typed input
error first on additionalProperties, then on missing required entries.

I have a input model which has nested object properties

Ex ->

Class inputParameter
{
public INestedObject nestedProperty;
}

Only while using OpenAI models.
I see error stated below

Invalid schema for function 'functioname': In context=('properties', 'inputParameter'), 'additionalProperties' is required to be supplied and to be false. at OpenAI.ClientPipelineExtensions.ProcessMessageAsync(ClientPipeline pipeline, PipelineMessage message, RequestOptions options) at OpenAI.Responses.OpenAIResponseClient.CreateResponseAsync(BinaryContent content, RequestOptions options) at OpenAI.Responses.OpenAIResponseClient.<>c__DisplayClass13_0.<b__0>d.MoveNext() --- End of stack trace from previous location --- at OpenAI.AsyncSseUpdateCollection1.GetRawPagesAsync()+MoveNext() at OpenAI.AsyncSseUpdateCollection1.GetRawPagesAsync()+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult() at System.ClientModel.AsyncCollectionResult1.GetAsyncEnumerator(CancellationToken cancellationToken)+MoveNext() at System.ClientModel.AsyncCollectionResult1.GetAsyncEnumerator(CancellationToken cancellationToken)+MoveNext() at System.ClientModel.AsyncCollectionResult1.GetAsyncEnumerator(CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult() at Microsoft.VisualStudio.Conversations.CopilotClient.CopilotAPIClient.ChatCoreWithResponsesAPIAsync(HttpClient httpClient, ChatRequestOptions requestOptions, CancellationToken cancellationToken) at Microsoft.VisualStudio.Conversations.CopilotClient.CopilotAPIClient.ChatCoreWithResponsesAPIAsync(HttpClient httpClient, ChatRequestOptions requestOptions, CancellationToken cancellationToken) at Microsoft.VisualStudio.Conversations.CopilotClient.CopilotAPIClient.ChatCoreAsync(HttpClient httpClient, CopilotAPIRequest request, Action1 onToken, Action1 onUpdate, CopilotInteractionId interactionId, Boolean validateRootRequestId, String sessionToken, CancellationToken cancellationToken) at Conversations.Kernel.LLMClient.GetGitHubApiResponseAsync(CopilotAPIRequest request, CopilotInteractionId interactionId, Action1 onToken, Action1 onUpdate, String sessionToken, CancellationToken cancellationToken) at Conversations.Kernel.LLMClient.GetApiResponseAsync(CopilotAPIRequest request, CopilotInteractionId interactionId, Action1 onToken, Action1 onUpdate, String sessionToken, CancellationToken cancellationToken) at Conversations.Kernel.LLMClient.RequestAsync(CopilotAPIRequest request, CopilotInteractionId interactionId, ICopilotStreamingContentSink streamTarget, String sessionToken, CancellationToken cancellationToken); at StreamJsonRpc.JsonRpc.d__1711.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.VisualStudio.Copilot.ResponderBroker.d__9.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.VisualStudio.Copilot.ResponderBroker.d__9.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Copilot.ResponderBroker.d__3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore1.GetResult(Int16 token) at Microsoft.VisualStudio.Copilot.Core.Agents.CopilotAgentModeResponder.d__14.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore1.GetResult(Int16 token) at Microsoft.VisualStudio.Copilot.CopilotDefaultOrchestrator.d__24.MoveNext() RPC server exception: System.Exception: Error occurred while invoking intent 'Generic'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions