工作GITHUB MCP代码
- > HTTP方式与代码
______________________________________________________________________
带MCP适配器-自动转换
tools=等待load_mcp_tools(会话)#✅ MCP → LangChain转换完成!
无适配器(手动方式):
手动转换-您编写包装器
for t in mcp_tools:
# Build Pydantic schema
# Create wrapper function
# Create StructuredTool
# Add to tools list______________________________________________________________________
load_mcp_tools在内部做什么:
Calls session.list_tools() to get MCP tool definitions
Converts JSON schemas → Pydantic models
Creates async wrapper functions that call session.call_tool()
Wraps in StructuredTool objects
Returns list of LangChain tools ready to use