Skip to content

Conversation

@ThanabordeeN
Copy link
Contributor

@ThanabordeeN ThanabordeeN commented Apr 27, 2025

tldr : This pull request introduces a significant enhancement to the forward method, providing robust support for both asynchronous and synchronous tools, including those from the MCP

Key Feature :

  • MCPTools : Introduce dependence utils to transform MCP Tools list into compatible dspy.Tools
  • Unified Async/Sync Forwarding: The forward method now seamlessly handles both asynchronous and synchronous operations. This ensures compatibility with a wider range of tools, including those utilizing async and await as well as traditional synchronous functions and MCP tools.
  • Flexible Tool Combination: This update enables the powerful combination of MCP tools and standard function tools within a single forward call. This opens up new possibilities for creating complex and versatile workflows.
  • Optimized Execution with aexecute: A new aexecute method has been introduced. This method optimizes the execution of both asynchronous and synchronous functions by ensuring each is called only once, leading to more efficient resource utilization and potentially improved performance.
  • Comprehensive examples and documentation

Potential development :

  • Add other function from mcp like meta data , prompt , docs

ThanabordeeN and others added 12 commits April 26, 2025 16:54
- Introduced basic MCP integration example in `basic_mcp_integration.py` demonstrating the use of DSPy with MCP tools.
- Developed a combined tools agent in `combined_tools_agent.py` that integrates MCP tools with standard Python functions.
- Created a direct tool call example in `direct_tool_call.py` for executing MCP tools without an agent.
- Expanded documentation in `mcp_docs.md` to cover MCP integration, usage patterns, best practices, and troubleshooting.
- Implemented a FastAPI server integration in `mcp_fastapi_server.py` for handling queries with MCP tools.
- Added robust MCP agent example in `robust_mcp_agent.py` with improved error handling and resource management.
- Included standard DSPy tools example in `standard_dspy_tools.py` showcasing the use of regular Python functions as tools.
Fix MCP integration and Forward Fix
@ThanabordeeN ThanabordeeN marked this pull request as ready for review April 27, 2025 10:46
@ThanabordeeN ThanabordeeN changed the title Intregrate MCP into ReAcT Module [WIP] Intregrate MCP into ReAcT Module Apr 27, 2025
@okhat
Copy link
Collaborator

okhat commented Apr 28, 2025

Thanks so much @ThanabordeeN ! We just merged #8130 with co-authorship by you!

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