Fix #5300: Implement auto-approval for access_mcp_resource tool #5302
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #5300 by implementing missing auto-approval logic for the
access_mcp_resourcetool.Problem
The
access_mcp_resourcetool was not respecting auto-approval settings, always prompting users for approval even whenalwaysAllowMcpwas enabled. This was because theTask.ask()method had no auto-approval logic implemented.Solution
Task.ask()method: CheckautoApprovalEnabledsetting and specific tool permissions before prompting usershouldAutoApprove()method: Maps different ask types to their corresponding auto-approval settingsuse_mcp_serverask type: Now properly respects thealwaysAllowMcpsetting likeuse_mcp_tooldoesChanges
src/core/task/Task.tsask()method (lines 415-440) to check for auto-approval before user interactionshouldAutoApprove()private method (lines 533-547) that handles different ask types:use_mcp_server→alwaysAllowMcpcommand→alwaysAllowExecutebrowser_action_launch→alwaysAllowBrowsertool→alwaysAllowReadOnlyTesting
access_mcp_resourcetool callsaskApproval("use_mcp_server", ...)use_mcp_servertoalwaysAllowMcpsettingImpact
access_mcp_resourcetool now respects auto-approval settingsuse_mcp_toolandaccess_mcp_resourceImportant
Implements auto-approval logic for
access_mcp_resourcetool inTask.ts, ensuring it respectsalwaysAllowMcpsetting.Task.ask()inTask.tsto checkautoApprovalEnabledand tool permissions before user prompts.shouldAutoApprove()method to map ask types to auto-approval settings.use_mcp_serverrespectsalwaysAllowMcpsetting.access_mcp_resourcetool callsaskApproval("use_mcp_server", ...).use_mcp_servertoalwaysAllowMcp.This description was created by
for 3e478df. You can customize this summary. It will automatically update as commits are pushed.