Skip to content

Commit 8b0bec1

Browse files
committed
add comments
1 parent 61dbc7e commit 8b0bec1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

cmd/src/mcp.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,17 @@ func mcpMain(args []string) error {
8383
}
8484
mcp.DerefFlagValues(flags, vars)
8585

86+
// arguments provided via a JSON object take precedence over explicit values provided from flags
8687
if val, ok := vars["json"]; ok {
8788
if jsonVal, ok := val.(string); ok && len(jsonVal) > 0 {
8889
m := make(map[string]any)
8990
if err := json.Unmarshal([]byte(jsonVal), &m); err != nil {
9091
return err
9192
}
93+
// copy overrides existing keys
9294
maps.Copy(vars, m)
9395
}
96+
// we delete "json" from vars, otherwise it will be sent as a argument to the tool call
9497
delete(vars, "json")
9598
}
9699

0 commit comments

Comments
 (0)