feat: support ping method for MCP server (#22144)

pull/22149/head
非法操作 7 months ago committed by GitHub
parent c51b4290dc
commit 7b2cab5767
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -89,6 +89,7 @@ class MCPServerStreamableHTTPRequestHandler:
types.ListToolsRequest: self.list_tools,
types.CallToolRequest: self.invoke_tool,
types.InitializedNotification: self.handle_notification,
types.PingRequest: self.handle_ping,
}
try:
if self.request_type in handle_map:
@ -105,6 +106,9 @@ class MCPServerStreamableHTTPRequestHandler:
def handle_notification(self):
return "ping"
def handle_ping(self):
return types.EmptyResult()
def initialize(self):
request = cast(types.InitializeRequest, self.request.root)
client_info = request.params.clientInfo

Loading…
Cancel
Save