-
-
Notifications
You must be signed in to change notification settings - Fork 73
Universal Tools & MCP Support #278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
e880825 to
5defe6b
Compare
5defe6b to
205852a
Compare
205852a to
7255037
Compare
…usage when in json_object mode
There was a problem hiding this 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 introduces universal tool definitions and MCP (Model Context Protocol) support, enabling developers to write tool definitions once and use them across all providers. It adds automatic format conversion, standardizes tool choice logic, and implements MCP server connectivity for external services.
Key Changes:
- Universal tool format with automatic provider-specific conversion
- MCP server integration for Anthropic and OpenAI
- Refactored tool choice logic to prevent infinite loops
Reviewed changes
Copilot reviewed 73 out of 92 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/fixtures/vcr_cassettes/integration/open_router/common_format/tools_test/test_agent_common_format_input_schema.yml | VCR cassette for OpenRouter common format tool testing |
| test/fixtures/vcr_cassettes/integration/open_ai/responses/*.yml | VCR cassettes for OpenAI Responses API with tools and MCP |
| test/fixtures/vcr_cassettes/integration/open_ai/chat/common_format/tools_test/*.yml | VCR cassettes for OpenAI Chat API common format tool testing |
| test/fixtures/vcr_cassettes/integration/ollama/chat/common_format/tools_test/test_agent_common_format_tool_choice_specific.yml | VCR cassette for Ollama common format tool choice testing |
| test/docs/actions_examples_test.rb | Added MCP example and removed redundant type field from tool definition |
| lib/active_agent/providers/open_router_provider.rb | Added tool preparation and tool_choice_forces_required? method |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Write tool definitions once, use everywhere. Connect to external services via MCP.
Tools: One Format, All Providers
Before: 4 different formats across providers
After: Single format auto-converts to native formats
Backwards compatible: Old formats still work
Auto-Conversion
parameters→input_schema(gem models)"required"→"any"Refactoring
Unified tool choice logic prevents infinite loops:
Tests: 30 integration tests, 47 VCR cassettes, 0 failures
MCP: Connect External Services
Common format:
{name, url, authorization}→ auto-converts to:{type: "url", name, url, authorization_token}{type: "mcp", server_label, server_url, authorization}Features:
mcpsormcp_serversDocs:
/actions/mcpswith 8 tested examplesTests: 25 tests (14 unit + 11 integration), real MCP servers
Bug fix: Corrected Anthropic native format detection
Migration
No breaking changes: