-
Notifications
You must be signed in to change notification settings - Fork 25
Grafi 55/add mcp function tool #88
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
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 implements an MCP-based function tool (MCPFunctionTool) that invokes MCP (Model Context Protocol) as a standalone function with inputs obtained by deserializing message content. The implementation extends the existing FunctionTool base class and adds support for async generators.
Key Changes
- Added MCPFunctionTool class that wraps MCP client calls as function tools
- Enhanced FunctionTool base class to support async generator functions
- Added comprehensive unit and integration tests for the new functionality
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| grafi/tools/functions/impl/mcp_function_tool.py | New MCPFunctionTool implementation with MCP client integration, builder pattern, and serialization support |
| grafi/tools/functions/function_tool.py | Added async generator support and TypeVar for generic builder pattern |
| tests/tools/functions/test_mcp_function_tool.py | Comprehensive unit tests for MCPFunctionTool initialization, invocation, and serialization |
| tests/tools/functions/test_function_tool.py | Expanded FunctionTool tests to cover async functions, various output types, and error handling |
| tests_integration/mcp_assistant/mcp_function_tool_local.py | Integration tests demonstrating MCPFunctionTool usage with direct invocation, assistants, and serialization |
| tests_integration/mcp_assistant/mcp_deserialize_assistant_example_local.py | Integration test for deserializing and invoking assistants using MCP tools |
| grafi/tools/function_calls/impl/mcp_tool.py | Updated docstring to be more generic |
| CLAUDE.md | Restructured and streamlined documentation for better clarity |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
mplement an MCP-based function tool.
MCP must be invoked as a standalone function, with inputs obtained by deserializing the incoming message content.