Class: SkillBench::Tools::ArgumentParser

Inherits:
Object
  • Object
show all
Defined in:
lib/skill_bench/tools/argument_parser.rb

Overview

Parses JSON arguments for tools, handling format errors gracefully.

Class Method Summary collapse

Class Method Details

.call(arguments) ⇒ Hash, String

Parses a JSON string of arguments.

Parameters:

  • arguments (String)

    The JSON string to parse.

Returns:

  • (Hash, String)

    The parsed arguments hash, or an error message string.



13
14
15
16
17
# File 'lib/skill_bench/tools/argument_parser.rb', line 13

def self.call(arguments)
  JSON.parse(arguments)
rescue JSON::ParserError => e
  "Error executing tool: Invalid JSON format for arguments. Please correct it. Details: #{e.message}"
end