refactor(module11): restructure MCP client implementation and migrate to chapter 11

This commit is contained in:
Annyfee
2025-12-10 15:38:56 +08:00
parent fd3774d849
commit bca3f7486f
13 changed files with 671 additions and 81 deletions
+20
View File
@@ -0,0 +1,20 @@
from typing import Protocol,List,Dict,Any
class MCPTransport(Protocol):
"""MCP 传输层协议 —— 所有 transport必须实现如下方法"""
async def connect(self):
"""建立连接"""
...
async def list_tools(self):
"""获取工具列表"""
...
async def call_tool(self,name:str,args:dict):
"""调用工具并返回文本结果"""
...
async def cleanup(self):
"""清理资源"""
...