The Tools Service provides endpoints for managing and interacting with tools that can be used by AI agents. It includes functionality for creating, listing, updating, and testing tools, as well as managing tool categories.

Authentication

All endpoints require a valid Bearer token in the Authorization header.

Base URL

/api/tools

Tool Categories Endpoints

List Tool Categories

Retrieve all tool categories.

curl -X GET {{baseUrl}}/api/tools/list_categories \
  -H "Authorization: Bearer YOUR_TOKEN"

Endpoint: GET /api/tools/list_categories

Create Tool Category

Create a new tool category.

curl -X POST {{baseUrl}}/api/tools/create_category?org_id=your-org-id \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Coding",
    "description": "Coding tools for software development"
  }'

Endpoint: POST /api/tools/create_category

Query Parameters:

ParameterRequiredDescription
org_idYesOrganization ID

Request Body:

FieldTypeRequiredDescription
namestringYesCategory name
descriptionstringYesCategory description

Response:

FieldTypeDescription
idstring (UUID)Category ID
namestringCategory name
descriptionstringCategory description
created_atstring (datetime)Creation timestamp
updated_atstring (datetime)Last update timestamp

Update Tool Category

Update an existing tool category.

curl -X PUT {{baseUrl}}/api/tools/update_category?org_id=your-org-id&category_id=your-category-id \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Utility",
    "description": "Basic utility tools"
  }'

Endpoint: PUT /api/tools/update_category

Query Parameters:

ParameterRequiredDescription
org_idYesOrganization ID
category_idYesCategory ID to update

Request Body:

FieldTypeRequiredDescription
namestringNoNew category name
descriptionstringNoNew category description

Delete Tool Category

Delete a tool category.

curl -X DELETE {{baseUrl}}/api/tools/delete_category?org_id=your-org-id&category_id=your-category-id \
  -H "Authorization: Bearer YOUR_TOKEN"

Endpoint: DELETE /api/tools/delete_category

Query Parameters:

ParameterRequiredDescription
org_idYesOrganization ID
category_idYesCategory ID to delete

Tools Endpoints

Create Tool

Create a new tool.

curl -X POST {{baseUrl}}/api/tools?org_id=your-org-id \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Apify",
    "description": "Web crawling and scraping tool",
    "category_id": "6a5b4c3d-2e1f-0g9h-8i7j-6k5l4m3n2o1p",
    "is_active": true,
    "version": "2",
    "logo_url": "",
    "is_public": true,
    "configuration": [
      {
        "name": "api_key",
        "type": "str",
        "description": "The API key for the Apify service",
        "required": true,
        "default": null
      },
      {
        "name": "website_content_crawler",
        "type": "bool",
        "description": "",
        "required": false,
        "default": "True"
      }
    ],
    "inputs": [
      {
        "name": "urls",
        "type": "str",
        "description": "The URLs to crawl.",
        "required": true,
        "default": null
      },
      {
        "name": "timeout",
        "type": "int",
        "description": "The timeout for the crawling.",
        "required": false,
        "default": "60"
      }
    ],
    "outputs": {
      "type": "str",
      "description": "A string with the crawled content"
    },
    "settings": {
      "function_info": {
        "name": "Apify Tool",
        "is_async": true,
        "description": "Crawls a website using Apify's website-content-crawler actor",
        "code": "import aiohttp\\n\\nasync def run(self, urls: str, timeout: int | None = \\\"60\\\"):\\n\\n    \\\"\\\"\\\"\\n    Run the tool with the provided parameters.\\n    @param urls The URLs to crawl. (required)\\n    @param timeout The timeout for the crawling. (optional) (default: \\\"60\\\")\\n    \\n    Returns:\\n        dict: The result of the tool execution\\n    \\\"\\\"\\\"\\n    \\n    if self.api_key is None:\\n      return \\\"No API key provided\\\"\\n\\n    client = ApifyClient(self.api_key)\\n\\n    log_debug(f\\\"Crawling URLs: {urls}\\\")\\n\\n    formatted_urls = [{\\\"url\\\": url} for url in urls]\\n\\n    run_input = {\\\"startUrls\\\": formatted_urls}\\n\\n    run = client.actor(\\\"apify/website-content-crawler\\\").call(run_input=run_input, timeout_secs=timeout)\\n\\n    results: str = \\\"\\\"\\n\\n    for item in client.dataset(run[\\\"defaultDatasetId\\\"]).iterate_items():\\n      results += \\\"Results for URL: \\\" + item.get(\\\"url\\\") + \\\"\\\\n\\\"\\n      results += item.get(\\\"text\\\") + \\\"\\\\n\\\"\\n\\n    return results\\n"
      },
      "requirements": [
        "apify_client"
      ],
      "deployment": {
        "framework": "agno",
        "toolkit_class": true,
        "standalone_function": false
      }
    }
  }'

