mirror of
https://github.com/langgenius/dify.git
synced 2026-04-27 11:06:46 +08:00
feat: support ping method for MCP server (#22144)
This commit is contained in:
parent
c51b4290dc
commit
7b2cab5767
@ -89,6 +89,7 @@ class MCPServerStreamableHTTPRequestHandler:
|
|||||||
types.ListToolsRequest: self.list_tools,
|
types.ListToolsRequest: self.list_tools,
|
||||||
types.CallToolRequest: self.invoke_tool,
|
types.CallToolRequest: self.invoke_tool,
|
||||||
types.InitializedNotification: self.handle_notification,
|
types.InitializedNotification: self.handle_notification,
|
||||||
|
types.PingRequest: self.handle_ping,
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
if self.request_type in handle_map:
|
if self.request_type in handle_map:
|
||||||
@ -105,6 +106,9 @@ class MCPServerStreamableHTTPRequestHandler:
|
|||||||
def handle_notification(self):
|
def handle_notification(self):
|
||||||
return "ping"
|
return "ping"
|
||||||
|
|
||||||
|
def handle_ping(self):
|
||||||
|
return types.EmptyResult()
|
||||||
|
|
||||||
def initialize(self):
|
def initialize(self):
|
||||||
request = cast(types.InitializeRequest, self.request.root)
|
request = cast(types.InitializeRequest, self.request.root)
|
||||||
client_info = request.params.clientInfo
|
client_info = request.params.clientInfo
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user