mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 07:26:55 +08:00
feat: 重构 MCP 工具导出逻辑并完善返回值类型系统
This commit is contained in:
@@ -558,3 +558,18 @@ func (h *MCPHost) forceCloseAll() {
|
||||
delete(h.connections, name)
|
||||
}
|
||||
}
|
||||
|
||||
// getActionToolProvider returns an ActionToolProvider for the given server name if available
|
||||
// This method checks if the MCP server implements the ActionToolProvider interface
|
||||
func (h *MCPHost) getActionToolProvider(serverName string) ActionToolProvider {
|
||||
h.mu.RLock()
|
||||
defer h.mu.RUnlock()
|
||||
|
||||
if conn, exists := h.connections[serverName]; exists {
|
||||
// Check if the client directly implements ActionToolProvider interface
|
||||
if actionToolProvider, ok := conn.Client.(ActionToolProvider); ok {
|
||||
return actionToolProvider
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user