curl --request PATCH \
--url https://api.tryhamsa.com/v2/voice-agents/web-tool/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "FUNCTION",
"name": "Get Weather Data",
"description": "Fetches current weather data for a given location",
"async": false,
"messages": [
{
"type": "REQUEST_START",
"content": "Fetching weather data..."
}
],
"params": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city name to get weather for"
},
"units": {
"type": "string",
"description": "Temperature units",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location"
]
}
}
'import requests
url = "https://api.tryhamsa.com/v2/voice-agents/web-tool/{id}"
payload = {
"type": "FUNCTION",
"name": "Get Weather Data",
"description": "Fetches current weather data for a given location",
"async": False,
"messages": [
{
"type": "REQUEST_START",
"content": "Fetching weather data..."
}
],
"params": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city name to get weather for"
},
"units": {
"type": "string",
"description": "Temperature units",
"enum": ["celsius", "fahrenheit"]
}
},
"required": ["location"]
}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'FUNCTION',
name: 'Get Weather Data',
description: 'Fetches current weather data for a given location',
async: false,
messages: [{type: 'REQUEST_START', content: 'Fetching weather data...'}],
params: {
type: 'object',
properties: {
location: {type: 'string', description: 'The city name to get weather for'},
units: {
type: 'string',
description: 'Temperature units',
enum: ['celsius', 'fahrenheit']
}
},
required: ['location']
}
})
};
fetch('https://api.tryhamsa.com/v2/voice-agents/web-tool/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tryhamsa.com/v2/voice-agents/web-tool/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'FUNCTION',
'name' => 'Get Weather Data',
'description' => 'Fetches current weather data for a given location',
'async' => false,
'messages' => [
[
'type' => 'REQUEST_START',
'content' => 'Fetching weather data...'
]
],
'params' => [
'type' => 'object',
'properties' => [
'location' => [
'type' => 'string',
'description' => 'The city name to get weather for'
],
'units' => [
'type' => 'string',
'description' => 'Temperature units',
'enum' => [
'celsius',
'fahrenheit'
]
]
],
'required' => [
'location'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tryhamsa.com/v2/voice-agents/web-tool/{id}"
payload := strings.NewReader("{\n \"type\": \"FUNCTION\",\n \"name\": \"Get Weather Data\",\n \"description\": \"Fetches current weather data for a given location\",\n \"async\": false,\n \"messages\": [\n {\n \"type\": \"REQUEST_START\",\n \"content\": \"Fetching weather data...\"\n }\n ],\n \"params\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city name to get weather for\"\n },\n \"units\": {\n \"type\": \"string\",\n \"description\": \"Temperature units\",\n \"enum\": [\n \"celsius\",\n \"fahrenheit\"\n ]\n }\n },\n \"required\": [\n \"location\"\n ]\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.tryhamsa.com/v2/voice-agents/web-tool/{id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"FUNCTION\",\n \"name\": \"Get Weather Data\",\n \"description\": \"Fetches current weather data for a given location\",\n \"async\": false,\n \"messages\": [\n {\n \"type\": \"REQUEST_START\",\n \"content\": \"Fetching weather data...\"\n }\n ],\n \"params\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city name to get weather for\"\n },\n \"units\": {\n \"type\": \"string\",\n \"description\": \"Temperature units\",\n \"enum\": [\n \"celsius\",\n \"fahrenheit\"\n ]\n }\n },\n \"required\": [\n \"location\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryhamsa.com/v2/voice-agents/web-tool/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"FUNCTION\",\n \"name\": \"Get Weather Data\",\n \"description\": \"Fetches current weather data for a given location\",\n \"async\": false,\n \"messages\": [\n {\n \"type\": \"REQUEST_START\",\n \"content\": \"Fetching weather data...\"\n }\n ],\n \"params\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city name to get weather for\"\n },\n \"units\": {\n \"type\": \"string\",\n \"description\": \"Temperature units\",\n \"enum\": [\n \"celsius\",\n \"fahrenheit\"\n ]\n }\n },\n \"required\": [\n \"location\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "48f7656f-098b-4c43-b165-7cfd2cc8ac30",
"persistentId": "48f7656f-098b-4c43-b165-7cfd2cc8ac30",
"version": 1,
"name": "Get Weather Data",
"type": "FUNCTION",
"userId": "48f7656f-098b-4c43-b165-7cfd2cc8ac30",
"projectId": "48f7656f-098b-4c43-b165-7cfd2cc8ac30",
"isActive": true,
"async": false,
"description": "Fetches current weather data for a given location",
"collectionId": "48f7656f-098b-4c43-b165-7cfd2cc8ac30",
"toolSettings": {
"httpHeaders": {},
"pathParameters": {},
"serverUrl": "<string>",
"timeout": 123,
"authToken": "<string>",
"methodType": "<string>"
},
"params": {},
"messages": [
{
"type": "REQUEST_START",
"content": "Fetching weather data..."
}
]
}
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}Update Web Tool
Updates an existing web tool by ID. All fields are optional except projectId.
curl --request PATCH \
--url https://api.tryhamsa.com/v2/voice-agents/web-tool/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "FUNCTION",
"name": "Get Weather Data",
"description": "Fetches current weather data for a given location",
"async": false,
"messages": [
{
"type": "REQUEST_START",
"content": "Fetching weather data..."
}
],
"params": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city name to get weather for"
},
"units": {
"type": "string",
"description": "Temperature units",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location"
]
}
}
'import requests
url = "https://api.tryhamsa.com/v2/voice-agents/web-tool/{id}"
payload = {
"type": "FUNCTION",
"name": "Get Weather Data",
"description": "Fetches current weather data for a given location",
"async": False,
"messages": [
{
"type": "REQUEST_START",
"content": "Fetching weather data..."
}
],
"params": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city name to get weather for"
},
"units": {
"type": "string",
"description": "Temperature units",
"enum": ["celsius", "fahrenheit"]
}
},
"required": ["location"]
}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'FUNCTION',
name: 'Get Weather Data',
description: 'Fetches current weather data for a given location',
async: false,
messages: [{type: 'REQUEST_START', content: 'Fetching weather data...'}],
params: {
type: 'object',
properties: {
location: {type: 'string', description: 'The city name to get weather for'},
units: {
type: 'string',
description: 'Temperature units',
enum: ['celsius', 'fahrenheit']
}
},
required: ['location']
}
})
};
fetch('https://api.tryhamsa.com/v2/voice-agents/web-tool/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tryhamsa.com/v2/voice-agents/web-tool/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'FUNCTION',
'name' => 'Get Weather Data',
'description' => 'Fetches current weather data for a given location',
'async' => false,
'messages' => [
[
'type' => 'REQUEST_START',
'content' => 'Fetching weather data...'
]
],
'params' => [
'type' => 'object',
'properties' => [
'location' => [
'type' => 'string',
'description' => 'The city name to get weather for'
],
'units' => [
'type' => 'string',
'description' => 'Temperature units',
'enum' => [
'celsius',
'fahrenheit'
]
]
],
'required' => [
'location'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tryhamsa.com/v2/voice-agents/web-tool/{id}"
payload := strings.NewReader("{\n \"type\": \"FUNCTION\",\n \"name\": \"Get Weather Data\",\n \"description\": \"Fetches current weather data for a given location\",\n \"async\": false,\n \"messages\": [\n {\n \"type\": \"REQUEST_START\",\n \"content\": \"Fetching weather data...\"\n }\n ],\n \"params\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city name to get weather for\"\n },\n \"units\": {\n \"type\": \"string\",\n \"description\": \"Temperature units\",\n \"enum\": [\n \"celsius\",\n \"fahrenheit\"\n ]\n }\n },\n \"required\": [\n \"location\"\n ]\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.tryhamsa.com/v2/voice-agents/web-tool/{id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"FUNCTION\",\n \"name\": \"Get Weather Data\",\n \"description\": \"Fetches current weather data for a given location\",\n \"async\": false,\n \"messages\": [\n {\n \"type\": \"REQUEST_START\",\n \"content\": \"Fetching weather data...\"\n }\n ],\n \"params\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city name to get weather for\"\n },\n \"units\": {\n \"type\": \"string\",\n \"description\": \"Temperature units\",\n \"enum\": [\n \"celsius\",\n \"fahrenheit\"\n ]\n }\n },\n \"required\": [\n \"location\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryhamsa.com/v2/voice-agents/web-tool/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"FUNCTION\",\n \"name\": \"Get Weather Data\",\n \"description\": \"Fetches current weather data for a given location\",\n \"async\": false,\n \"messages\": [\n {\n \"type\": \"REQUEST_START\",\n \"content\": \"Fetching weather data...\"\n }\n ],\n \"params\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city name to get weather for\"\n },\n \"units\": {\n \"type\": \"string\",\n \"description\": \"Temperature units\",\n \"enum\": [\n \"celsius\",\n \"fahrenheit\"\n ]\n }\n },\n \"required\": [\n \"location\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "48f7656f-098b-4c43-b165-7cfd2cc8ac30",
"persistentId": "48f7656f-098b-4c43-b165-7cfd2cc8ac30",
"version": 1,
"name": "Get Weather Data",
"type": "FUNCTION",
"userId": "48f7656f-098b-4c43-b165-7cfd2cc8ac30",
"projectId": "48f7656f-098b-4c43-b165-7cfd2cc8ac30",
"isActive": true,
"async": false,
"description": "Fetches current weather data for a given location",
"collectionId": "48f7656f-098b-4c43-b165-7cfd2cc8ac30",
"toolSettings": {
"httpHeaders": {},
"pathParameters": {},
"serverUrl": "<string>",
"timeout": 123,
"authToken": "<string>",
"methodType": "<string>"
},
"params": {},
"messages": [
{
"type": "REQUEST_START",
"content": "Fetching weather data..."
}
]
}
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}Authorizations
Pass the API key in the Authorization header, You need to put Token keyword before the API key. e.g. 'Authorization: Token '
Path Parameters
The unique identifier of the web tool to update
"48f7656f-098b-4c43-b165-7cfd2cc8ac30"
Body
The type of web tool
FUNCTION, MCP, WEB_TOOL "FUNCTION"
The name of the web tool
250"Get Weather Data"
A description of what the web tool does
1000"Fetches current weather data for a given location"
Whether the tool runs asynchronously. Not allowed for MCP type.
false
Server configuration for the web tool. Required for FUNCTION and MCP types, not allowed for WEB_TOOL type.
Show child attributes
Show child attributes
Messages to display during tool execution
Show child attributes
Show child attributes
OpenAPI-style schema defining the parameters for the web tool. Not allowed for MCP type.
Show child attributes
Show child attributes
Was this page helpful?