Endpoint: POST /api/tools

Query Parameters:

ParameterRequiredDescription
org_idYesOrganization ID

Request Body:

FieldTypeRequiredDescription
namestringYesTool name
descriptionstringYesTool description
category_idstring (UUID)YesCategory ID
is_activebooleanNoWhether the tool is active (default: true)
versionstringYesTool version
logo_urlstringNoURL to the tool’s logo
is_publicbooleanNoWhether the tool is publicly available (default: false)
configurationarrayYesConfiguration parameters for the tool
inputsarrayYesInput parameters for the tool
outputsobjectYesOutput specification
settingsobjectYesTool implementation settings

List All Tools

Retrieve all available tools.

curl -X GET {{baseUrl}}/api/tools/list_all \
  -H "Authorization: Bearer YOUR_TOKEN"

Endpoint: GET /api/tools/list_all

Update Tool

Update an existing tool.

curl -X PUT {{baseUrl}}/api/tools?org_id=your-org-id&tool_id=your-tool-id \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "is_active": false,
    "name": "Apify Crawler"
  }'

Endpoint: PUT /api/tools

Query Parameters:

ParameterRequiredDescription
org_idYesOrganization ID
tool_idYesTool ID to update

Request Body:

FieldTypeRequiredDescription
namestringNoNew tool name
descriptionstringNoNew tool description
is_activebooleanNoWhether the tool is active
NoAny other fields to update

Test Tool

Test a tool with specified inputs and configurations.

curl -X POST {{baseUrl}}/api/tools/test_tool?tool_id=your-tool-id \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "input_prompt": "scrape the detailed stock: https://www.nseindia.com/get-quotes/equity?symbol=CURAA",
    "config_items": [
      {
        "name": "api_key",
        "value": "apify_api_rC3533Oxdr9hVI1HaVTNYnsV3h2aXs4C4XsC"
      },
      {
        "name": "website_content_crawler",
        "value": true
      }
    ],
    "provider": "anthropic",
    "model_name": "claude-3-7-sonnet-latest",
    "api_key": "your-anthropic-api-key",
    "instructions": "You are a powerful agent that can scrape the web and extract information."
  }'

Endpoint: POST /api/tools/test_tool

Query Parameters:

ParameterRequiredDescription
tool_idYesTool ID to test

Request Body:

FieldTypeRequiredDescription
input_promptstringYesPrompt to send to the tool
config_itemsarrayYesConfiguration parameters
providerstringYesLLM provider to use
model_namestringYesModel name to use
api_keystringYesAPI key for the LLM provider
instructionsstringNoSystem instructions for the LLM

Response:

FieldTypeDescription
resultstringResult from the tool execution
execution_timenumberTime taken to execute the tool (in seconds)
token_usageobjectToken usage information

Error Responses

Status CodeDescription
400Bad Request - Invalid input or validation error
401Unauthorized - Invalid or missing token
403Forbidden - Insufficient permissions
404Not Found - Resource doesn’t exist
500Internal Server Error - Server-side error

Implementation Notes

  • Tools are designed to be integrated with AI agents
  • Tools can be organized into categories for better management
  • Each tool requires specific configuration parameters and input/output specifications
  • The testing functionality allows users to verify tool functionality with different inputs
  • Tools can be public (available to all organizations) or private (only available to the creating organization)