Skip to main content

Function Definition Structure

A complete function definition includes:

Components

Name

  • Use snake_case
  • Be descriptive but concise
  • Unique within agent

Description

The most important part. Be specific about:
  • What the function does
  • When to call it
  • What triggers it
❌ Bad:
✅ Good:

Parameters

Define using JSON Schema:

API Endpoint

Your API URL to call:

HTTP Method

Options: GET, POST, PUT, PATCH, DELETE

Headers

Authentication and content type:

Body Template

Map parameters to API request body:

Context Variables

Use these built-in variables: Plus any custom variables from contact metadata.

Parameter Types

String

Number

Boolean

Enum

Array

Object


HTTP Methods

GET

Retrieve data without side effects:

POST

Create new resources or submit data:

PUT

Update existing resources:

Authentication

Bearer Token

API Key Header

Basic Auth

Never hardcode API keys. Use environment variables: {{API_KEY}}.

Next Steps

Examples

View ready-to-use function examples

Best Practices

Learn function calling best practices