b8788c239e
MCP Docker / build-and-push (push) Has been cancelled
- Remove telemetry: disabled all phone-home (installation notify, false positives, behavior tracking, upgrade tips) - Version branding: removed 'ce-' prefix, product name changed to '长亭雷池 WAF' - Detection engine enhancement: strict preset enables all 17 modules with aggressive configs - Multi-user RBAC: admin/operator/viewer roles with password + TOTP 2FA - Rate limiting: nginx limit_req per website (RPS, burst, action) - JS Challenge: browser fingerprint verification page with cookie-based bypass - Security fixes: removed InsecureSkipVerify, hardcoded credentials, NO_AUTH backdoor
47 lines
923 B
Go
47 lines
923 B
Go
package tools
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/chaitin/SafeLine/mcp_server/pkg/errors"
|
|
"github.com/chaitin/SafeLine/mcp_server/pkg/logger"
|
|
)
|
|
|
|
type CalculateSum struct{}
|
|
|
|
func (t *CalculateSum) Name() string {
|
|
return "calculate_sum"
|
|
}
|
|
|
|
func (t *CalculateSum) Description() string {
|
|
return "Add two numbers together"
|
|
}
|
|
|
|
type MyToolInput struct {
|
|
A int `json:"a" desc:"number a" required:"true"`
|
|
B int `json:"b" desc:"number b" required:"true"`
|
|
}
|
|
|
|
type MyToolOutput struct {
|
|
C int `json:"c"`
|
|
}
|
|
|
|
func (t *CalculateSum) Validate(params MyToolInput) error {
|
|
return nil
|
|
}
|
|
|
|
func (t *CalculateSum) Execute(ctx context.Context, params MyToolInput) (MyToolOutput, error) {
|
|
logger.With("a", params.A).
|
|
With("b", params.B).
|
|
Debug("Executing calculation")
|
|
|
|
result := MyToolOutput{
|
|
C: params.A + params.B,
|
|
}
|
|
|
|
logger.With("result", result.C).
|
|
Debug("Calculation completed")
|
|
|
|
return result, errors.New("test error")
|
|
}
|