GPT-5 + Freeform Tool Calling: Why This Changes Everything
By Ivana Tilca · August 25, 2025 · 5 min read
GPT-5's freeform tool calling lets the model send raw SQL, Python or config straight to your tools — no JSON wrapper. Here's how it differs from classic tool calling, a hands-on demo, and when to use it (and when structured calls are still safer).
If you didn't know yet, GPT-5 is already live in Azure AI Foundry via Azure OpenAI. And yes, it's powerful. But the part I'm most excited about — and you should be too if you build agentic workflows or automate anything — is something called freeform tool calling. It sounds like a small feature. It's actually a shift in how models and your code talk to each other. Let me break it down.
First, how "normal" tool calling works
To appreciate what changed, you need the before picture. In classic function/tool calling, you define your tools with a strict JSON schema, and the model responds with a JSON object that matches that schema. Your code parses the JSON and runs the function.
It works, but it has a tax. Anything that isn't naturally JSON — a Python script, a SQL query, a config file, a shell command — has to be crammed into a JSON string field, escaped, and un-escaped on the other side. You spend real effort massaging formats, and models sometimes produce almost-valid JSON that breaks your parser. For anything code-shaped, JSON is an awkward middleman.
What freeform tool calling changes
With freeform tool calling, GPT-5 can send raw text straight to your tools — Python scripts, SQL queries, config files — with no JSON wrapper and no weird formatting rules. Just clean, readable content, exactly in the form your tool actually expects.
That small change unlocks a surprising amount:
Much easier dev workflows. No more fighting with escaping and schema gymnastics for code-shaped payloads.
Richer interactions. GPT-5 can talk to your tools the way a teammate would — handing over a real query or a real script, not a stringified approximation.
Complex tasks feel simple. Chaining tools together stops being a serialization exercise and starts being about the actual logic.
If you're building anything agentic, this is the kind of quiet upgrade that removes a whole category of bugs.
Let's test it
I put together a small demo to show the idea. The premise is simple:
GPT-5 generates SQL → a tool executes the SQL → another tool formats the result with Python → you get a clean output, with no human intervention in between.
Here's what's happening under the hood:
Imports and setup. We load libraries for SQLite, CSV, and I/O, and connect to Azure.
Azure client init. We connect to our Azure AI Foundry project and grab GPT-5.
Tool 1 — `sql_exec_sqlite`. This tool takes SQL from GPT-5, runs it in an in-memory SQLite database, and returns the result as CSV.
Tool 2 — `code_exec_python`. This one takes the CSV, prints a formatted table, and sums up a column (like revenue).
Prompt GPT-5. We ask it to create an employees table, insert sample data, select and sort it, and call both tools using raw text — no JSON.
Main execution block. GPT-5 sends the SQL → we run it → pass the result to the Python tool → print the final output.
The magic isn't any single step — it's that the model produces genuine SQL and genuine Python, each tool receives exactly the format it wants, and the whole chain runs end to end without a human stitching formats together in the middle.
When to reach for it (and when not to)
Freeform is a great fit when the payload is naturally code or text: database queries, generated scripts, templating, transformations, anything you'd normally paste into a terminal or an editor. That's precisely where JSON was fighting you.
It's not a replacement for structured tool calling everywhere. When you genuinely need typed, validated arguments — a booking with a date, an amount, and an ID — a strict JSON schema is still the safer choice, because the schema is your validation. The skill is knowing which tool call wants structure and which wants freedom.
And a caution worth stating plainly: freeform means the model can hand your tools executable code. That's powerful and also a responsibility. Run untrusted, model-generated code in a sandbox, scope database access tightly, and never wire it straight into production data without guardrails. The demo runs SQL in an in-memory database on purpose — because "it executes what the model writes" is exactly the property you want to contain carefully.
Final thoughts
This isn't just a cool feature — it's a shift in how we build with AI. Freeform tool calling makes GPT-5 feel less like a chatbot and more like a real collaborator: you give it a goal, it figures out the steps, it talks to your tools in their native language, and it gets the job done.
If you're working on agentic systems, automations, or anything that needs real execution logic, this is the kind of upgrade that makes your life easier and your stack smarter — as long as you pair the freedom with the right guardrails. Give it a try in Azure AI Foundry and see how much of your old "format-wrangling" code you get to delete.
Happy coding!