Tool calling with arrays - building the JSON schema


I was looking at this response: '$.function_call' is invalid. Please help - #7 by landonbconnell that actually responded my previous question on how to embed list in tool calling.
But I cannot figure out how the original function should be written. I see too many parameters.

getNamesAndDescriptions gets “playlists” as List parameter, but how I should specify the other inner parameters (“id”, “playlist_name”, “playlist_description”)?

I imagined somthing like:

def getNamesAndDescriptions(playlists: List[str]) for example. But i don’t think it’s the case.

My case is pretty much the same, I have a custom function like this:

    def getData(names: List[str], start_date: str, end_date: str) -> pd.DataFrame:
        Select Data based on names and dates.
        :param tickers: List of names (list).
        :param start_date: Start date for historical data (YYYY-MM-DD).
        :param end_date: End date for historical data (YYYY-MM-DD).

How I should write the JSON schema to be sent to the API?

you can use chatgpt to convert it. after a few edits i ended up with this:

  "name": "getData",
  "description": "Select data based on names and dates",
  "parameters": {
    "type": "object",
    "properties": {
      "names": {
        "description": "List of names",
        "type": "array",
        "items": {
          "type": "string"
      "start_date": {
        "description": "Start date for historical data (YYYY-MM-DD)",
        "type": "string"
      "end_date": {
        "description": "End date for historical data (YYYY-MM-DD)",
        "type": "string"
    "required": [

I tested it in the playground