WithReadOnlyFilter wraps a toolset so it only lists and exposes tools whose annotations carry a read-only hint. Every other tool is filtered out, so the agent can never call a mutating tool from this toolset. When readOnly is false the inner toolset is returned unchanged.
(inner tools.ToolSet, readOnly bool)
| 11 | // agent can never call a mutating tool from this toolset. When readOnly is |
| 12 | // false the inner toolset is returned unchanged. |
| 13 | func WithReadOnlyFilter(inner tools.ToolSet, readOnly bool) tools.ToolSet { |
| 14 | if !readOnly { |
| 15 | return inner |
| 16 | } |
| 17 | |
| 18 | return &readOnlyTools{ToolSet: inner} |
| 19 | } |
| 20 | |
| 21 | type readOnlyTools struct { |
| 22 | tools.ToolSet |
no outgoing calls