MCPcopy Create free account
hub / github.com/compozy/agh / resolveToolApprovalInput

Function resolveToolApprovalInput

internal/cli/tool_operator.go:406–423  ·  view source on GitHub ↗
(cmd *cobra.Command, flags toolApprovalFlags)

Source from the content-addressed store, hash-verified

404}
405
406func resolveToolApprovalInput(cmd *cobra.Command, flags toolApprovalFlags) (json.RawMessage, error) {
407 inlineChanged := cmd.Flags().Lookup("input") != nil && cmd.Flags().Lookup("input").Changed
408 inputFile := strings.TrimSpace(flags.inputFile)
409 if inlineChanged && inputFile != "" {
410 return nil, toolspkg.NewValidationError(
411 "input",
412 toolspkg.ReasonSchemaInvalid,
413 "provide --input or --input-file, not both",
414 )
415 }
416 if inlineChanged {
417 return parseToolInputJSON("input", flags.input)
418 }
419 if inputFile != "" {
420 return readToolInputFile(cmd, inputFile)
421 }
422 return nil, nil
423}
424
425func readToolInputFile(cmd *cobra.Command, path string) (json.RawMessage, error) {
426 var payload []byte

Callers 1

newToolApproveCommandFunction · 0.85

Calls 2

parseToolInputJSONFunction · 0.85
readToolInputFileFunction · 0.85

Tested by

no test coverage detected