Skip to content

Conversation

@crickman
Copy link
Contributor

@crickman crickman commented Oct 24, 2025

Motivation and Context

Support tool approval for function and mcp tools.

Description

  • Introduce UserInputRequest and UserInputResponse to handle approval requests
  • Rename existing request-port objects for clarity
  • Verify serialization
  • Update sample

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

@crickman crickman self-assigned this Oct 24, 2025
@crickman crickman added enhancement New feature or request .NET workflows Related to Workflows in agent-framework model context protocol Issue related to Model Context Protocol mcp labels Oct 24, 2025
@crickman crickman requested a review from stephentoub October 24, 2025 17:23
@crickman crickman marked this pull request as ready for review October 24, 2025 22:19
Copilot AI review requested due to automatic review settings October 24, 2025 22:19
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for tool approval in .NET workflows by introducing new event types that distinguish between different kinds of user input requests (messages vs. tool approvals) and separates function tool calls from general user input handling.

Key changes:

  • Renamed and refactored event classes to better distinguish between user messages (UserMessageRequest/UserMessageResponse) and tool-related events (AgentFunctionToolRequest/AgentFunctionToolResponse)
  • Added new UserInputRequest/UserInputResponse classes to handle tool approval scenarios for both function and MCP tools
  • Updated workflow execution logic to handle separate request ports for function calling and user input approval

Reviewed Changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
Events/UserMessageRequest.cs Replaces InputRequest with simplified user message request
Events/UserMessageResponse.cs Renames InputResponse to UserMessageResponse
Events/UserInputRequest.cs New class for tool approval requests
Events/UserInputResponse.cs New class for tool approval responses
Events/AgentFunctionToolRequest.cs Renames AgentToolRequest to clarify function-specific nature
Events/AgentFunctionToolResponse.cs Renames AgentToolResponse to match request naming
Events/InputRequest.cs Removed (replaced by UserMessageRequest)
Events/AgentToolRequest.cs Removed (replaced by AgentFunctionToolRequest)
Events/AgentToolResponse.cs Removed (replaced by AgentFunctionToolResponse)
ObjectModel/QuestionExecutor.cs Updated to use UserMessageRequest/UserMessageResponse
ObjectModel/InvokeAzureAgentExecutor.cs Added user input handling logic and separated function call handling
Interpreter/WorkflowActionVisitor.cs Added separate request ports for function calling and user input
WorkflowAgentProvider.cs Updated documentation to reference renamed classes
Microsoft.Agents.AI.Workflows.Declarative.csproj Suppressed MEAI001 warning
Test files Updated tests to use renamed classes and added new tests for UserInputRequest/UserInputResponse
samples/.../ExecuteWorkflow/Program.cs Updated sample to handle new event types including tool approval

@crickman crickman added this pull request to the merge queue Oct 27, 2025
Merged via the queue into main with commit 92925a8 Oct 27, 2025
14 checks passed
@crickman crickman deleted the crickman/workflows-declarative-tool-approval branch October 27, 2025 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request mcp model context protocol Issue related to Model Context Protocol .NET workflows Related to Workflows in agent-framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants