All problems
Tool Schema Parameter Count
Problem
Summarize tool schemas where each tool maps to a list of [parameter_name, required] pairs.
Return [total_params, required_params, n_tools] aggregated over every tool.
Hint
Count both totals in one pass and keep the tool count separately.
Test cases
case 1
in: [{"search":[["q",true],["k",false]],"calc":[["x",true]]}]
expected: [3,2,2]
case 2
in: [{}]
expected: [0,0,0]
case 3
in: [{"t":[["a",true]]}]
expected: [1,1,1]
case 4
in: [{"a":[["p",false]],"b":[["q",true],["r",true]]}]
expected: [3,2,2]
Starter codePython
def tool_schema_parameter_count(schemas):
# Your code here
pass4 test cases · run your code against them in the editor