Skip to main content
Preview — Jelou Functions is in preview. The API and behavior may change without prior notice.

When to use app() vs define()?

If your project has a single handler, use define(). If you need to group multiple operations — for example, sending and reading emails from the same service — use app().

Basic example

index.ts

Local testing

Start the server with jelou functions dev and test each tool at its route:
If you send an invalid field, you receive a 400 with details:

API

Type signature:

AppConfig

Auto-generated routes

Your tools object keys are automatically converted to kebab-case to generate HTTP routes: To customize a route, use config.path in the individual define():

Config combination

The global config of app() applies to all tools. Each define() can override specific values:
In this example, fast has a 5-second timeout and slow inherits the global 30 seconds. Both share the CORS configuration.

Health endpoint

In app mode, /__health returns information about all tools:

Type guards

Use isEdgeApp() and isEdgeFunction() to identify the export type at runtime:

Multi-tool cron

Each tool inside app() can have its own independent cron schedules. Cron requests are sent to the specific route of each tool.
The 10 cron schedule limit is aggregated across all tools in an app(). If dailyCleanup has 3 and hourlySync has 4, only 3 remain available.

Multi-tool MCP

A single MCP server at /mcp automatically registers all tools from the app(). To exclude a tool from the MCP registry, use mcp: false in its config:
In this example, AI agents only discover publicTool via MCP. internalTool is only accessible via direct HTTP at its /internal-tool route.

Exposed routes (app mode)

Common issues

tools keys are converted to kebab-case. If your key is sendEmail, the route is /send-email, not /sendEmail.Verify the actual routes with the health check:

Next steps

Testing

Learn to test multi-tool functions with createMockApp().

MCP

Configure the unified MCP server for your AI agents.

Cron

Independent schedules per tool inside app().