Skip to main content

Tool Schemas (Tools & JSON Schema)

FOR AI AGENTChatGPTClaude

A standardized formal description of tool interfaces for large language models using the JSON Schema standard. It includes the function name, a detailed textual description of its purpose, a list of required parameters, and their value types.

1. Concept Overview & Systemic Problem

Imagine you invited a new assistant to the office and told them: “Here we have a special program, use it.” But you didn’t explain what the buttons do or what fields need to be filled. Naturally, the assistant would be confused.

To ensure the language model knows what digital tools it possesses, developers provide it with a Tool Schema.

This is a compact description structured according to the JSON Schema standard:

  • Name: a short name for the button (e.g., book_hotel).
  • Description: a human-readable explanation of the action's purpose.
  • Parameters: the data required to execute (city, check-in date, number of guests).

Mental model: a job description for AI: a list of tools on the master’s belt with clear instructions on when to use a hammer and when to use a screwdriver.

2. How a Real Tool Schema Looks

{
  "name": "calculate_mortgage",
  "description": "Calculates the monthly payment for a mortgage loan.",
  "parameters": {
    "type": "object",
    "properties": {
      "loan_amount": {
        "type": "number",
        "description": "The total loan amount in currency, e.g., 1500000"
      },
      "years": {
        "type": "integer",
        "description": "The loan term in years from 1 to 30"
      },
      "interest_rate": {
        "type": "number",
        "description": "Annual interest rate in percentage, e.g., 7.5"
      }
    },
    "required": ["loan_amount", "years"]
  }
}

3. Four Golden Rules for Crafting a Good Schema

  1. Write the description as if explaining to an intern: specify not only what the tool does but also when it should NOT be called.
  2. Provide examples in the description field: “date format strictly YYYY-MM-DD, e.g., 2026-05-18”.
  3. Limit options using enum: if the order status can only be one of three types, specify strictly: ["pending", "shipped", "delivered"].
  4. Mark required fields in the required array: if the function cannot operate without the client's email, do not allow the model to run it blindly.

4. Production Engineering Scenarios

01. Tool Integration in a Chatbot

Integrate tool schemas into a chatbot framework to enhance user interactions. Ensure that the chatbot can dynamically call functions based on user input, leveraging the clarity of tool descriptions to minimize errors.

02. API Development with JSON Schema

Utilize JSON Schema to define API endpoints for your application. This ensures that all developers understand the expected input and output formats, reducing integration issues and improving collaboration.

03. Automated Testing of Tool Functions

Implement automated tests that validate the functionality of tools against their schemas. This will help catch discrepancies between the expected and actual behavior of functions, ensuring reliability in production.

5. Pitfalls, Common Mistakes & Security

  • Ambiguous Descriptions: Vague descriptions can lead to misinterpretations by the model, causing incorrect function calls.
  • Neglecting Required Fields: Failing to specify required fields can result in runtime errors when the model attempts to execute functions without necessary data.
  • Inadequate Testing: Not validating tool schemas against real-world scenarios can lead to unexpected failures in production, undermining user trust and system reliability.
/ Frequently Asked QuestionsSchema.org FAQPage

FAQ: Tool Schemas (Tools & JSON Schema)

It is an international standard passport for data: it strictly describes what fields must be in a document, what type they have (string, integer, boolean), and whether they are required.
/ Internal links
All terms

Related Ecosystem Resources

Explore practical workflows, core terminology, and engineering tools

Glossary Concept

Function Calling / Tool Calling

A technical protocol and standard for LLM interaction with external software. Instead of free text, the model returns valid JSON containing the function name and typed arguments according to JSON Schema, enabling the backend to deterministically execute actions in real APIs.

Practical Guide

7 Best Cheap Alternatives to Claude Code: Pick the Right Tool

Claude Code has become a leading name in agentic coding. Discover the 7 best CLI alternatives: OpenCode, Pi, Factory Droid, Codex CLI, Antigravity CLI, Cline, and Goose.

Glossary Concept

Dynamic Tool Selection

An architectural approach for building scalable AI agents equipped with hundreds of tools. Instead of loading all function descriptions into the context simultaneously, the system employs semantic search or a Router model for dynamic selection of only 3-5 most relevant tools for a specific user query.

Practical Guide

Autonomous AI Operator on Telegram 24/7: Architecture, Telethon, Security, and 10 Production Scenarios

A comprehensive engineering guide to building a production-ready AI operator on Telegram using Telethon: session isolation, confirmation systems, ban protection, and 24/7 deployment.

News

Kimi K3.1 Pro: Moonshot Updates Model for 3D Tooling

Moonshot released Kimi K3.1 Pro with a focus on 3D tooling, updated post-training, and an architecture change aimed at better long-context efficiency.

News

Anthropic releases FlashProve in open source, a tool for provable inference

Anthropic published a prototype of an open cryptographic protocol called FlashProve that lets anyone verify a model response without access to model weights.