Function Calling & JSON Schemas That Don’t Break

Agentic AI 20 min min read Updated: Feb 26, 2026 Intermediate
Function Calling & JSON Schemas That Don’t Break
Intermediate Topic 2 of 8

Function Calling & JSON Schemas That Don’t Break

Why schemas matter more than prompts

Prompting can suggest structure, but schemas enforce it. When you define tool inputs with a JSON schema, you dramatically reduce “creative” malformed payloads.

Designing robust schemas

Practical tips:

  • Use enums for limited choices (priority, status)
  • Validate string lengths (titles, descriptions)
  • Require identifiers (tenant_id, user_id) via server-side injection
  • Keep optional fields truly optional

Server-side validation is non-negotiable

Even if the model “follows” the schema, always validate again on the server. Treat model outputs like untrusted user input.

Output formats

Prefer outputs like:

{"ok": true, "data": {...}, "warnings": []}

Avoid returning large text blobs unless necessary.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators