function_calling_tools_structureTier 1 · 70% confidence

ai-agents-function-calling-too-badrequesterror-missing-required-parameter-tools-0-3d039322

agent: ai_agents

When does this happen?

IF BadRequestError: Missing required parameter: 'tools[0].type' when calling OpenAI chat completion with a tools list.

How others solved it

THEN Ensure each item in the `tools` array includes a `type` field set to `"function"` and a `function` field containing the function definition object (name, description, parameters). The tools list must be structured as an array of objects, each with `{"type":"function","function":{...}}`.

tools = [{"type": "function", "function": {"name": "get_weather", "description": "...", "parameters": {...}}}]

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics