Skip to main content
The API Call Tool allows your assistant to make external API requests when responding to user queries. This guide will walk you through the process of adding and configuring this tool for your assistant.

Prerequisites

Before adding the API Call Tool, ensure that you have:

Adding the API Call Tool

1

Navigate to Your Assistant

  1. Go to the Assistants section in the main navigation menu.
  2. Select the assistant you want to configure.
  3. Click “Configure assistant” in the top right corner.
  4. Select “Tools and MCP” from the left sidebar menu.
  5. Click on Add Tools.
2

Configure the Tool

Configure the API Call Tool with the following settings:
  1. Name: A unique identifier for your tool (e.g., “fetch_user_details”)
    • Use descriptive names that indicate the tool’s purpose
    • Follow a consistent naming convention (e.g., snake_case)
  2. Description: Details on when and how to use the function
    • Example: “Fetch user name and user role”
    • Provide clear guidance on the tool’s purpose and use cases
    • This helps the model determine when to invoke the tool
  3. Fields: Define parameters in JSON format following the OpenAI Function Tool Call schema:
    {
      "additionalProperties": false,
      "properties": {
        "user_name": {
          "description": "name of user",
          "type": "string"
        },
         "user_role": {
          "description": "role of user",
          "type": "string"
        }
      },
       "required": ["user_name", "user_role"]
    }
    
    This schema follows the OpenAI Function Tool Call format where:
    • additionalProperties: false ensures only defined properties are allowed
    • properties defines the parameters the tool accepts. Each property has a description and data type
    • required specifies which parameters must be included
  4. Expected Action: Select “API Request” from the dropdown.
  5. Method: Choose the appropriate HTTP method (GET, POST, PUT, PATCH, etc.)
  6. Server URL: Enter the URL of the external API server
  7. Headers: Add any necessary HTTP headers as key-value pairs
  8. Parameters: Add any query parameters or body parameters as key-value pairs
3

Configure Endpoint Settings

Set up the API endpoint details:
  • Method: Select the appropriate HTTP method (GET, POST, PUT, PATCH, DELETE)
  • Server URL: Enter the URL of the external API server
4

Add Headers

Configure any HTTP headers needed for your API request:
  • Click Add header to include authentication headers or other required metadata
  • Common examples include API keys, Content-Type headers, or Authorization tokens
5

Configure Parameters

Add parameters to be sent with your API request:
  1. Click Add parameters to include data in your request
  2. Select the parameter type from the dropdown menu:
Include assistant-related information in the request:
  • Name
  • Prompt
Include conversation data in the request:
  • Conversation history
  • Include any arguments passed to the assistant. Key is the name passed, value is the new key that will be passed to the api call.
  • Custom metadata that you want to send
  • Include configuration options passed to the assistant. Key is the name passed, value is the new key that will be passed to the api call.
You can add multiple parameters to construct a complete API request.
6

Save Configuration

After configuring the tool, click on the Configure Tool button to save your changes.

Using the API Call Tool

Once configured, your assistant can use the API Call Tool when appropriate. The process typically follows these steps:
  1. The assistant determines a need for external data or functionality.
  2. It calls the API Call Tool with the necessary parameters.
  3. The tool makes an API request to the specified endpoint.
  4. The assistant incorporates the response from the external API into its own response.

Managing the API Call Tool

You can modify or remove the API Call Tool at any time:
  1. Go to your assistant’s “Manage” -> “Configure Tool” tab.
  2. Find the API Call Tool in the list.
  3. Click on it to modify its configuration or remove it.

Best Practices

  • Ensure the external API endpoints are reliable and secure.
  • Monitor API usage and costs associated with external calls.
  • Use the tool judiciously to balance between built-in capabilities and external data fetching.
  • Regularly review and update the tool’s configuration to optimize performance.
By effectively configuring and utilizing the API Call Tool, your assistant can leverage external APIs for enhanced capabilities and access to real-time data or services.