Simplify codebase per audit of 8b89f14
This commit is contained in:
+5
-10
@@ -41,19 +41,14 @@ func (m *Manager) bashTool(l *live) mcp.Tool {
|
||||
},
|
||||
"required": ["command"]
|
||||
}`),
|
||||
Handler: func(ctx context.Context, raw json.RawMessage) (string, error) {
|
||||
return m.bash(ctx, l, raw)
|
||||
},
|
||||
Handler: mcp.Typed(func(ctx context.Context, args bashArgs) (string, error) {
|
||||
return m.bash(ctx, l, args)
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
func (m *Manager) bash(ctx context.Context, l *live, raw json.RawMessage) (string, error) {
|
||||
args := bashArgs{}
|
||||
err := json.Unmarshal(raw, &args)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("malformed bash call: %w", err)
|
||||
}
|
||||
err = args.check()
|
||||
func (m *Manager) bash(ctx context.Context, l *live, args bashArgs) (string, error) {
|
||||
err := args.check()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user