Skip to content

Register Custom Edge Function Tool

POST
/api/v3/organizations/{organisation}/ai/custom-tools

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.

Authorizations

Parameters

Path Parameters

organisation
required
string

The organisation ID

Request Body required

object
name
required

Unique tool name (alphanumeric and underscores only)

string
check_inventory
description
required

Human-readable description of what the tool does

string
Check product inventory levels in warehouse
edgeFunctionCode
required

JavaScript source code for the edge function

string
inputSchema
required

JSON-encoded JSON Schema object defining the tool’s input parameters

string
isAsync

Whether this tool runs asynchronously (>5 seconds)

boolean
timeoutSeconds

Tool execution timeout

integer
default: 30 >= 5 <= 300
outputSchema

JSON-encoded JSON Schema object defining the tool’s output structure

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

Responses

201

Custom tool registered successfully

object
success
boolean
true
tool
object
edgeFunctionUrl

Computed edge function URL (read-only)

string
https://preview.quantcdn.io/_quant/ai-exec/org/project/uuid
edgeFunctionCode

The deployed edge function code

string
isUpdate

Whether this was an update to an existing tool

boolean
message
string
Custom tool deployed successfully

400

Invalid request parameters

403

Access denied

500

Failed to register custom tool