Course contentsShow
← AI Engineering
Lesson 557 of 1,88614. Function Calling and Tool UseFree lesson

Writing Effective Function Descriptions

Craft clear, concise function descriptions that help the model understand when and how to use each tool.

Writing Effective Function Descriptions

You'll learn: How to write clear, concise function descriptions that help the LLM understand exactly when and how to use each tool.

Why Descriptions Matter

When you provide functions to an LLM, the function description is the only guide the model has for deciding when to call it. Think of it like writing a manual entry: if you're vague or unclear, the model will guess wrong or skip your function entirely. A great description acts like a signpost that says "Use me when you need X, not Y."

Core Principles

Be specific about the purpose. Don't write "Gets data" — write "Retrieves current weather data for a specific city by name." The model needs to know the exact scenario where this function applies.

Describe the outcome, not just the action. Instead of "Searches database," write "Searches the product database and returns matching items with name, price, and stock status." This helps the model understand what it will get back.

Include edge cases when relevant. If your function only works for US zip codes, say so: "Gets weather forecast for US locations using 5-digit zip codes only."

Keep it concise but complete. Aim for 1-3 sentences. Longer descriptions dilute focus; shorter ones leave gaps.

Example Comparison

❌ Poor: "Does math operations"
✅ Good: "Calculates the sum of two numbers and returns the result as a float. Use this for addition operations only."

❌ Poor: "Gets user info"
✅ Good: "Retrieves user profile information including email, join date, and subscription status by user ID. Returns null if user not found."

Key Takeaway: Write function descriptions as if you're teaching a smart but literal assistant — be explicit about what the function does, when to use it, and what it returns.