MCPcopy Create free account
hub / github.com/aurora-develop/aurora / ResolveShellTool

Function ResolveShellTool

internal/toolcall/recover.go:24–37  ·  view source on GitHub ↗

ResolveShellTool 找到 tools 列表里第一个 shell 工具,返回 (name, param)。 没找到就返回 ("", "")。

(tools []official.Tool)

Source from the content-addressed store, hash-verified

22// ResolveShellTool 找到 tools 列表里第一个 shell 工具,返回 (name, param)。
23// 没找到就返回 ("", "")。
24func ResolveShellTool(tools []official.Tool) (string, string) {
25 for _, t := range tools {
26 if t.Type != "function" {
27 continue
28 }
29 name := strings.ToLower(t.Function.Name)
30 if !contains(ShellToolNames, name) {
31 continue
32 }
33 param := pickShellParam(t.Function.Parameters)
34 return t.Function.Name, param
35 }
36 return "", ""
37}
38
39func pickShellParam(paramsJSON json.RawMessage) string {
40 if len(paramsJSON) == 0 {

Callers 2

TestResolveShellToolFunction · 0.85
RecoverFromTextFunction · 0.85

Calls 2

containsFunction · 0.85
pickShellParamFunction · 0.85

Tested by 1

TestResolveShellToolFunction · 0.68