19 lines
496 B
Python
19 lines
496 B
Python
# test_tools.py
|
|
from mcp.server.fastmcp import FastMCP
|
|
|
|
|
|
def create_test_mcp() -> FastMCP:
|
|
"""创建一个只包含最简单工具的 MCP 实例,用于测试连接。"""
|
|
|
|
test_mcp = FastMCP(
|
|
name="Test Tools",
|
|
instructions="用于测试服务器连接是否通畅。",
|
|
streamable_http_path="/"
|
|
)
|
|
|
|
@test_mcp.tool()
|
|
def ping() -> str:
|
|
"""一个简单的工具,用于确认服务器是否响应。"""
|
|
return "pong"
|
|
|
|
return test_mcp |