PIXELBANKv9.1.0
Menu

Check Required Parameters Are Present

Problem Statement

Before dispatching a tool call, verify every required parameter is present. Report the missing ones so the agent can ask for them.

Background

A tool schema lists a set of required parameter names. Validation returns the sorted list of required names absent from the provided arguments. An empty list means the call is ready to execute.

Your Task

Implement:

def missing_params(args, required):
  • args: dict of provided arguments.
  • required: list of required parameter names.
  • Return the sorted list of required names not in args.

Input Format

  • args (dict), required (list of strings).

Output Format

  • A sorted list of strings.

Sample

print(missing_params({"city": "NYC"}, ["city", "date"]))

Output:

['date']

Example:

Input:
print(missing_params({"city": "NYC"}, ["city", "date"]))
Output:
['date']
Reasoning:
  • Identify the provided arguments and the required parameters: the input dictionary contains the key "city", and the required list is ["city", "date"].
  • Check each required parameter against the provided arguments to determine presence: "city" is found in the arguments, while "date" is absent.
  • Collect the missing parameters into a list, resulting in ["date"].
  • Sort the list of missing parameters alphabetically to ensure a consistent output order; since there is only one element, the list remains ["date"].
  • The final output is ['date']

Constraints:

  • Compare only names (values may be anything, including None).
  • A required name present with any value counts as provided.
  • Return the missing names sorted ascending.
🔒

Editor locked

The code editor is locked for Pro problems. It is only available for free problems. Please upgrade to gain access to the code editor for all problems.

solution.py

Test Results

0/0
Run code to see test results.
Check Required Parameters Are Present - Easy | PixelBank