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

Function readToolInputFile

internal/cli/tool_operator.go:425–440  ·  view source on GitHub ↗
(cmd *cobra.Command, path string)

Source from the content-addressed store, hash-verified

423}
424
425func readToolInputFile(cmd *cobra.Command, path string) (json.RawMessage, error) {
426 var payload []byte
427 var err error
428 if path == "-" {
429 payload, err = io.ReadAll(cmd.InOrStdin())
430 if err != nil {
431 return nil, fmt.Errorf("cli: read tool input stdin: %w", err)
432 }
433 } else {
434 payload, err = os.ReadFile(path)
435 if err != nil {
436 return nil, fmt.Errorf("cli: read tool input file: %w", err)
437 }
438 }
439 return parseToolInputJSON("input", string(payload))
440}
441
442func parseToolInputJSON(field string, raw string) (json.RawMessage, error) {
443 trimmed := strings.TrimSpace(raw)

Callers 2

resolveToolInvokeInputFunction · 0.85
resolveToolApprovalInputFunction · 0.85

Calls 2

parseToolInputJSONFunction · 0.85
ReadFileMethod · 0.65

Tested by

no test coverage detected