Files
OpenWebUI-Discordbot/scripts
Josh Knapp 94651b6ec1
All checks were successful
OpenWebUI Discord Bot / Build-and-Push (push) Successful in 55s
Rewrite to use chat.completions with manual MCP tool execution
Major refactor to fix Bedrock + MCP compatibility issues:

- Removed Responses API approach (doesn't work with Bedrock)
- Added execute_mcp_tool() to manually call tools via /mcp/call_tool
- Rewrote get_available_mcp_tools() to return OpenAI function format
- Implemented manual tool execution loop with max 5 iterations
- Tool results are sent back to model in standard tool response format
- Removed query_needs_tools() function (no longer needed)

How it works:
1. Fetch MCP tools from /v1/mcp/tools and convert to OpenAI format
2. Call chat.completions.create() with tools array
3. When model requests tool calls, execute via POST /mcp/call_tool
4. Send results back to model with role="tool"
5. Loop until model provides final response

This bypasses the broken Responses API and uses working endpoints
that are compatible with AWS Bedrock + LiteLLM MCP integration.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-12 11:34:24 -08:00
..