> ## Documentation Index
> Fetch the complete documentation index at: https://docs.thinnest.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Tool

> Register a new custom tool for agents to use

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.thinnest.ai/v2/tools/{agent_id} \
    -H "Authorization: Bearer $THINNESTAI_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
    "name": "check_inventory",
    "type": "function",
    "description": "Check product inventory levels",
    "parameters": {
      "type": "object",
      "properties": {
        "product_id": {
          "type": "string",
          "description": "The product SKU"
        }
      },
      "required": [
        "product_id"
      ]
    },
    "endpoint_url": "https://api.example.com/inventory",
    "method": "GET",
    "headers": {
      "Authorization": "Bearer {{API_KEY}}"
    }
  }'
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.thinnest.ai/v2/tools/{agent_id}"
  headers = {
      "Authorization": "Bearer " + "YOUR_THINNESTAI_API_KEY",
      "Content-Type": "application/json",
  }

  payload = {
    "name": "check_inventory",
    "type": "function",
    "description": "Check product inventory levels",
    "parameters": {
      "type": "object",
      "properties": {
        "product_id": {
          "type": "string",
          "description": "The product SKU"
        }
      },
      "required": [
        "product_id"
      ]
    },
    "endpoint_url": "https://api.example.com/inventory",
    "method": "GET",
    "headers": {
      "Authorization": "Bearer {{API_KEY}}"
    }
  }

  response = requests.post(url, headers=headers, json=payload)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://api.thinnest.ai/v2/tools/{agent_id}", {
    method: "POST",
    headers: {
      "Authorization": "Bearer " + "YOUR_THINNESTAI_API_KEY",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
    "name": "check_inventory",
    "type": "function",
    "description": "Check product inventory levels",
    "parameters": {
      "type": "object",
      "properties": {
        "product_id": {
          "type": "string",
          "description": "The product SKU"
        }
      },
      "required": [
        "product_id"
      ]
    },
    "endpoint_url": "https://api.example.com/inventory",
    "method": "GET",
    "headers": {
      "Authorization": "Bearer {{API_KEY}}"
    }
  }),
  });

  const data = await response.json();
  console.log(data);
  ```

  ```go Go theme={null}
  package main

  import (
      "bytes"
      "fmt"
      "io"
      "net/http"
  )

  func main() {
      payload := []byte(`{
    "name": "check_inventory",
    "type": "function",
    "description": "Check product inventory levels",
    "parameters": {
      "type": "object",
      "properties": {
        "product_id": {
          "type": "string",
          "description": "The product SKU"
        }
      },
      "required": [
        "product_id"
      ]
    },
    "endpoint_url": "https://api.example.com/inventory",
    "method": "GET",
    "headers": {
      "Authorization": "Bearer {{API_KEY}}"
    }
  }`)
      req, _ := http.NewRequest("POST", "https://api.thinnest.ai/v2/tools/{agent_id}", bytes.NewBuffer(payload))
      req.Header.Set("Authorization", "Bearer YOUR_THINNESTAI_API_KEY")
      req.Header.Set("Content-Type", "application/json")

      resp, err := http.DefaultClient.Do(req)
      if err != nil { panic(err) }
      defer resp.Body.Close()
      body, _ := io.ReadAll(resp.Body)
      fmt.Println(string(body))
  }
  ```
</RequestExample>

```http theme={null}
POST /v2/tools
```

## Request Body

```json theme={null}
{
  "name": "check_inventory",
  "type": "function",
  "description": "Check product inventory levels",
  "parameters": {
    "type": "object",
    "properties": {
      "product_id": {"type": "string", "description": "The product SKU"}
    },
    "required": ["product_id"]
  },
  "endpoint_url": "https://api.example.com/inventory",
  "method": "GET",
  "headers": {
    "Authorization": "Bearer {{API_KEY}}"
  }
}
```

## Response

<ResponseExample>
  ```json 200 theme={null}
  {
    "id": "tool_abc123",
    "name": "check_inventory",
    "type": "function",
    "description": "Check product inventory levels",
    "created_at": "2026-03-25T10:00:00Z"
  }
  ```
</ResponseExample>
