Skip to content

Register Custom Edge Function Tool

POST
/api/v3/organizations/{organisation}/ai/custom-tools
curl --request POST \
--url https://dashboard.quantcdn.io/api/v3/organizations/example/ai/custom-tools \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "name": "check_inventory", "description": "Check product inventory levels in warehouse", "edgeFunctionCode": "example", "inputSchema": "example", "isAsync": false, "timeoutSeconds": 30, "outputSchema": "example", "outputSchemaDescription": "example", "category": "example", "responseMode": "llm" }'

Registers a custom edge function as a tool that AI models can invoke. Provide edgeFunctionCode (JavaScript) and the API will deploy it to the CDN, compute the edge function URL, and register the tool. * * Edge Function Contract: * - Edge functions must accept POST requests with JSON payload * - Expected request format: { 'toolName': '...', 'input': {...}, 'orgId': '...' } * - Must return JSON response with either result or error field * * Idempotent Updates: * POSTing with the same name will update the existing tool — the edge function code is redeployed to the same UUID and the tool registration is updated. * * Async Tools: * Set isAsync: true for operations >5 seconds. The edge function should return { executionId: '...' } and the AI will poll for completion.

organisation
required
string

The organisation ID

Media typeapplication/json
object
name
required

Unique tool name (alphanumeric and underscores only)

string
Example
check_inventory
description
required

Human-readable description of what the tool does

string
Example
Check product inventory levels in warehouse
edgeFunctionCode
required

JavaScript source code for the edge function

string
inputSchema
required

JSON Schema defining the tool’s input parameters. The API accepts a JSON object here and rejects a JSON-encoded string with a 422; the declared type string is a known inaccuracy kept to avoid changing generated clients.

string
isAsync

Whether this tool runs asynchronously (>5 seconds)

boolean
timeoutSeconds

Tool execution timeout

integer
default: 30 >= 5 <= 300
outputSchema

JSON Schema defining the tool’s output structure. The API accepts a JSON object here and rejects a JSON-encoded string with a 422; the declared type string is a known inaccuracy kept to avoid changing generated clients.

string
nullable
outputSchemaDescription

Human-readable description of the tool’s output

string
nullable
category

Category to group related tools

string
nullable <= 100 characters
responseMode

How the tool response is handled: llm (passed back to model) or direct (returned to user)

string
nullable
Allowed values: llm direct

Custom tool registered successfully

Media typeapplication/json
object
success
boolean
tool
object
edgeFunctionUrl

Computed edge function URL (read-only)

string
edgeFunctionCode

The deployed edge function code

string
isUpdate

Whether this was an update to an existing tool

boolean
message
string
Example
{
"success": true,
"edgeFunctionUrl": "https://preview.quantcdn.io/_quant/ai-exec/org/project/uuid",
"message": "Custom tool deployed successfully"
}

Invalid request parameters

Access denied

Failed to register custom tool