Skip to content

Conversation

@GuanyiLi-Craig
Copy link
Contributor

mplement an MCP-based function tool.
MCP must be invoked as a standalone function, with inputs obtained by deserializing the incoming message content.

Copilot AI review requested due to automatic review settings December 28, 2025 17:35
Copy link
Contributor

Copilot AI left a 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.

GuanyiLi-Craig and others added 8 commits December 28, 2025 17:39
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>
@GuanyiLi-Craig GuanyiLi-Craig merged commit e6e729b into main Dec 29, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants