Create API Tools

You can use the Tool Creation AI Assistant made by MaiAgent to help you create API tools

API tools are used to integrate external services and automate operational workflows.

What is an API?

API (Application Programming Interface) is a bridge for communication between different software systems. Simply put, it's like a "waiter" in the software world, helping different programs exchange information and execute functions with each other.

Imagine you're dining at a restaurant:

  • You: The customer who needs food (the application)

  • Kitchen: The place where food is prepared (the system providing services)

  • Waiter: Passes messages between you and the kitchen (API)

You don't need to go directly to the kitchen; you just tell the waiter what you want, the waiter conveys your needs to the kitchen, and then brings the prepared meal to you.

API Process Diagram

API tools can help you automate standardized processes, set specific return formats, and retrieve information from your system, such as:

E-commerce Customer Service Automation

Customer inquires about order ➡️ API queries order status ➡️ Automatically responds with delivery progress

Marketing Campaign Management

New product launch ➡️ Automatically update website ➡️ Send EDM ➡️ Social media promotion

Online Course Platform:

Student inquires about course progress ➡️ API queries learning records ➡️ Automatically responds with completion percentage and next class time

Through API tools, AI assistants evolve from simple chatbots into intelligent assistants capable of actually executing business processes, significantly improving work efficiency and automation levels.

Quick Create API Tool

1. Enter Tool Management Interface

First, navigate to the "AI Features" section from the left sidebar, then click "🔧 Tools". After entering the tools list page, click the "➕ Add Tool" button in the upper right corner.

Tools list page and add button
Click "➕ Add Tool" to start creating

2. Select Tool Type

For tool type, select API.

3. Set Display Name

Set a clear display name for the tool, here set as google calendar.

  • Purpose: This name will be displayed in the platform interface for all users to view.

  • Recommendation: Choose a name that clearly expresses the tool's main function for easy user understanding. This name has no strict format restrictions.

4. Set Tool Name

Next is the "Tool Name" field.

  • Purpose: This name is the unique identifier used by the AI assistant to internally call and identify this tool.

  • Naming Rules (Important):

    • Must use English.

    • Can only contain:

      • Lowercase letters (a-z)

      • Uppercase letters (A-Z)

      • Numbers (0-9)

      • Underscore (_)

      • Hyphen (-)

    • Example: get_weather_forecast, database-query-tool

In the image below, set as google_calendar_retriever

API Tool Name Definition

5. Write Tool Description

In the "Tool Description" field, users can provide a clear and detailed tool description.

  • Importance: A good description helps the AI assistant more accurately understand:

    • The tool's function and purpose.

    • When this tool should be used.

    • How to interpret the tool's output results.

  • Recommended Content: Explain what the tool does, what it inputs, what it outputs, and any usage precautions.

Tool Description

6. API Configuration Detailed Settings

a. 🔗 API URL

  • Fill in the complete URL of the target API endpoint (including http:// or https://).

  • Example: https://api.opencalendar.org/data/2.5

b. 📮 HTTP Method

  • Select the HTTP verb required by the API service from the dropdown menu:

    • GET: Usually used to retrieve resources.

    • POST: Usually used to create new resources or submit data.

    • PUT: Usually used to completely replace or update resources.

    • DELETE: Usually used to delete resources.

c. 📰 Headers

Headers are like the "envelope" of a letter, telling the receiver some important information before seeing the actual data content. Without correct headers, API requests may fail authentication, or the receiver may not be able to properly parse the data.

Common Uses:

  • Authentication (Authorization, X-API-Key)

  • Specify content type (Content-Type)

  • Specify accepted response format (Accept)

To add headers, you need to:

  • Click "➕ Add Header" to define HTTP headers sent with the request.

  • Format: Must be a valid JSON object, where the Key is the header name and the Value is the header content (string).

  • Example:

    {
      "Content-Type": "application/json; charset=utf-8",
      "Authorization": "Bearer {{SECRET_API_TOKEN}}",
      "Accept": "application/vnd.github.v3+json"
    }
API header settings screenshot
Set necessary HTTP request headers

d. 🧩 Parameters Schema

The parameters schema is like an "order form", telling the AI assistant what data can be requested from the API and how to request it.

  • Core Setting: Defines which parameters the AI assistant can or must provide when calling this tool (content to be passed to the system for processing), and the format of these parameters.

  • Format: Uses standard JSON Schema format.

  • Key Elements:

    • type: "object": Indicates that parameters are an object.

    • properties: Defines the object for each parameter.

      • Parameter Name (e.g., "search"): The corresponding object contains details for that parameter.

        • type: The parameter's data type (string, integer, number, boolean, array, object).

        • description: Explanation for the AI assistant about the meaning of this parameter.

        • default (optional): Default value for the parameter.

        • enum (optional): If the parameter value can only be one of specific options, list them here.

    • required: An array containing the names of all required parameters.

  • Example (Video search tool):

    {
        "type": "object",
        "properties": {
            "limit": {
                "type": "integer",
                "minimum": 1,
                "description": "Maximum number of returned results"
            },
            "fields": {
                "type": "string",
                "description": "Comma-separated list of fields"
            },
            "search": {
                "type": "string",
                "description": "Search keywords"
            }
        },
        "required": ["search"]
    }
API parameters schema settings screenshot
Precisely define API parameters using JSON Schema

7. 💾 Save Tool

After confirming all settings are correct, scroll to the bottom of the page and click the "Confirm" button. Your new tool is now created!

⚠️ Important Reminders

Connection Testing

  • After creating a tool, it's recommended to first test whether the API works properly

  • You can use testing tools to verify tool functionality, such as:

    • POSTMAN

    • API testing platforms built by your enterprise

Permission Management

  • Regularly check tool usage status and permission access status

Last updated

Was this helpful?