Create function
create_functionAdd a function with complete code (a new draft version, deployed for ?test). http true exposes it at / with one method; http false makes it background work (schedules, the console, MCP and functions.invoke run it; input arrives as req.body). Name it "before" or "after" for the special functions that run around every HTTP function (before(req): return a response to stop the call; after(req, res): return a changed response). JavaScript: export async function handler(req) { return { status: 200, body: {...} } }; Python: def handler(req): return {"status": 200, "body": {...}}. req has method, path, subpath, query, headers, body. Functions may use import { config, kv, table, file, functions } from "wisp".
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"project": "<project>",
"name": "<name>",
"code": "<code>"
},
"name": "create_function"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mcp | No | A tool of the project's MCP server (default: public HTTP functions) | |
| code | Yes | ||
| http | No | Expose over HTTP (false for background work; always false for before/after) | |
| name | Yes | Name and URL segment: lowercase letters, digits, - or _ | |
| method | No | HTTP method (default GET; POST without HTTP) | |
| project | Yes | Project id (p…) or address (slug) | |
| language | No | ||
| visibility | No | HTTP functions. private: only this project (its code, schedules, MCP server, console); internal: any project in the workspace | public |
| description | No | ||
| input_schema | No | JSON Schema (type object) of the query parameters (GET/DELETE) or JSON body (POST/PUT/PATCH, and functions without HTTP) | |
| output_schema | No | JSON Schema of the JSON response |