CreateTool creates a toolset using the registered creator for the given type.
(ctx context.Context, toolset latest.Toolset, parentDir string, runConfig *config.RuntimeConfig, agentName string)
| 42 | |
| 43 | // CreateTool creates a toolset using the registered creator for the given type. |
| 44 | func (r *toolsetRegistry) CreateTool(ctx context.Context, toolset latest.Toolset, parentDir string, runConfig *config.RuntimeConfig, agentName string) (tools.ToolSet, error) { |
| 45 | creator, ok := r.creators[toolset.Type] |
| 46 | if !ok { |
| 47 | return nil, fmt.Errorf("unknown toolset type: %s", toolset.Type) |
| 48 | } |
| 49 | ts, err := creator(ctx, toolset, parentDir, runConfig, agentName) |
| 50 | if err != nil { |
| 51 | return nil, err |
| 52 | } |
| 53 | return tools.WithName(ts, cmp.Or(toolset.Name, toolset.Type)), nil |
| 54 | } |
nothing calls this directly
no test coverage detected