[GH-ISSUE #10328] Error when using tools: cannot unmarshal array into Go struct field .tools.function.parameters.properties.type of type string #6782

Open
opened 2026-04-12 18:32:35 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @loudar on GitHub (Apr 17, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/10328

What is the issue?

I get the following error when trying to call ollama with the attached tools. I'm using the Vercel AI SDK and the ollama community provider. The "type" on each property seems to must be an array of strings instead of either a single string or an array.

json: cannot unmarshal array into Go struct field .tools.function.parameters.properties.type of type string

Could this be adjusted within ollama or would that be a thing for the AI SDK / community provider?

[
  {
    "function": {
      "description": "Web search. Useful for when you need to answer search questions. Input should be a search query.",
      "name": "google.search-engine",
      "parameters": {
        "type": "object",
        "properties": {
          "query": {
            "type": "string",
            "description": "The query to search for"
          }
        },
        "required": [
          "query"
        ],
        "additionalProperties": false,
        "$schema": "http://json-schema.org/draft-07/schema#"
      }
    },
    "type": "function"
  },
  {
    "function": {
      "description": "Spotify search. Useful for when you need to search for music or podcasts.",
      "name": "spotify.search",
      "parameters": {
        "type": "object",
        "properties": {
          "query": {
            "type": "string",
            "description": "What to search for"
          },
          "searchTypes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "album",
                "artist",
                "playlist",
                "track",
                "show",
                "episode"
              ]
            },
            "description": "What types to search for. Must be an array."
          }
        },
        "required": [
          "query",
          "searchTypes"
        ],
        "additionalProperties": false,
        "$schema": "http://json-schema.org/draft-07/schema#"
      }
    },
    "type": "function"
  },
  {
    "function": {
      "description": "Get Spotify devices.",
      "name": "spotify.getDevices",
      "parameters": {
        "type": "object",
        "properties": {},
        "additionalProperties": false,
        "$schema": "http://json-schema.org/draft-07/schema#"
      }
    },
    "type": "function"
  },
  {
    "function": {
      "description": "Play a song, album or playlist on Spotify. If you don't know the URIs, use the Spotify search tool first.",
      "name": "spotify.play",
      "parameters": {
        "type": "object",
        "properties": {
          "deviceId": {
            "type": "string",
            "description": "The device ID to play on"
          },
          "contextUri": {
            "type": "string",
            "description": "The context URI to play on"
          },
          "uris": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The URIs to play"
          },
          "positionMs": {
            "type": "number",
            "description": "The position in milliseconds to start playing from"
          }
        },
        "required": [
          "deviceId",
          "positionMs"
        ],
        "additionalProperties": false,
        "$schema": "http://json-schema.org/draft-07/schema#"
      }
    },
    "type": "function"
  },
  {
    "function": {
      "description": "Pause Spotify playback.",
      "name": "spotify.pause",
      "parameters": {
        "type": "object",
        "properties": {
          "deviceId": {
            "type": "string",
            "description": "The device ID to pause on"
          }
        },
        "required": [
          "deviceId"
        ],
        "additionalProperties": false,
        "$schema": "http://json-schema.org/draft-07/schema#"
      }
    },
    "type": "function"
  },
  {
    "function": {
      "description": "Get what is currently playing on Spotify.",
      "name": "spotify.getCurrentPlayback",
      "parameters": {
        "type": "object",
        "properties": {},
        "additionalProperties": false,
        "$schema": "http://json-schema.org/draft-07/schema#"
      }
    },
    "type": "function"
  },
  {
    "function": {
      "description": "Get Spotify profile of the current user.",
      "name": "spotify.getProfile",
      "parameters": {
        "type": "object",
        "properties": {},
        "additionalProperties": false,
        "$schema": "http://json-schema.org/draft-07/schema#"
      }
    },
    "type": "function"
  },
  {
    "function": {
      "description": "Add a Spotify URI to the queue.",
      "name": "spotify.addToQueue",
      "parameters": {
        "type": "object",
        "properties": {
          "uri": {
            "type": "string",
            "description": "The URI to add to the queue"
          },
          "deviceId": {
            "type": "string",
            "description": "The device ID to add to the queue on"
          }
        },
        "required": [
          "uri",
          "deviceId"
        ],
        "additionalProperties": false,
        "$schema": "http://json-schema.org/draft-07/schema#"
      }
    },
    "type": "function"
  },
  {
    "function": {
      "description": "Add a list of Spotify tracks to the library",
      "name": "spotify.addToSavedTracks",
      "parameters": {
        "type": "object",
        "properties": {
          "trackIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "List of Spotify track IDs"
          }
        },
        "required": [
          "trackIds"
        ],
        "additionalProperties": false,
        "$schema": "http://json-schema.org/draft-07/schema#"
      }
    },
    "type": "function"
  },
  {
    "function": {
      "description": "Get a list of Spotify top tracks for an artist",
      "name": "spotify.getArtistTopTracks",
      "parameters": {
        "type": "object",
        "properties": {
          "artistId": {
            "type": "string",
            "description": "Spotify artist ID, format is base62"
          },
          "countryCode": {
            "type": [
              "string",
              "null"
            ],
            "description": "The country/territory where the tracks are most popular. (format: ISO 3166-1 alpha-2"
          }
        },
        "required": [
          "artistId"
        ],
        "additionalProperties": false,
        "$schema": "http://json-schema.org/draft-07/schema#"
      }
    },
    "type": "function"
  }
]

