call-cognite-function

Installation
SKILL.md

Call Cognite Function

Invoke any deployed Cognite CDF Function, poll until it completes, and return a typed, schema-validated result.

Overview

The CDF Functions API uses a three-step protocol:

  1. Session nonce — exchange the current user token for a short-lived nonce so the function can make authenticated API calls on the user's behalf.
  2. Invoke — POST to the function's /call endpoint with your input data and the nonce.
  3. Poll → fetch — GET the call status in a loop; once "Completed", GET the /response endpoint.

Every API response is validated with Zod, so schema drift surfaces as a clear ZodError at the call site instead of an undefined three layers down. The function's own output payload can also be validated against a caller-supplied schema — which doubles as the source of the return type.

Files

File Purpose
code/cogniteFunctionService.ts Framework-agnostic async function with Zod validation. Zero React deps. Copy into src/services/.
code/useCogniteFunction.ts React Query (useMutation) hook wrapping the service. Copy into src/hooks/.
Installs
4
GitHub Stars
5
First Seen
12 days ago
call-cognite-function — cognitedata/builder-skills