Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ private static JsonSerializerOptions CreateDefaultOptions()
[JsonSerializable(typeof(MCPListToolsItemParam))]
[JsonSerializable(typeof(MCPApprovalRequestItemParam))]
[JsonSerializable(typeof(MCPApprovalResponseItemParam))]
[JsonSerializable(typeof(FunctionApprovalResponseItemParam))]
[JsonSerializable(typeof(MCPCallItemParam))]
[JsonSerializable(typeof(List<ItemParam>))]
// ItemContent types
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ internal sealed class ItemParamConverter : JsonConverter<ItemParam>
"mcp_list_tools" => doc.Deserialize(OpenAIHostingJsonContext.Default.MCPListToolsItemParam),
"mcp_approval_request" => doc.Deserialize(OpenAIHostingJsonContext.Default.MCPApprovalRequestItemParam),
"mcp_approval_response" => doc.Deserialize(OpenAIHostingJsonContext.Default.MCPApprovalResponseItemParam),
"function_approval_response" => doc.Deserialize(OpenAIHostingJsonContext.Default.FunctionApprovalResponseItemParam),
"mcp_call" => doc.Deserialize(OpenAIHostingJsonContext.Default.MCPCallItemParam),
_ => null // Ignore unknown types.
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,33 @@ internal sealed class MCPApprovalResponseItemParam : ItemParam
public string? Reason { get; init; }
}

/// <summary>
/// A function approval response item parameter.
/// This is a non-standard DevUI extension for human-in-the-loop scenarios.
/// </summary>
internal sealed class FunctionApprovalResponseItemParam : ItemParam
{
/// <summary>
/// The constant item type identifier for function approval response items.
/// </summary>
public const string ItemType = "function_approval_response";

/// <inheritdoc/>
public override string Type => ItemType;

/// <summary>
/// The unique identifier of the approval request being responded to.
/// </summary>
[JsonPropertyName("request_id")]
public required string RequestId { get; init; }

/// <summary>
/// Gets or sets a value indicating whether the function call was approved.
/// </summary>
[JsonPropertyName("approved")]
public bool Approved { get; init; }
}

/// <summary>
/// An MCP call item parameter.
/// </summary>
Expand Down