excludeToolDef returns a copy of defs with any entries whose function name matches name removed. Used by `ocr scan` to hide tools that don't make sense in full-scan mode (e.g. file_read_diff).
(defs []llm.ToolDef, name string)
| 229 | // matches name removed. Used by `ocr scan` to hide tools that don't make |
| 230 | // sense in full-scan mode (e.g. file_read_diff). |
| 231 | func excludeToolDef(defs []llm.ToolDef, name string) []llm.ToolDef { |
| 232 | out := make([]llm.ToolDef, 0, len(defs)) |
| 233 | for _, d := range defs { |
| 234 | if d.Function.Name == name { |
| 235 | continue |
| 236 | } |
| 237 | out = append(out, d) |
| 238 | } |
| 239 | return out |
| 240 | } |
| 241 | |
| 242 | // quietHandle wraps a stdout.Quiet() restorer so callers can `defer |
| 243 | // q.Restore()` for safety while emitRunResult restores it early when the |
no outgoing calls