JavaScript
import Roark from '@roarkanalytics/sdk';
const client = new Roark({
bearerToken: process.env['ROARK_API_BEARER_TOKEN'], // This is the default and can be omitted
});
const tool = await client.tool.create({ description: 'x', name: 'book_appointment' });
console.log(tool.data);import os
from roark_analytics import Roark
client = Roark(
bearer_token=os.environ.get("ROARK_API_BEARER_TOKEN"), # This is the default and can be omitted
)
tool = client.tool.create(
description="x",
name="book_appointment",
)
print(tool.data)curl --request POST \
--url https://api.roark.ai/v1/tool \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "book_appointment",
"description": "<string>",
"agentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"inputs": [],
"invocationCriteria": "<string>",
"expectedResult": "<string>",
"runtime": {
"request": {
"url": "<string>",
"method": "POST",
"headers": [],
"body": "<string>",
"timeoutMs": 15500
},
"changesData": false,
"responseFields": [
"<string>"
],
"messages": {
"before": "<string>",
"slow": "<string>",
"failure": "<string>"
}
},
"calendar": {
"calendarConnectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"appointmentTypes": [
{
"name": "checkup",
"whenToUse": "<string>",
"eventTypeId": 123,
"calendarTargetId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"durationMinutes": 123
}
],
"simulate": false,
"messages": {
"before": "<string>",
"slow": "<string>",
"failure": "<string>"
}
},
"mcp": {
"mcpServerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tool": "<string>",
"messages": {
"before": "<string>",
"slow": "<string>",
"failure": "<string>"
}
}
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.roark.ai/v1/tool",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'book_appointment',
'description' => '<string>',
'agentId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'inputs' => [
],
'invocationCriteria' => '<string>',
'expectedResult' => '<string>',
'runtime' => [
'request' => [
'url' => '<string>',
'method' => 'POST',
'headers' => [
],
'body' => '<string>',
'timeoutMs' => 15500
],
'changesData' => false,
'responseFields' => [
'<string>'
],
'messages' => [
'before' => '<string>',
'slow' => '<string>',
'failure' => '<string>'
]
],
'calendar' => [
'calendarConnectionId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'appointmentTypes' => [
[
'name' => 'checkup',
'whenToUse' => '<string>',
'eventTypeId' => 123,
'calendarTargetId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'durationMinutes' => 123
]
],
'simulate' => false,
'messages' => [
'before' => '<string>',
'slow' => '<string>',
'failure' => '<string>'
]
],
'mcp' => [
'mcpServerId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'tool' => '<string>',
'messages' => [
'before' => '<string>',
'slow' => '<string>',
'failure' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.roark.ai/v1/tool"
payload := strings.NewReader("{\n \"name\": \"book_appointment\",\n \"description\": \"<string>\",\n \"agentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"inputs\": [],\n \"invocationCriteria\": \"<string>\",\n \"expectedResult\": \"<string>\",\n \"runtime\": {\n \"request\": {\n \"url\": \"<string>\",\n \"method\": \"POST\",\n \"headers\": [],\n \"body\": \"<string>\",\n \"timeoutMs\": 15500\n },\n \"changesData\": false,\n \"responseFields\": [\n \"<string>\"\n ],\n \"messages\": {\n \"before\": \"<string>\",\n \"slow\": \"<string>\",\n \"failure\": \"<string>\"\n }\n },\n \"calendar\": {\n \"calendarConnectionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"appointmentTypes\": [\n {\n \"name\": \"checkup\",\n \"whenToUse\": \"<string>\",\n \"eventTypeId\": 123,\n \"calendarTargetId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"durationMinutes\": 123\n }\n ],\n \"simulate\": false,\n \"messages\": {\n \"before\": \"<string>\",\n \"slow\": \"<string>\",\n \"failure\": \"<string>\"\n }\n },\n \"mcp\": {\n \"mcpServerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"tool\": \"<string>\",\n \"messages\": {\n \"before\": \"<string>\",\n \"slow\": \"<string>\",\n \"failure\": \"<string>\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.post("https://api.roark.ai/v1/tool")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"book_appointment\",\n \"description\": \"<string>\",\n \"agentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"inputs\": [],\n \"invocationCriteria\": \"<string>\",\n \"expectedResult\": \"<string>\",\n \"runtime\": {\n \"request\": {\n \"url\": \"<string>\",\n \"method\": \"POST\",\n \"headers\": [],\n \"body\": \"<string>\",\n \"timeoutMs\": 15500\n },\n \"changesData\": false,\n \"responseFields\": [\n \"<string>\"\n ],\n \"messages\": {\n \"before\": \"<string>\",\n \"slow\": \"<string>\",\n \"failure\": \"<string>\"\n }\n },\n \"calendar\": {\n \"calendarConnectionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"appointmentTypes\": [\n {\n \"name\": \"checkup\",\n \"whenToUse\": \"<string>\",\n \"eventTypeId\": 123,\n \"calendarTargetId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"durationMinutes\": 123\n }\n ],\n \"simulate\": false,\n \"messages\": {\n \"before\": \"<string>\",\n \"slow\": \"<string>\",\n \"failure\": \"<string>\"\n }\n },\n \"mcp\": {\n \"mcpServerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"tool\": \"<string>\",\n \"messages\": {\n \"before\": \"<string>\",\n \"slow\": \"<string>\",\n \"failure\": \"<string>\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.roark.ai/v1/tool")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"book_appointment\",\n \"description\": \"<string>\",\n \"agentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"inputs\": [],\n \"invocationCriteria\": \"<string>\",\n \"expectedResult\": \"<string>\",\n \"runtime\": {\n \"request\": {\n \"url\": \"<string>\",\n \"method\": \"POST\",\n \"headers\": [],\n \"body\": \"<string>\",\n \"timeoutMs\": 15500\n },\n \"changesData\": false,\n \"responseFields\": [\n \"<string>\"\n ],\n \"messages\": {\n \"before\": \"<string>\",\n \"slow\": \"<string>\",\n \"failure\": \"<string>\"\n }\n },\n \"calendar\": {\n \"calendarConnectionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"appointmentTypes\": [\n {\n \"name\": \"checkup\",\n \"whenToUse\": \"<string>\",\n \"eventTypeId\": 123,\n \"calendarTargetId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"durationMinutes\": 123\n }\n ],\n \"simulate\": false,\n \"messages\": {\n \"before\": \"<string>\",\n \"slow\": \"<string>\",\n \"failure\": \"<string>\"\n }\n },\n \"mcp\": {\n \"mcpServerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"tool\": \"<string>\",\n \"messages\": {\n \"before\": \"<string>\",\n \"slow\": \"<string>\",\n \"failure\": \"<string>\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "book_appointment",
"source": "CUSTOM",
"systemKey": "<string>",
"agentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"version": 123,
"description": "<string>",
"inputs": [
{
"name": "date",
"type": "string",
"description": "ISO date",
"required": true
}
],
"invocationCriteria": "<string>",
"expectedResult": "<string>",
"runtime": {
"request": {
"url": "https://api.example.com/bookings",
"method": "POST",
"headers": [
{
"name": "X-Api-Version",
"value": "2026-10-01"
}
],
"body": "<string>",
"timeoutMs": 123
},
"changesData": true,
"responseFields": [
"<string>"
],
"messages": {
"before": "<string>",
"slow": "<string>",
"failure": "<string>"
}
},
"calendar": {
"calendarConnectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"operation": "CHECK_AVAILABILITY",
"appointmentTypes": [
{
"name": "checkup",
"whenToUse": "<string>",
"eventTypeId": 123,
"calendarTargetId": "<string>",
"durationMinutes": 123
}
],
"simulate": true,
"messages": {
"before": "<string>",
"slow": "<string>",
"failure": "<string>"
}
},
"mcp": {
"mcpServerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tool": "search_customers",
"messages": {
"before": "<string>",
"slow": "<string>",
"failure": "<string>"
}
},
"createdAt": "<string>",
"updatedAt": "<string>"
}
}{
"type": "validation",
"code": "invalid_parameter",
"message": "The request was invalid",
"param": "email"
}{
"type": "authentication",
"code": "unauthorized",
"message": "Authentication required"
}{
"type": "not_found",
"code": "resource_not_found",
"message": "The requested resource could not be found"
}{
"type": "conflict",
"code": "resource_in_use",
"message": "The resource is in use and cannot be deleted"
}{
"type": "internal",
"code": "internal_error",
"message": "Internal server error"
}Tool
Create a tool
Creates a tool and declares its first version. A tool only recorded from calls under the same name is adopted; one already declared returns 409. Give it a runtime for a hosted agent to call your endpoint, a calendar for it to book on a calendar connected to the project, or mcp for it to call a tool on an MCP server connected to the project. Header values are returned on read, so keep secrets out of them.
POST
/
v1
/
tool
JavaScript
import Roark from '@roarkanalytics/sdk';
const client = new Roark({
bearerToken: process.env['ROARK_API_BEARER_TOKEN'], // This is the default and can be omitted
});
const tool = await client.tool.create({ description: 'x', name: 'book_appointment' });
console.log(tool.data);import os
from roark_analytics import Roark
client = Roark(
bearer_token=os.environ.get("ROARK_API_BEARER_TOKEN"), # This is the default and can be omitted
)
tool = client.tool.create(
description="x",
name="book_appointment",
)
print(tool.data)curl --request POST \
--url https://api.roark.ai/v1/tool \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "book_appointment",
"description": "<string>",
"agentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"inputs": [],
"invocationCriteria": "<string>",
"expectedResult": "<string>",
"runtime": {
"request": {
"url": "<string>",
"method": "POST",
"headers": [],
"body": "<string>",
"timeoutMs": 15500
},
"changesData": false,
"responseFields": [
"<string>"
],
"messages": {
"before": "<string>",
"slow": "<string>",
"failure": "<string>"
}
},
"calendar": {
"calendarConnectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"appointmentTypes": [
{
"name": "checkup",
"whenToUse": "<string>",
"eventTypeId": 123,
"calendarTargetId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"durationMinutes": 123
}
],
"simulate": false,
"messages": {
"before": "<string>",
"slow": "<string>",
"failure": "<string>"
}
},
"mcp": {
"mcpServerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tool": "<string>",
"messages": {
"before": "<string>",
"slow": "<string>",
"failure": "<string>"
}
}
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.roark.ai/v1/tool",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'book_appointment',
'description' => '<string>',
'agentId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'inputs' => [
],
'invocationCriteria' => '<string>',
'expectedResult' => '<string>',
'runtime' => [
'request' => [
'url' => '<string>',
'method' => 'POST',
'headers' => [
],
'body' => '<string>',
'timeoutMs' => 15500
],
'changesData' => false,
'responseFields' => [
'<string>'
],
'messages' => [
'before' => '<string>',
'slow' => '<string>',
'failure' => '<string>'
]
],
'calendar' => [
'calendarConnectionId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'appointmentTypes' => [
[
'name' => 'checkup',
'whenToUse' => '<string>',
'eventTypeId' => 123,
'calendarTargetId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'durationMinutes' => 123
]
],
'simulate' => false,
'messages' => [
'before' => '<string>',
'slow' => '<string>',
'failure' => '<string>'
]
],
'mcp' => [
'mcpServerId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'tool' => '<string>',
'messages' => [
'before' => '<string>',
'slow' => '<string>',
'failure' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.roark.ai/v1/tool"
payload := strings.NewReader("{\n \"name\": \"book_appointment\",\n \"description\": \"<string>\",\n \"agentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"inputs\": [],\n \"invocationCriteria\": \"<string>\",\n \"expectedResult\": \"<string>\",\n \"runtime\": {\n \"request\": {\n \"url\": \"<string>\",\n \"method\": \"POST\",\n \"headers\": [],\n \"body\": \"<string>\",\n \"timeoutMs\": 15500\n },\n \"changesData\": false,\n \"responseFields\": [\n \"<string>\"\n ],\n \"messages\": {\n \"before\": \"<string>\",\n \"slow\": \"<string>\",\n \"failure\": \"<string>\"\n }\n },\n \"calendar\": {\n \"calendarConnectionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"appointmentTypes\": [\n {\n \"name\": \"checkup\",\n \"whenToUse\": \"<string>\",\n \"eventTypeId\": 123,\n \"calendarTargetId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"durationMinutes\": 123\n }\n ],\n \"simulate\": false,\n \"messages\": {\n \"before\": \"<string>\",\n \"slow\": \"<string>\",\n \"failure\": \"<string>\"\n }\n },\n \"mcp\": {\n \"mcpServerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"tool\": \"<string>\",\n \"messages\": {\n \"before\": \"<string>\",\n \"slow\": \"<string>\",\n \"failure\": \"<string>\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.post("https://api.roark.ai/v1/tool")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"book_appointment\",\n \"description\": \"<string>\",\n \"agentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"inputs\": [],\n \"invocationCriteria\": \"<string>\",\n \"expectedResult\": \"<string>\",\n \"runtime\": {\n \"request\": {\n \"url\": \"<string>\",\n \"method\": \"POST\",\n \"headers\": [],\n \"body\": \"<string>\",\n \"timeoutMs\": 15500\n },\n \"changesData\": false,\n \"responseFields\": [\n \"<string>\"\n ],\n \"messages\": {\n \"before\": \"<string>\",\n \"slow\": \"<string>\",\n \"failure\": \"<string>\"\n }\n },\n \"calendar\": {\n \"calendarConnectionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"appointmentTypes\": [\n {\n \"name\": \"checkup\",\n \"whenToUse\": \"<string>\",\n \"eventTypeId\": 123,\n \"calendarTargetId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"durationMinutes\": 123\n }\n ],\n \"simulate\": false,\n \"messages\": {\n \"before\": \"<string>\",\n \"slow\": \"<string>\",\n \"failure\": \"<string>\"\n }\n },\n \"mcp\": {\n \"mcpServerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"tool\": \"<string>\",\n \"messages\": {\n \"before\": \"<string>\",\n \"slow\": \"<string>\",\n \"failure\": \"<string>\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.roark.ai/v1/tool")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"book_appointment\",\n \"description\": \"<string>\",\n \"agentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"inputs\": [],\n \"invocationCriteria\": \"<string>\",\n \"expectedResult\": \"<string>\",\n \"runtime\": {\n \"request\": {\n \"url\": \"<string>\",\n \"method\": \"POST\",\n \"headers\": [],\n \"body\": \"<string>\",\n \"timeoutMs\": 15500\n },\n \"changesData\": false,\n \"responseFields\": [\n \"<string>\"\n ],\n \"messages\": {\n \"before\": \"<string>\",\n \"slow\": \"<string>\",\n \"failure\": \"<string>\"\n }\n },\n \"calendar\": {\n \"calendarConnectionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"appointmentTypes\": [\n {\n \"name\": \"checkup\",\n \"whenToUse\": \"<string>\",\n \"eventTypeId\": 123,\n \"calendarTargetId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"durationMinutes\": 123\n }\n ],\n \"simulate\": false,\n \"messages\": {\n \"before\": \"<string>\",\n \"slow\": \"<string>\",\n \"failure\": \"<string>\"\n }\n },\n \"mcp\": {\n \"mcpServerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"tool\": \"<string>\",\n \"messages\": {\n \"before\": \"<string>\",\n \"slow\": \"<string>\",\n \"failure\": \"<string>\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "book_appointment",
"source": "CUSTOM",
"systemKey": "<string>",
"agentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"version": 123,
"description": "<string>",
"inputs": [
{
"name": "date",
"type": "string",
"description": "ISO date",
"required": true
}
],
"invocationCriteria": "<string>",
"expectedResult": "<string>",
"runtime": {
"request": {
"url": "https://api.example.com/bookings",
"method": "POST",
"headers": [
{
"name": "X-Api-Version",
"value": "2026-10-01"
}
],
"body": "<string>",
"timeoutMs": 123
},
"changesData": true,
"responseFields": [
"<string>"
],
"messages": {
"before": "<string>",
"slow": "<string>",
"failure": "<string>"
}
},
"calendar": {
"calendarConnectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"operation": "CHECK_AVAILABILITY",
"appointmentTypes": [
{
"name": "checkup",
"whenToUse": "<string>",
"eventTypeId": 123,
"calendarTargetId": "<string>",
"durationMinutes": 123
}
],
"simulate": true,
"messages": {
"before": "<string>",
"slow": "<string>",
"failure": "<string>"
}
},
"mcp": {
"mcpServerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tool": "search_customers",
"messages": {
"before": "<string>",
"slow": "<string>",
"failure": "<string>"
}
},
"createdAt": "<string>",
"updatedAt": "<string>"
}
}{
"type": "validation",
"code": "invalid_parameter",
"message": "The request was invalid",
"param": "email"
}{
"type": "authentication",
"code": "unauthorized",
"message": "Authentication required"
}{
"type": "not_found",
"code": "resource_not_found",
"message": "The requested resource could not be found"
}{
"type": "conflict",
"code": "resource_in_use",
"message": "The resource is in use and cannot be deleted"
}{
"type": "internal",
"code": "internal_error",
"message": "Internal server error"
}Authorizations
Body
application/json