Lesson 3 of 3 · Building ChatGPT Apps
Planning Your First App
Before writing code, you need to think carefully about tool design. The tools you expose to ChatGPT are not just API endpoints -- they are the vocabulary your app speaks. The model uses tool names, descriptions, and schemas to decide when and how to call them. Bad tool design leads to an app that the model calls incorrectly, at the wrong times, or not at all.
Tool Design Principles
These principles come from real production apps. They are not theoretical -- they are the patterns that survive the App Store review process and produce good user experiences.
Principle 1: One Job Per Tool
Each tool should do exactly one thing. The model decides which tool to call based on the tool's name and description. If a tool does multiple things, the model cannot reliably decide when to use it.
Create separate tools: search_products, get_product_details, add_to_cart, checkout. Each has a clear purpose the model can reason about.
Create a single do_everything tool with a 'action' parameter that switches between search, details, cart, and checkout. The model will misuse it because the purpose is ambiguous.
Principle 2: Read vs Write Separation
Separate tools that read data from tools that modify data. This is not just good API design -- it matters for the model's decision-making and for user trust:
- Read tools can be called freely. The model calls them to gather information.
- Write tools should be called deliberately. The model should confirm with the user before modifying data.
The tool annotations system enforces this:
Principle 3: Descriptive Names and Descriptions
The model reads your tool names and descriptions to understand what they do. Write them for the model, not for humans:
Include when-to-use guidance in your tool descriptions. Phrases like "Use this when the user wants to..." or "Call this after the user has selected a product" help the model make better decisions about when to invoke your tools.
Principle 4: Schema Everything
Every tool input must have a JSON Schema. Every required field must be marked required. Every field must have a description. The model uses these schemas to extract parameters from user messages:
100%
Every tool parameter needs a schema and description -- no exceptions
Planning Your Tool Set
Before writing code, map out your entire tool set on paper. Ask these questions for each tool:
- What does it do? (One sentence. If you need two, split into two tools.)
- When should the model call it? (Write this into the description.)
- What inputs does it need? (Schema every field.)
- What does it return? (Structured content with component hints if applicable.)
- Is it read or write? (Set annotations accordingly.)
- What can go wrong? (Plan error responses.)
Error Design
How your tools report errors matters more than you think. The model reads error messages and uses them to explain what went wrong to the user. Good error messages help the model help the user:
Plan your first app:
- Choose a domain you know well (recipes, fitness, music, books, travel)
- List 5-8 tools your app would need
- For each tool, write: name, one-sentence description, read/write classification
- Write the full input schema for your most complex tool
- Write one success response and one error response for each tool
Do not write any code yet. This planning step saves more time than it costs.
Use ← → to navigate, Space to mark complete