Search⌘ K
AI Features

Designing Tool Schemas and Retrieval

Explore how to design dependable tool schemas and retrieval mechanisms that ensure reliable operation recovery, enforce validation and authorization, and support effective error handling in agent workflows. Understand idempotency, business operations boundaries, schema constraints, and evidence-based retrieval to build systems resilient to failures and ambiguities.

Operation op-314 commits reservation BK-314 for room R8, but its response disappears. The next call must recover that reservation, not create another. Reliable interfaces define inputs, actionable errors, sufficient evidence, and repeated-execution behavior,contracts you must defend in an interview.

Recovering BK-314

The opening execution trace has two entries:

  1. Database: Commit op-314 and reservation BK-314 for R8, November 3, 2026, from 10:00Z to 11:00Z, with five attendees.

  2. Caller: Receive a timeout because the acknowledgment was lost.

A timeout describes the caller’s observation, not whether the write committed. Idempotency means repeating one logical operation creates no additional business effect; replay may return a stored result without executing again. Retain op-314 across attempts: a new identifier creates a second intent rather than resolving the first.

Choosing three tools

Compare three interfaces:

  • Arbitrary command: A single arbitrary-command tool exposes broad execution authority that is difficult to constrain.

  • Database fragments: Row lookups, reservation inserts, and field setters expose implementation steps. Dependent calls add model turns, latency, and partial-failure opportunities.

  • Business operations: retrieve_booking_rule, get_room_availability, and reserve_room separate policy evidence, current availability, and a confirmed write.

Choose the business operations: each has a coherent purpose and authority boundary. Keep validation and mutations inside reserve_room, never optional model decisions. Independent reads can share one model response where supported; the write must recheck conflicts because availability can change.

Gemini’s function-calling guidance recommends descriptive names, clear function and parameter descriptions, specific types, validation before execution, robust error handling, and appropriate authentication. ...