v1

latestOpenAPI 3.0.02026-07-268285163.6 KB
Assistant Tools

Update assistant tool

Update an existing assistant tool

put/assistantTool/{tool_id}

Path parameters

tool_idstring required

ID of the assistant tool to update

Request body

namestring
definitionstring

JSON string containing the tool definition

functionstring

JavaScript code for the tool execution

icon_urlstring

Example request

{
  "name": "Weather Lookup",
  "definition": "{\n  \"name\": \"get_weather_forecast\",\n  \"description\": \"Retrieves the weather forecast for a specific location.\",\n  \"strict\": true,\n  \"parameters\": {\n    \"type\": \"object\",\n    \"required\": [\"location\"],\n    \"properties\": {\n      \"location\": {\n        \"type\": \"string\",\n        \"description\": \"The city or location.\"\n      }\n    },\n    \"additionalProperties\": false\n  }\n}",
  "function": "let location = {{location}};\nlet response = location ? `Weather: ${location} is sunny` : 'Missing location';\noutput.answer = response;\ncallback(output);",
  "icon_url": "assets/img/integrations/custom-tool.png"
}

Response

Tool updated successfully

Example response

{
  "tool": {
    "_id": "60a1b2c3d4e5f6g7h8i9j0k1",
    "name": "Weather Lookup",
    "icon_url": "assets/img/integrations/custom-tool.png",
    "definition": "{\n  \"name\": \"get_weather_forecast\",\n  \"description\": \"Retrieves the weather forecast for a specific location.\",\n  \"strict\": true,\n  \"parameters\": {\n    \"type\": \"object\",\n    \"required\": [\n      \"location\"\n    ],\n    \"properties\": {\n      \"location\": {\n        \"type\": \"string\",\n        \"description\": \"The city or location for which to fetch the weather forecast.\"\n      },\n      \"days\": {\n        \"type\": \"integer\",\n        \"description\": \"Number of days for the forecast (1-7).\",\n        \"minimum\": 1,\n        \"maximum\": 7\n      }\n    },\n    \"additionalProperties\": false\n  }\n}",
    "function": "// Available nodejs environment with pre-installed libraries\n// https://docs.example.com/custom-code\nlet location = {{location}};\nlet days = {{days}} || 3;\nlet response = '';\n\nif(location) {\n  response = `Weather forecast for ${location} for ${days} days: Sunny with temperatures between 20-25°C`;\n} else {\n  response = 'Location parameter is required';\n}\n\noutput.answer = response;\ncallback(output);",
    "user_id": "5a1b2c3d4e5f6g7h8i9j0k11",
    "type": "custom",
    "createdAt": "2024-03-15T10:30:00.000Z",
    "updatedAt": "2024-03-15T10:30:00.000Z"
  }
}