mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-06 07:57:27 +08:00
change: mcp tool invoke url path
This commit is contained in:
@@ -5,6 +5,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MCPSettings represents the main configuration structure
|
// MCPSettings represents the main configuration structure
|
||||||
@@ -43,6 +45,7 @@ func (c *ServerConfig) GetTimeoutDuration() time.Duration {
|
|||||||
|
|
||||||
// LoadSettings loads MCP settings from the config file
|
// LoadSettings loads MCP settings from the config file
|
||||||
func LoadSettings(path string) (*MCPSettings, error) {
|
func LoadSettings(path string) (*MCPSettings, error) {
|
||||||
|
log.Info().Str("path", path).Msg("load MCP settings")
|
||||||
data, err := os.ReadFile(path)
|
data, err := os.ReadFile(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to read settings file: %w", err)
|
return nil, fmt.Errorf("failed to read settings file: %w", err)
|
||||||
|
|||||||
@@ -82,6 +82,8 @@ func (h *MCPHub) connectToServer(ctx context.Context, serverName string, config
|
|||||||
h.mu.Lock()
|
h.mu.Lock()
|
||||||
defer h.mu.Unlock()
|
defer h.mu.Unlock()
|
||||||
|
|
||||||
|
log.Debug().Str("server", serverName).Msg("connecting to MCP server")
|
||||||
|
|
||||||
// Close existing connection if any
|
// Close existing connection if any
|
||||||
if existing, exists := h.connections[serverName]; exists {
|
if existing, exists := h.connections[serverName]; exists {
|
||||||
if err := existing.Client.Close(); err != nil {
|
if err := existing.Client.Close(); err != nil {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
v5.0.0-beta-2504091352
|
v5.0.0-beta-2504101120
|
||||||
|
|||||||
+3
-3
@@ -50,11 +50,11 @@ func (r *Router) Init() {
|
|||||||
r.Engine.GET("/api/v1/devices", r.listDeviceHandler)
|
r.Engine.GET("/api/v1/devices", r.listDeviceHandler)
|
||||||
r.Engine.POST("/api/v1/browser/create_browser", createBrowserHandler)
|
r.Engine.POST("/api/v1/browser/create_browser", createBrowserHandler)
|
||||||
|
|
||||||
// tool operations
|
|
||||||
r.Engine.POST("/api/v1/tool/invoke", r.invokeToolHandler)
|
|
||||||
|
|
||||||
apiV1PlatformSerial := r.Group("/api/v1").Group("/:platform").Group("/:serial")
|
apiV1PlatformSerial := r.Group("/api/v1").Group("/:platform").Group("/:serial")
|
||||||
|
|
||||||
|
// tool operations
|
||||||
|
apiV1PlatformSerial.POST("/tool/invoke", r.invokeToolHandler)
|
||||||
|
|
||||||
// UI operations
|
// UI operations
|
||||||
apiV1PlatformSerial.POST("/ui/tap", r.tapHandler)
|
apiV1PlatformSerial.POST("/ui/tap", r.tapHandler)
|
||||||
apiV1PlatformSerial.POST("/ui/right_click", r.rightClickHandler)
|
apiV1PlatformSerial.POST("/ui/right_click", r.rightClickHandler)
|
||||||
|
|||||||
Reference in New Issue
Block a user