Register Custom Edge Function Tool
const url = 'https://dashboard.quantcdn.io/api/v3/organizations/example/ai/custom-tools';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"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"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The organisation ID
Request Bodyrequired
Section titled “Request Bodyrequired”object
Unique tool name (alphanumeric and underscores only)
Example
check_inventoryHuman-readable description of what the tool does
Example
Check product inventory levels in warehouseJavaScript source code for the edge function
JSON-encoded JSON Schema object defining the tool’s input parameters
Whether this tool runs asynchronously (>5 seconds)
Tool execution timeout
JSON-encoded JSON Schema object defining the tool’s output structure
Human-readable description of the tool’s output
Category to group related tools
How the tool response is handled: llm (passed back to model) or direct (returned to user)
Responses
Section titled “Responses”Custom tool registered successfully
object
object
Computed edge function URL (read-only)
The deployed edge function code
Whether this was an update to an existing tool
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
