Fix 406 error in MCP tool execution - add Accept header
All checks were successful
OpenWebUI Discord Bot / Build-and-Push (push) Successful in 53s

The /mcp/call_tool endpoint was returning 406 "Not Acceptable" error
because the request didn't include an Accept header.

Fixed by adding "Accept": "application/json" to the request headers.

Error message was:
"Not Acceptable: Client must accept application/json"

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-12 11:41:07 -08:00
parent 94651b6ec1
commit 4f7b48c03b

View File

@@ -88,7 +88,8 @@ async def execute_mcp_tool(tool_name: str, arguments: dict) -> str:
base_url = LITELLM_API_BASE.rstrip('/') base_url = LITELLM_API_BASE.rstrip('/')
headers = { headers = {
"Authorization": f"Bearer {LITELLM_API_KEY}", "Authorization": f"Bearer {LITELLM_API_KEY}",
"Content-Type": "application/json" "Content-Type": "application/json",
"Accept": "application/json"
} }
debug_log(f"Executing MCP tool: {tool_name} with args: {arguments}") debug_log(f"Executing MCP tool: {tool_name} with args: {arguments}")