refactor: mover tools a subpackages individuales

Cada tool ahora vive en su propio subpackage dentro de tools/ (clock, file,
http, knowledgetools, matrix, memorytools, ssh, weather) en lugar de archivos
planos en el paquete raíz tools/. Esto mejora la organización, permite imports
selectivos y reduce acoplamiento entre tools. El paquete tools/ raíz conserva
los tipos base (Def, Param, Result, ToolFunc, Tool, Registry).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-07 17:16:45 +00:00
parent 8e089ec07e
commit 8d89a762fb
10 changed files with 206 additions and 201 deletions
+18 -2
View File
@@ -35,8 +35,8 @@ type Tool struct {
Exec ToolFunc
}
// getString extracts a string argument by name, returning "" if missing or wrong type.
func getString(args map[string]any, key string) string {
// GetString extracts a string argument by name, returning "" if missing or wrong type.
func GetString(args map[string]any, key string) string {
v, ok := args[key]
if !ok {
return ""
@@ -47,3 +47,19 @@ func getString(args map[string]any, key string) string {
}
return s
}
// GetInt extracts an integer argument by name, returning 0 if missing or wrong type.
func GetInt(args map[string]any, key string) int {
v, ok := args[key]
if !ok {
return 0
}
switch n := v.(type) {
case float64:
return int(n)
case int:
return n
default:
return 0
}
}