mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-06 07:57:27 +08:00
fix: avoid printing base64 data for screenshot tools
This commit is contained in:
+19
-10
@@ -156,9 +156,13 @@ func (dExt *XTDriver) ExecuteAction(ctx context.Context, action option.MobileAct
|
|||||||
// For regular actions, collect session data and return it directly
|
// For regular actions, collect session data and return it directly
|
||||||
sessionData := dExt.GetSession().GetData(true) // reset after getting data
|
sessionData := dExt.GetSession().GetData(true) // reset after getting data
|
||||||
|
|
||||||
log.Debug().Str("tool", string(tool.Name())).
|
// Log execution result, but avoid printing base64 data for screenshot tools
|
||||||
Interface("result", result.Content).
|
logger := log.Debug().Str("tool", string(tool.Name()))
|
||||||
Msg("executed action via MCP tool")
|
if tool.Name() != option.ACTION_ScreenShot {
|
||||||
|
logger.Interface("result", result.Content)
|
||||||
|
}
|
||||||
|
logger.Msg("executed action via MCP tool")
|
||||||
|
|
||||||
return sessionData, nil
|
return sessionData, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,22 +245,27 @@ func (dExt *XTDriver) CallMCPTool(ctx context.Context,
|
|||||||
log.Debug().Err(err).
|
log.Debug().Err(err).
|
||||||
Str("server", serverName).
|
Str("server", serverName).
|
||||||
Str("tool", toolName).
|
Str("tool", toolName).
|
||||||
Msg("MCP hook call failed")
|
Msg("call MCP tool failed")
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if result.IsError {
|
if result.IsError {
|
||||||
log.Debug().
|
logger := log.Debug().
|
||||||
Str("server", serverName).
|
Str("server", serverName).
|
||||||
Str("tool", toolName).
|
Str("tool", toolName)
|
||||||
Interface("content", result.Content).
|
|
||||||
Msg("MCP hook returned error")
|
// Avoid printing base64 data for screenshot tools
|
||||||
return nil, fmt.Errorf("MCP hook returned error")
|
if toolName != string(option.ACTION_ScreenShot) {
|
||||||
|
logger.Interface("content", result.Content)
|
||||||
|
}
|
||||||
|
logger.Msg("call MCP tool failed")
|
||||||
|
|
||||||
|
return nil, fmt.Errorf("call MCP tool %s failed", toolName)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debug().
|
log.Debug().
|
||||||
Str("server", serverName).
|
Str("server", serverName).
|
||||||
Str("tool", toolName).
|
Str("tool", toolName).
|
||||||
Msg("MCP hook called successfully")
|
Msg("call MCP tool successfully")
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user