Here’s a cleaned-up, clearer, and more structured version of your issue report:
Issue: require_approval filter behaves incorrectly when tool_names arrays are empty
I’m seeing unexpected behavior when configuring the require_approval filter for MCP tools.
Code Example
{
server_label: server.label,
server_url: server.url,
allowed_tools: allowedTools,
require_approval: {
never: {
tool_names: noApprovalNeeded,
},
},
server_description: server.description,
headers,
}
Problem 1: Empty never.tool_names disables all approval requests
When noApprovalNeeded is an empty array [], the API does not issue any approval requests.
My understanding is that an empty never list should mean that no tools are exempt, so every MCP tool call should require approval but that’s not what happens.
Problem 2: Using both never and always produces weird behavior as well
When using both filters the output is also not as expected. However I am to lazy to test any further.
Summary
The require_approval configuration appears to behave incorrectly when tool_names arrays are empty or when both never and always filters are used. Approval requests are triggered incorrectly.
##Temp Fix
require_approval:
noApprovalNeeded.length === 0
? "always"
: {
never: {
tool_names: noApprovalNeeded,
},
},