Tools
Update a tool
Updates a tool. You can send only the fields that you want to change. A request to update an MCP tool is rejected, because MCP tools are read-only.
PATCH
/
tools
/
{id}
Update a tool
curl --request PATCH \
--url https://api-trial.cognigy.ai/v1/tools/{id} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"description": "An updated tool description",
"extension": "my-extension",
"name": "Updated Tool",
"parameters": [
{
"key": "input",
"mode": "dynamic",
"name": "input",
"type": "string",
"connectionTypes": [
"http_basic",
"http_oauth2"
],
"description": "The input parameter",
"value": "<unknown>"
}
],
"source": "extension",
"type": "action"
}
'import requests
url = "https://api-trial.cognigy.ai/v1/tools/{id}"
payload = {
"description": "An updated tool description",
"extension": "my-extension",
"name": "Updated Tool",
"parameters": [
{
"key": "input",
"mode": "dynamic",
"name": "input",
"type": "string",
"connectionTypes": ["http_basic", "http_oauth2"],
"description": "The input parameter",
"value": "<unknown>"
}
],
"source": "extension",
"type": "action"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
description: 'An updated tool description',
extension: 'my-extension',
name: 'Updated Tool',
parameters: [
{
key: 'input',
mode: 'dynamic',
name: 'input',
type: 'string',
connectionTypes: ['http_basic', 'http_oauth2'],
description: 'The input parameter',
value: '<unknown>'
}
],
source: 'extension',
type: 'action'
})
};
fetch('https://api-trial.cognigy.ai/v1/tools/{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-trial.cognigy.ai/v1/tools/{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([
'description' => 'An updated tool description',
'extension' => 'my-extension',
'name' => 'Updated Tool',
'parameters' => [
[
'key' => 'input',
'mode' => 'dynamic',
'name' => 'input',
'type' => 'string',
'connectionTypes' => [
'http_basic',
'http_oauth2'
],
'description' => 'The input parameter',
'value' => '<unknown>'
]
],
'source' => 'extension',
'type' => 'action'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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-trial.cognigy.ai/v1/tools/{id}"
payload := strings.NewReader("{\n \"description\": \"An updated tool description\",\n \"extension\": \"my-extension\",\n \"name\": \"Updated Tool\",\n \"parameters\": [\n {\n \"key\": \"input\",\n \"mode\": \"dynamic\",\n \"name\": \"input\",\n \"type\": \"string\",\n \"connectionTypes\": [\n \"http_basic\",\n \"http_oauth2\"\n ],\n \"description\": \"The input parameter\",\n \"value\": \"<unknown>\"\n }\n ],\n \"source\": \"extension\",\n \"type\": \"action\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-Key", "<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-trial.cognigy.ai/v1/tools/{id}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"An updated tool description\",\n \"extension\": \"my-extension\",\n \"name\": \"Updated Tool\",\n \"parameters\": [\n {\n \"key\": \"input\",\n \"mode\": \"dynamic\",\n \"name\": \"input\",\n \"type\": \"string\",\n \"connectionTypes\": [\n \"http_basic\",\n \"http_oauth2\"\n ],\n \"description\": \"The input parameter\",\n \"value\": \"<unknown>\"\n }\n ],\n \"source\": \"extension\",\n \"type\": \"action\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-trial.cognigy.ai/v1/tools/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"description\": \"An updated tool description\",\n \"extension\": \"my-extension\",\n \"name\": \"Updated Tool\",\n \"parameters\": [\n {\n \"key\": \"input\",\n \"mode\": \"dynamic\",\n \"name\": \"input\",\n \"type\": \"string\",\n \"connectionTypes\": [\n \"http_basic\",\n \"http_oauth2\"\n ],\n \"description\": \"The input parameter\",\n \"value\": \"<unknown>\"\n }\n ],\n \"source\": \"extension\",\n \"type\": \"action\"\n}"
response = http.request(request)
puts response.read_body{
"a2a": {
"agentReferenceId": "550e8400-e29b-41d4-a716-446655440000"
},
"builtinSlug": "my-tool-slug",
"createdAt": 1694518620,
"createdBy": "507f1f77bcf86cd799439011",
"description": "An updated tool description",
"extension": "my-extension",
"id": "507f1f77bcf86cd799439011",
"lastChangedAt": 1694518620,
"lastChangedBy": "507f1f77bcf86cd799439011",
"mcp": {
"inputSchema": {},
"serverReferenceId": "550e8400-e29b-41d4-a716-446655440000",
"toolName": "search_issues"
},
"name": "Updated Tool",
"organisationId": "507f1f77bcf86cd799439011",
"parameters": [
{
"connectionTypes": [
"http_basic",
"http_oauth2"
],
"description": "The input parameter",
"key": "input",
"mode": "dynamic",
"name": "input",
"type": "string",
"value": "<unknown>"
}
],
"projectId": "507f1f77bcf86cd799439011",
"referenceId": "550e8400-e29b-41d4-a716-446655440000",
"source": "extension",
"type": "action"
}{
"code": "reserved_tool_name",
"detail": "request body validation failed",
"errors": [
{
"field": "<string>",
"message": "<string>"
}
],
"instance": "/v1/{resource}",
"status": 400,
"title": "Bad Request",
"traceId": "api--a4d2f126-bec4-4544-a049-7c0cf08524ed",
"type": "about:blank"
}{
"detail": "access denied: insufficient permissions",
"instance": "/v1/{resource}/{id}",
"status": 403,
"title": "Forbidden",
"traceId": "api--a4d2f126-bec4-4544-a049-7c0cf08524ed",
"type": "about:blank"
}{
"detail": "the requested resource does not exist",
"instance": "/v1/{resource}/{id}",
"status": 404,
"title": "Not Found",
"traceId": "api--a4d2f126-bec4-4544-a049-7c0cf08524ed",
"type": "about:blank"
}{
"detail": "a resource with this identifier already exists",
"instance": "/v1/{resource}",
"status": 409,
"title": "Conflict",
"traceId": "api--a4d2f126-bec4-4544-a049-7c0cf08524ed",
"type": "about:blank"
}{
"detail": "internal server error",
"instance": "/v1/{resource}",
"status": 500,
"title": "Internal Server Error",
"traceId": "api--a4d2f126-bec4-4544-a049-7c0cf08524ed",
"type": "about:blank"
}Body
application/json
The fields to update. Fields that you omit stay unchanged.
Response
Returns the updated tool.
⌘I
Update a tool
curl --request PATCH \
--url https://api-trial.cognigy.ai/v1/tools/{id} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"description": "An updated tool description",
"extension": "my-extension",
"name": "Updated Tool",
"parameters": [
{
"key": "input",
"mode": "dynamic",
"name": "input",
"type": "string",
"connectionTypes": [
"http_basic",
"http_oauth2"
],
"description": "The input parameter",
"value": "<unknown>"
}
],
"source": "extension",
"type": "action"
}
'import requests
url = "https://api-trial.cognigy.ai/v1/tools/{id}"
payload = {
"description": "An updated tool description",
"extension": "my-extension",
"name": "Updated Tool",
"parameters": [
{
"key": "input",
"mode": "dynamic",
"name": "input",
"type": "string",
"connectionTypes": ["http_basic", "http_oauth2"],
"description": "The input parameter",
"value": "<unknown>"
}
],
"source": "extension",
"type": "action"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
description: 'An updated tool description',
extension: 'my-extension',
name: 'Updated Tool',
parameters: [
{
key: 'input',
mode: 'dynamic',
name: 'input',
type: 'string',
connectionTypes: ['http_basic', 'http_oauth2'],
description: 'The input parameter',
value: '<unknown>'
}
],
source: 'extension',
type: 'action'
})
};
fetch('https://api-trial.cognigy.ai/v1/tools/{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-trial.cognigy.ai/v1/tools/{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([
'description' => 'An updated tool description',
'extension' => 'my-extension',
'name' => 'Updated Tool',
'parameters' => [
[
'key' => 'input',
'mode' => 'dynamic',
'name' => 'input',
'type' => 'string',
'connectionTypes' => [
'http_basic',
'http_oauth2'
],
'description' => 'The input parameter',
'value' => '<unknown>'
]
],
'source' => 'extension',
'type' => 'action'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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-trial.cognigy.ai/v1/tools/{id}"
payload := strings.NewReader("{\n \"description\": \"An updated tool description\",\n \"extension\": \"my-extension\",\n \"name\": \"Updated Tool\",\n \"parameters\": [\n {\n \"key\": \"input\",\n \"mode\": \"dynamic\",\n \"name\": \"input\",\n \"type\": \"string\",\n \"connectionTypes\": [\n \"http_basic\",\n \"http_oauth2\"\n ],\n \"description\": \"The input parameter\",\n \"value\": \"<unknown>\"\n }\n ],\n \"source\": \"extension\",\n \"type\": \"action\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-Key", "<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-trial.cognigy.ai/v1/tools/{id}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"An updated tool description\",\n \"extension\": \"my-extension\",\n \"name\": \"Updated Tool\",\n \"parameters\": [\n {\n \"key\": \"input\",\n \"mode\": \"dynamic\",\n \"name\": \"input\",\n \"type\": \"string\",\n \"connectionTypes\": [\n \"http_basic\",\n \"http_oauth2\"\n ],\n \"description\": \"The input parameter\",\n \"value\": \"<unknown>\"\n }\n ],\n \"source\": \"extension\",\n \"type\": \"action\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-trial.cognigy.ai/v1/tools/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"description\": \"An updated tool description\",\n \"extension\": \"my-extension\",\n \"name\": \"Updated Tool\",\n \"parameters\": [\n {\n \"key\": \"input\",\n \"mode\": \"dynamic\",\n \"name\": \"input\",\n \"type\": \"string\",\n \"connectionTypes\": [\n \"http_basic\",\n \"http_oauth2\"\n ],\n \"description\": \"The input parameter\",\n \"value\": \"<unknown>\"\n }\n ],\n \"source\": \"extension\",\n \"type\": \"action\"\n}"
response = http.request(request)
puts response.read_body{
"a2a": {
"agentReferenceId": "550e8400-e29b-41d4-a716-446655440000"
},
"builtinSlug": "my-tool-slug",
"createdAt": 1694518620,
"createdBy": "507f1f77bcf86cd799439011",
"description": "An updated tool description",
"extension": "my-extension",
"id": "507f1f77bcf86cd799439011",
"lastChangedAt": 1694518620,
"lastChangedBy": "507f1f77bcf86cd799439011",
"mcp": {
"inputSchema": {},
"serverReferenceId": "550e8400-e29b-41d4-a716-446655440000",
"toolName": "search_issues"
},
"name": "Updated Tool",
"organisationId": "507f1f77bcf86cd799439011",
"parameters": [
{
"connectionTypes": [
"http_basic",
"http_oauth2"
],
"description": "The input parameter",
"key": "input",
"mode": "dynamic",
"name": "input",
"type": "string",
"value": "<unknown>"
}
],
"projectId": "507f1f77bcf86cd799439011",
"referenceId": "550e8400-e29b-41d4-a716-446655440000",
"source": "extension",
"type": "action"
}{
"code": "reserved_tool_name",
"detail": "request body validation failed",
"errors": [
{
"field": "<string>",
"message": "<string>"
}
],
"instance": "/v1/{resource}",
"status": 400,
"title": "Bad Request",
"traceId": "api--a4d2f126-bec4-4544-a049-7c0cf08524ed",
"type": "about:blank"
}{
"detail": "access denied: insufficient permissions",
"instance": "/v1/{resource}/{id}",
"status": 403,
"title": "Forbidden",
"traceId": "api--a4d2f126-bec4-4544-a049-7c0cf08524ed",
"type": "about:blank"
}{
"detail": "the requested resource does not exist",
"instance": "/v1/{resource}/{id}",
"status": 404,
"title": "Not Found",
"traceId": "api--a4d2f126-bec4-4544-a049-7c0cf08524ed",
"type": "about:blank"
}{
"detail": "a resource with this identifier already exists",
"instance": "/v1/{resource}",
"status": 409,
"title": "Conflict",
"traceId": "api--a4d2f126-bec4-4544-a049-7c0cf08524ed",
"type": "about:blank"
}{
"detail": "internal server error",
"instance": "/v1/{resource}",
"status": 500,
"title": "Internal Server Error",
"traceId": "api--a4d2f126-bec4-4544-a049-7c0cf08524ed",
"type": "about:blank"
}