(deps commandDeps)
| 104 | } |
| 105 | |
| 106 | func newToolSearchCommand(deps commandDeps) *cobra.Command { |
| 107 | var scope toolScopeFlags |
| 108 | var limit int |
| 109 | cmd := &cobra.Command{ |
| 110 | Use: toolOperatorSearchQueryValue, |
| 111 | Short: "Search operator-visible registry tools", |
| 112 | Example: ` # Search tools by descriptor text |
| 113 | agh tool search skill -o json |
| 114 | |
| 115 | # Limit search results for automation |
| 116 | agh tool search task --limit 5 -o json`, |
| 117 | Args: exactOneNonBlankArg(), |
| 118 | RunE: func(cmd *cobra.Command, args []string) error { |
| 119 | query := strings.TrimSpace(args[0]) |
| 120 | if query == "" { |
| 121 | return writeToolCommandError(cmd, toolValidationCommandError( |
| 122 | toolspkg.ToolID(""), |
| 123 | "tool search query is required", |
| 124 | toolspkg.NewValidationError("query", toolspkg.ReasonSchemaInvalid, "query is required"), |
| 125 | )) |
| 126 | } |
| 127 | return runToolCommand(cmd, deps, func(client DaemonClient) error { |
| 128 | request := ToolSearchRequest{ |
| 129 | Query: query, |
| 130 | Limit: limit, |
| 131 | WorkspaceID: strings.TrimSpace(scope.workspaceID), |
| 132 | SessionID: strings.TrimSpace(scope.sessionID), |
| 133 | AgentName: strings.TrimSpace(scope.agentName), |
| 134 | } |
| 135 | response, err := client.SearchTools(cmd.Context(), request) |
| 136 | if err != nil { |
| 137 | return err |
| 138 | } |
| 139 | return writeCommandOutput(cmd, toolListBundle(response)) |
| 140 | }) |
| 141 | }, |
| 142 | } |
| 143 | scope.bind(cmd) |
| 144 | cmd.Flags().IntVar(&limit, "limit", 0, "Maximum number of tools to return") |
| 145 | return cmd |
| 146 | } |
| 147 | |
| 148 | func newToolInfoCommand(deps commandDeps) *cobra.Command { |
| 149 | var scope toolScopeFlags |
no test coverage detected