mirror of
https://github.com/httprunner/httprunner.git
synced 2026-08-08 07:03:40 +08:00
feat: implement MCP hooks integration with anti_risk option
This commit is contained in:
@@ -175,6 +175,9 @@ type ActionOptions struct {
|
||||
|
||||
ScreenOptions
|
||||
|
||||
// Anti-risk options
|
||||
AntiRisk bool `json:"anti_risk,omitempty" yaml:"anti_risk,omitempty" desc:"Enable anti-risk MCP tool calls"`
|
||||
|
||||
// Custom options
|
||||
Custom map[string]interface{} `json:"custom,omitempty" yaml:"custom,omitempty" desc:"Custom options"`
|
||||
}
|
||||
@@ -286,6 +289,10 @@ func (o *ActionOptions) Options() []ActionOption {
|
||||
options = append(options, WithMatchOne(true))
|
||||
}
|
||||
|
||||
if o.AntiRisk {
|
||||
options = append(options, WithAntiRisk(true))
|
||||
}
|
||||
|
||||
// custom options
|
||||
if o.Custom != nil {
|
||||
for k, v := range o.Custom {
|
||||
@@ -494,6 +501,12 @@ func WithIgnoreNotFoundError(ignoreError bool) ActionOption {
|
||||
}
|
||||
}
|
||||
|
||||
func WithAntiRisk(antiRisk bool) ActionOption {
|
||||
return func(o *ActionOptions) {
|
||||
o.AntiRisk = antiRisk
|
||||
}
|
||||
}
|
||||
|
||||
// HTTP API direct usage methods
|
||||
|
||||
// ValidateForHTTPAPI validates the request for HTTP API usage
|
||||
|
||||
Reference in New Issue
Block a user