Relevant log output


OS

Windows

GPU

Nvidia

CPU

Intel

Ollama version

0.6.5

Originally created by @loudar on GitHub (Apr 17, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/10328 ### What is the issue? I get the following error when trying to call ollama with the attached tools. I'm using the Vercel AI SDK and the ollama community provider. The "type" on each property seems to must be an array of strings instead of either a single string or an array. `json: cannot unmarshal array into Go struct field .tools.function.parameters.properties.type of type string` Could this be adjusted within ollama or would that be a thing for the AI SDK / community provider? ```json [ { "function": { "description": "Web search. Useful for when you need to answer search questions. Input should be a search query.", "name": "google.search-engine", "parameters": { "type": "object", "properties": { "query": { "type": "string", "description": "The query to search for" } }, "required": [ "query" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, "type": "function" }, { "function": { "description": "Spotify search. Useful for when you need to search for music or podcasts.", "name": "spotify.search", "parameters": { "type": "object", "properties": { "query": { "type": "string", "description": "What to search for" }, "searchTypes": { "type": "array", "items": { "type": "string", "enum": [ "album", "artist", "playlist", "track", "show", "episode" ] }, "description": "What types to search for. Must be an array." } }, "required": [ "query", "searchTypes" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, "type": "function" }, { "function": { "description": "Get Spotify devices.", "name": "spotify.getDevices", "parameters": { "type": "object", "properties": {}, "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, "type": "function" }, { "function": { "description": "Play a song, album or playlist on Spotify. If you don't know the URIs, use the Spotify search tool first.", "name": "spotify.play", "parameters": { "type": "object", "properties": { "deviceId": { "type": "string", "description": "The device ID to play on" }, "contextUri": { "type": "string", "description": "The context URI to play on" }, "uris": { "type": "array", "items": { "type": "string" }, "description": "The URIs to play" }, "positionMs": { "type": "number", "description": "The position in milliseconds to start playing from" } }, "required": [ "deviceId", "positionMs" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, "type": "function" }, { "function": { "description": "Pause Spotify playback.", "name": "spotify.pause", "parameters": { "type": "object", "properties": { "deviceId": { "type": "string", "description": "The device ID to pause on" } }, "required": [ "deviceId" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, "type": "function" }, { "function": { "description": "Get what is currently playing on Spotify.", "name": "spotify.getCurrentPlayback", "parameters": { "type": "object", "properties": {}, "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, "type": "function" }, { "function": { "description": "Get Spotify profile of the current user.", "name": "spotify.getProfile", "parameters": { "type": "object", "properties": {}, "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, "type": "function" }, { "function": { "description": "Add a Spotify URI to the queue.", "name": "spotify.addToQueue", "parameters": { "type": "object", "properties": { "uri": { "type": "string", "description": "The URI to add to the queue" }, "deviceId": { "type": "string", "description": "The device ID to add to the queue on" } }, "required": [ "uri", "deviceId" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, "type": "function" }, { "function": { "description": "Add a list of Spotify tracks to the library", "name": "spotify.addToSavedTracks", "parameters": { "type": "object", "properties": { "trackIds": { "type": "array", "items": { "type": "string" }, "description": "List of Spotify track IDs" } }, "required": [ "trackIds" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, "type": "function" }, { "function": { "description": "Get a list of Spotify top tracks for an artist", "name": "spotify.getArtistTopTracks", "parameters": { "type": "object", "properties": { "artistId": { "type": "string", "description": "Spotify artist ID, format is base62" }, "countryCode": { "type": [ "string", "null" ], "description": "The country/territory where the tracks are most popular. (format: ISO 3166-1 alpha-2" } }, "required": [ "artistId" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, "type": "function" } ] ``` ### Relevant log output ```shell ``` ### OS Windows ### GPU Nvidia ### CPU Intel ### Ollama version 0.6.5
GiteaMirror added the bug label 2026-04-12 18:32:35 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#6782