align tool naming and message action schema with openclaw compatibility

This commit is contained in:
DBT
2026-02-24 06:40:14 +00:00
parent 141b6a2ccb
commit 1e9b543f5e
3 changed files with 81 additions and 9 deletions

39
pkg/tools/compat_alias.go Normal file
View File

@@ -0,0 +1,39 @@
package tools
import (
"context"
)
// AliasTool exposes OpenClaw-compatible tool names while forwarding to existing implementations.
type AliasTool struct {
name string
description string
base Tool
argMap map[string]string
}
func NewAliasTool(name, description string, base Tool, argMap map[string]string) *AliasTool {
return &AliasTool{name: name, description: description, base: base, argMap: argMap}
}
func (t *AliasTool) Name() string { return t.name }
func (t *AliasTool) Description() string {
if t.description != "" {
return t.description
}
return t.base.Description()
}
func (t *AliasTool) Parameters() map[string]interface{} { return t.base.Parameters() }
func (t *AliasTool) Execute(ctx context.Context, args map[string]interface{}) (string, error) {
if len(t.argMap) > 0 {
for from, to := range t.argMap {
if v, ok := args[from]; ok {
if _, exists := args[to]; !exists {
args[to] = v
}
}
}
}
return t.base.Execute(ctx, args)
}